Ignore:
Timestamp:
Apr 22, 2010, 5:11:37 PM (15 years ago)
Author:
[email protected]
Message:

https://bugs.webkit.org/show_bug.cgi?id=38006
Change lifetime of JSC::IdentifierTables used by WebCores to match AtomicStringTable

Reviewed by Geoff Garen.

Presently JSC's IdentifierTables are owned by the JSGlobalData. For
JSGlobalData objects created via the API this should continue to be the case,
but for the JSGlobalData objects used by WebCore (the main thread's common
global data, and those for workers) use a IdentifierTable provided (and owned)
by wtfThreadData. This allow the lifetime of these IdentifierTable to match
those of the corresponding AtomicStringTables.

  • API/APIShims.h:

(JSC::APIEntryShim::APIEntryShim):

  • API/JSContextRef.cpp:

(JSContextGroupCreate):

  • runtime/Collector.cpp:

(JSC::Heap::protect):
(JSC::Heap::unprotect):
(JSC::Heap::markRoots):

  • runtime/JSGlobalData.cpp:

(JSC::JSGlobalData::JSGlobalData):
(JSC::JSGlobalData::~JSGlobalData):
(JSC::JSGlobalData::createContextGroup):
(JSC::JSGlobalData::create):
(JSC::JSGlobalData::sharedInstance):

  • runtime/JSGlobalData.h:

(JSC::JSGlobalData::):
(JSC::JSGlobalData::isSharedInstance):

  • runtime/JSLock.cpp:

(JSC::JSLock::JSLock):
(JSC::JSLock::lock):
(JSC::JSLock::unlock):
(JSC::JSLock::DropAllLocks::DropAllLocks):

  • wtf/WTFThreadData.cpp:

(WTF::WTFThreadData::WTFThreadData):
(WTF::WTFThreadData::~WTFThreadData):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/runtime/JSGlobalData.cpp

    r58114 r58133  
    104104}
    105105
    106 JSGlobalData::JSGlobalData(bool isShared, ThreadStackType threadStackType)
    107     : isSharedInstance(isShared)
     106JSGlobalData::JSGlobalData(GlobalDataType globalDataType, ThreadStackType threadStackType)
     107    : globalDataType(globalDataType)
    108108    , clientData(0)
    109109    , arrayTable(fastNew<HashTable>(JSC::arrayTable))
     
    129129    , numberStructure(JSNumberCell::createStructure(jsNull()))
    130130#endif
    131     , identifierTable(createIdentifierTable())
     131    , identifierTable(globalDataType == Default ? wtfThreadData().currentIdentifierTable() : createIdentifierTable())
    132132    , literalTable(createLiteralTable())
    133133    , propertyNames(new CommonIdentifiers(this))
     
    194194
    195195    delete propertyNames;
    196     deleteIdentifierTable(identifierTable);
     196    if (globalDataType != Default)
     197        deleteIdentifierTable(identifierTable);
    197198    deleteLiteralTable(literalTable);
    198199
     
    200201}
    201202
    202 PassRefPtr<JSGlobalData> JSGlobalData::createNonDefault(ThreadStackType type)
    203 {
    204     return adoptRef(new JSGlobalData(false, type));
     203PassRefPtr<JSGlobalData> JSGlobalData::createContextGroup(ThreadStackType type)
     204{
     205    return adoptRef(new JSGlobalData(APIContextGroup, type));
    205206}
    206207
    207208PassRefPtr<JSGlobalData> JSGlobalData::create(ThreadStackType type)
    208209{
    209     JSGlobalData* globalData = new JSGlobalData(false, type);
    210     wtfThreadData().initializeIdentifierTable(globalData->identifierTable);
    211     return adoptRef(globalData);
     210    return adoptRef(new JSGlobalData(Default, type));
    212211}
    213212
     
    229228    JSGlobalData*& instance = sharedInstanceInternal();
    230229    if (!instance) {
    231         instance = new JSGlobalData(true, ThreadStackTypeSmall);
     230        instance = new JSGlobalData(APIShared, ThreadStackTypeSmall);
    232231#if ENABLE(JSC_MULTIPLE_THREADS)
    233232        instance->makeUsableFromMultipleThreads();
Note: See TracChangeset for help on using the changeset viewer.