Changeset 58133 in webkit for trunk/JavaScriptCore/runtime
- Timestamp:
- Apr 22, 2010, 5:11:37 PM (15 years ago)
- Location:
- trunk/JavaScriptCore/runtime
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/runtime/Collector.cpp
r58012 r58133 973 973 { 974 974 ASSERT(k); 975 ASSERT(JSLock::currentThreadIsHoldingLock() || !m_globalData->isSharedInstance);975 // ASSERT(JSLock::currentThreadIsHoldingLock() || !m_globalData->isSharedInstance()); 976 976 977 977 if (!k.isCell()) … … 984 984 { 985 985 ASSERT(k); 986 ASSERT(JSLock::currentThreadIsHoldingLock() || !m_globalData->isSharedInstance);986 // ASSERT(JSLock::currentThreadIsHoldingLock() || !m_globalData->isSharedInstance()); 987 987 988 988 if (!k.isCell()) … … 1065 1065 { 1066 1066 #ifndef NDEBUG 1067 if (m_globalData->isSharedInstance ) {1067 if (m_globalData->isSharedInstance()) { 1068 1068 ASSERT(JSLock::lockCount() > 0); 1069 1069 ASSERT(JSLock::currentThreadIsHoldingLock()); -
trunk/JavaScriptCore/runtime/JSGlobalData.cpp
r58114 r58133 104 104 } 105 105 106 JSGlobalData::JSGlobalData( bool isShared, ThreadStackType threadStackType)107 : isSharedInstance(isShared)106 JSGlobalData::JSGlobalData(GlobalDataType globalDataType, ThreadStackType threadStackType) 107 : globalDataType(globalDataType) 108 108 , clientData(0) 109 109 , arrayTable(fastNew<HashTable>(JSC::arrayTable)) … … 129 129 , numberStructure(JSNumberCell::createStructure(jsNull())) 130 130 #endif 131 , identifierTable( createIdentifierTable())131 , identifierTable(globalDataType == Default ? wtfThreadData().currentIdentifierTable() : createIdentifierTable()) 132 132 , literalTable(createLiteralTable()) 133 133 , propertyNames(new CommonIdentifiers(this)) … … 194 194 195 195 delete propertyNames; 196 deleteIdentifierTable(identifierTable); 196 if (globalDataType != Default) 197 deleteIdentifierTable(identifierTable); 197 198 deleteLiteralTable(literalTable); 198 199 … … 200 201 } 201 202 202 PassRefPtr<JSGlobalData> JSGlobalData::create NonDefault(ThreadStackType type)203 { 204 return adoptRef(new JSGlobalData( false, type));203 PassRefPtr<JSGlobalData> JSGlobalData::createContextGroup(ThreadStackType type) 204 { 205 return adoptRef(new JSGlobalData(APIContextGroup, type)); 205 206 } 206 207 207 208 PassRefPtr<JSGlobalData> JSGlobalData::create(ThreadStackType type) 208 209 { 209 JSGlobalData* globalData = new JSGlobalData(false, type); 210 wtfThreadData().initializeIdentifierTable(globalData->identifierTable); 211 return adoptRef(globalData); 210 return adoptRef(new JSGlobalData(Default, type)); 212 211 } 213 212 … … 229 228 JSGlobalData*& instance = sharedInstanceInternal(); 230 229 if (!instance) { 231 instance = new JSGlobalData( true, ThreadStackTypeSmall);230 instance = new JSGlobalData(APIShared, ThreadStackTypeSmall); 232 231 #if ENABLE(JSC_MULTIPLE_THREADS) 233 232 instance->makeUsableFromMultipleThreads(); -
trunk/JavaScriptCore/runtime/JSGlobalData.h
r58114 r58133 93 93 class JSGlobalData : public RefCounted<JSGlobalData> { 94 94 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 95 105 struct ClientData { 96 106 virtual ~ClientData() = 0; 97 107 }; 98 108 109 bool isSharedInstance() { return globalDataType == APIShared; } 99 110 static bool sharedInstanceExists(); 100 111 static JSGlobalData& sharedInstance(); … … 102 113 static PassRefPtr<JSGlobalData> create(ThreadStackType); 103 114 static PassRefPtr<JSGlobalData> createLeaked(ThreadStackType); 104 static PassRefPtr<JSGlobalData> create NonDefault(ThreadStackType);115 static PassRefPtr<JSGlobalData> createContextGroup(ThreadStackType); 105 116 ~JSGlobalData(); 106 117 … … 110 121 #endif 111 122 112 bool isSharedInstance;123 GlobalDataType globalDataType; 113 124 ClientData* clientData; 114 125 … … 206 217 void dumpSampleData(ExecState* exec); 207 218 private: 208 JSGlobalData( bool isShared, ThreadStackType);219 JSGlobalData(GlobalDataType, ThreadStackType); 209 220 static JSGlobalData*& sharedInstanceInternal(); 210 221 void createNativeThunk(); -
trunk/JavaScriptCore/runtime/JSLock.cpp
r46436 r58133 61 61 62 62 JSLock::JSLock(ExecState* exec) 63 : m_lockBehavior(exec->globalData().isSharedInstance ? LockForReal : SilenceAssertionsOnly)63 : m_lockBehavior(exec->globalData().isSharedInstance() ? LockForReal : SilenceAssertionsOnly) 64 64 { 65 65 lock(m_lockBehavior); … … 106 106 void JSLock::lock(ExecState* exec) 107 107 { 108 lock(exec->globalData().isSharedInstance ? LockForReal : SilenceAssertionsOnly);108 lock(exec->globalData().isSharedInstance() ? LockForReal : SilenceAssertionsOnly); 109 109 } 110 110 111 111 void JSLock::unlock(ExecState* exec) 112 112 { 113 unlock(exec->globalData().isSharedInstance ? LockForReal : SilenceAssertionsOnly);113 unlock(exec->globalData().isSharedInstance() ? LockForReal : SilenceAssertionsOnly); 114 114 } 115 115 … … 163 163 164 164 JSLock::DropAllLocks::DropAllLocks(ExecState* exec) 165 : m_lockBehavior(exec->globalData().isSharedInstance ? LockForReal : SilenceAssertionsOnly)165 : m_lockBehavior(exec->globalData().isSharedInstance() ? LockForReal : SilenceAssertionsOnly) 166 166 { 167 167 pthread_once(&createJSLockCountOnce, createJSLockCount);
Note:
See TracChangeset
for help on using the changeset viewer.