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.h

    r58114 r58133  
    9393    class JSGlobalData : public RefCounted<JSGlobalData> {
    9494    public:
     95        // WebCore has a one-to-one mapping of threads to JSGlobalDatas;
     96        // either create() or createLeaked() should only be called once
     97        // on a thread, this is the 'default' JSGlobalData (it uses the
     98        // thread's default string uniquing table from wtfThreadData).
     99        // API contexts created using the new context group aware interface
     100        // create APIContextGroup objects which require less locking of JSC
     101        // than the old singleton APIShared JSGlobalData created for use by
     102        // the original API.
     103        enum GlobalDataType { Default, APIContextGroup, APIShared };
     104
    95105        struct ClientData {
    96106            virtual ~ClientData() = 0;
    97107        };
    98108
     109        bool isSharedInstance() { return globalDataType == APIShared; }
    99110        static bool sharedInstanceExists();
    100111        static JSGlobalData& sharedInstance();
     
    102113        static PassRefPtr<JSGlobalData> create(ThreadStackType);
    103114        static PassRefPtr<JSGlobalData> createLeaked(ThreadStackType);
    104         static PassRefPtr<JSGlobalData> createNonDefault(ThreadStackType);
     115        static PassRefPtr<JSGlobalData> createContextGroup(ThreadStackType);
    105116        ~JSGlobalData();
    106117
     
    110121#endif
    111122
    112         bool isSharedInstance;
     123        GlobalDataType globalDataType;
    113124        ClientData* clientData;
    114125
     
    206217        void dumpSampleData(ExecState* exec);
    207218    private:
    208         JSGlobalData(bool isShared, ThreadStackType);
     219        JSGlobalData(GlobalDataType, ThreadStackType);
    209220        static JSGlobalData*& sharedInstanceInternal();
    210221        void createNativeThunk();
Note: See TracChangeset for help on using the changeset viewer.