Ignore:
Timestamp:
May 11, 2010, 1:52:51 PM (15 years ago)
Author:
[email protected]
Message:

JavaScriptCore: Patch by Gavin Barraclough.

Reviewed by Steve Falkenburg.

REGRESSION (r57900-57919): 3% PLT Regression from moving strings into WTF.
https://bugs.webkit.org/show_bug.cgi?id=38930
<rdar://problem/7937188>

When the String classes were moved from WebCore to WTF, it meant that on Windows, all operations
on Strings in WebCore had to cross a DLL boundary (from WebKit.dll to JavaScript.dll).

We fix this by refactoring some of the WTF string code, so the code in AtomicString, StringImpl, and
WTFString can be built by both WebCore and WTF, and we don't need to talk across a DLL to do operations
on Strings.

  • JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: Remove string exports, because these are now

handled in WebCore.

  • JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Remove the post-build step that was added

here (the post build step is in JavaScriptCoreCommon.vsprops).

  • JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops: Copy the three cpp files that need to be compiled

by WebCore into the WebKitOutputDir directory.

  • JavaScriptCore.vcproj/WTF/WTF.vcproj: Add the StringStatics file.
  • JavaScriptCore.vcproj/jsc/jsc.vcproj: Add the three WTF string cpp files to this project.
  • JavaScriptCore.vcproj/jsc/jscCommon.vsprops: Remove the need to link against WTF.lib (since jsc links against JavaScriptCore).
  • JavaScriptCore.xcodeproj/project.pbxproj: Add the StringStatics file.
  • wtf/text/AtomicString.cpp: Moved code to StringStatics.
  • wtf/text/StringImpl.cpp: Ditto.
  • wtf/text/StringStatics.cpp: Added. Move functions in WTF Strings that define static variables to here, so

the rest of the files can be compiled in WebCore.

(WebCore::StringImpl::empty): Moved from StringImpl.cpp to here.
(WebCore::AtomicString::init): Moved from AtomicString.cpp to here.

WebCore: Patch by Gavin Barraclough.

Reviewed by Steve Falkenburg.

REGRESSION (r57900-57919): 3% PLT Regression from moving strings into WTF.
https://bugs.webkit.org/show_bug.cgi?id=38930
<rdar://problem/7937188>

Add the WTF strings into the WebCore vcproj, from their copied location in $(WebKitOutputDir).

No new tests because no change in behavior.

  • WebCore.vcproj/WebCore.vcproj:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/wtf/text/AtomicString.cpp

    r58851 r59171  
    2121#include "config.h"
    2222
    23 #ifdef SKIP_STATIC_CONSTRUCTORS_ON_GCC
    24 #define ATOMICSTRING_HIDE_GLOBALS 1
    25 #endif
    26 
    2723#include "AtomicString.h"
    2824
    29 #include "StaticConstructors.h"
    3025#include "StringHash.h"
    3126#include <wtf/HashSet.h>
     
    300295}
    301296
    302 JS_EXPORTDATA DEFINE_GLOBAL(AtomicString, nullAtom)
    303 JS_EXPORTDATA DEFINE_GLOBAL(AtomicString, emptyAtom, "")
    304 JS_EXPORTDATA DEFINE_GLOBAL(AtomicString, textAtom, "#text")
    305 JS_EXPORTDATA DEFINE_GLOBAL(AtomicString, commentAtom, "#comment")
    306 JS_EXPORTDATA DEFINE_GLOBAL(AtomicString, starAtom, "*")
    307 JS_EXPORTDATA DEFINE_GLOBAL(AtomicString, xmlAtom, "xml")
    308 JS_EXPORTDATA DEFINE_GLOBAL(AtomicString, xmlnsAtom, "xmlns")
    309 
    310 void AtomicString::init()
    311 {
    312     static bool initialized;
    313     if (!initialized) {
    314         // Initialization is not thread safe, so this function must be called from the main thread first.
    315         ASSERT(isMainThread());
    316 
    317         // Use placement new to initialize the globals.
    318         new ((void*)&nullAtom) AtomicString;
    319         new ((void*)&emptyAtom) AtomicString("");
    320         new ((void*)&textAtom) AtomicString("#text");
    321         new ((void*)&commentAtom) AtomicString("#comment");
    322         new ((void*)&starAtom) AtomicString("*");
    323         new ((void*)&xmlAtom) AtomicString("xml");
    324         new ((void*)&xmlnsAtom) AtomicString("xmlns");
    325 
    326         initialized = true;
    327     }
    328 }
    329 
    330 }
     297}
Note: See TracChangeset for help on using the changeset viewer.