Changeset 93920 in webkit
- Timestamp:
- Aug 26, 2011 3:32:53 PM (13 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r93918 r93920 1 2011-08-26 Mark Hahnenberg <mhahnenberg@apple.com> 2 3 Unzip initialization lists and constructors in JSCell hierarchy (2/7) 4 https://bugs.webkit.org/show_bug.cgi?id=66957 5 6 Reviewed by Darin Adler. 7 8 Completed the second level of the refactoring to add finishCreation() 9 methods to all classes within the JSCell hierarchy with non-trivial 10 constructor bodies. 11 12 * runtime/Executable.h: 13 (JSC::ExecutableBase::ExecutableBase): 14 (JSC::ExecutableBase::create): 15 (JSC::NativeExecutable::create): 16 (JSC::NativeExecutable::finishCreation): 17 (JSC::NativeExecutable::NativeExecutable): 18 (JSC::ScriptExecutable::ScriptExecutable): 19 (JSC::ScriptExecutable::finishCreation): 20 * runtime/GetterSetter.h: 21 (JSC::GetterSetter::GetterSetter): 22 (JSC::GetterSetter::create): 23 * runtime/JSAPIValueWrapper.h: 24 (JSC::JSAPIValueWrapper::create): 25 (JSC::JSAPIValueWrapper::JSAPIValueWrapper): 26 * runtime/JSObject.h: 27 (JSC::JSNonFinalObject::JSNonFinalObject): 28 (JSC::JSNonFinalObject::finishCreation): 29 (JSC::JSFinalObject::create): 30 (JSC::JSFinalObject::finishCreation): 31 (JSC::JSFinalObject::JSFinalObject): 32 (JSC::JSObject::JSObject): 33 * runtime/JSPropertyNameIterator.cpp: 34 (JSC::JSPropertyNameIterator::JSPropertyNameIterator): 35 (JSC::JSPropertyNameIterator::create): 36 * runtime/JSPropertyNameIterator.h: 37 (JSC::JSPropertyNameIterator::create): 38 * runtime/RegExp.cpp: 39 (JSC::RegExp::RegExp): 40 (JSC::RegExp::createWithoutCaching): 41 * runtime/ScopeChain.h: 42 (JSC::ScopeChainNode::ScopeChainNode): 43 (JSC::ScopeChainNode::create): 44 * runtime/Structure.cpp: 45 (JSC::Structure::Structure): 46 * runtime/Structure.h: 47 (JSC::Structure::create): 48 (JSC::Structure::finishCreation): 49 (JSC::Structure::createStructure): 50 * runtime/StructureChain.cpp: 51 (JSC::StructureChain::StructureChain): 52 * runtime/StructureChain.h: 53 (JSC::StructureChain::create): 54 1 55 2011-08-26 Filip Pizlo <fpizlo@apple.com> 2 56 -
trunk/Source/JavaScriptCore/runtime/Executable.h
r93835 r93920 59 59 , m_numParametersForConstruct(numParameters) 60 60 { 61 finishCreation(globalData);62 61 } 63 62 … … 76 75 static ExecutableBase* create(JSGlobalData& globalData, Structure* structure, int numParameters) 77 76 { 78 return new (allocateCell<ExecutableBase>(globalData.heap)) ExecutableBase(globalData, structure, numParameters); 77 ExecutableBase* executable = new (allocateCell<ExecutableBase>(globalData.heap)) ExecutableBase(globalData, structure, numParameters); 78 executable->finishCreation(globalData); 79 return executable; 79 80 } 80 81 … … 181 182 static NativeExecutable* create(JSGlobalData& globalData, MacroAssemblerCodePtr callThunk, NativeFunction function, MacroAssemblerCodePtr constructThunk, NativeFunction constructor) 182 183 { 184 NativeExecutable* executable; 183 185 if (!callThunk) 184 return new (allocateCell<NativeExecutable>(globalData.heap)) NativeExecutable(globalData, JITCode(), function, JITCode(), constructor); 185 return new (allocateCell<NativeExecutable>(globalData.heap)) NativeExecutable(globalData, JITCode::HostFunction(callThunk), function, JITCode::HostFunction(constructThunk), constructor); 186 executable = new (allocateCell<NativeExecutable>(globalData.heap)) NativeExecutable(globalData, JITCode(), function, JITCode(), constructor); 187 else 188 executable = new (allocateCell<NativeExecutable>(globalData.heap)) NativeExecutable(globalData, JITCode::HostFunction(callThunk), function, JITCode::HostFunction(constructThunk), constructor); 189 return executable; 186 190 } 187 191 #else … … 199 203 200 204 static const ClassInfo s_info; 201 205 206 protected: 207 #if ENABLE(JIT) 208 void finishCreation(JSGlobalData& globalData, JITCode callThunk, JITCode constructThunk) 209 { 210 Base::finishCreation(globalData); 211 m_jitCodeForCall = callThunk; 212 m_jitCodeForConstruct = constructThunk; 213 m_jitCodeForCallWithArityCheck = callThunk.addressForCall(); 214 m_jitCodeForConstructWithArityCheck = constructThunk.addressForCall(); 215 } 216 #endif 217 202 218 private: 203 219 #if ENABLE(JIT) … … 207 223 , m_constructor(constructor) 208 224 { 209 m_jitCodeForCall = callThunk; 210 m_jitCodeForConstruct = constructThunk; 211 m_jitCodeForCallWithArityCheck = callThunk.addressForCall(); 212 m_jitCodeForConstructWithArityCheck = constructThunk.addressForCall(); 225 finishCreation(globalData, callThunk, constructThunk); 213 226 } 214 227 #else … … 218 231 , m_constructor(constructor) 219 232 { 233 finishCreation(globalData); 220 234 } 221 235 #endif … … 236 250 , m_features(isInStrictContext ? StrictModeFeature : 0) 237 251 { 238 #if ENABLE(CODEBLOCK_SAMPLING) 239 if (SamplingTool* sampler = globalData.interpreter->sampler()) 240 sampler->notifyOfScope(globalData, this); 241 #else 242 UNUSED_PARAM(globalData); 243 #endif 252 finishCreation(globalData); 244 253 } 245 254 … … 249 258 , m_features(isInStrictContext ? StrictModeFeature : 0) 250 259 { 251 #if ENABLE(CODEBLOCK_SAMPLING) 252 if (SamplingTool* sampler = exec->globalData().interpreter->sampler()) 253 sampler->notifyOfScope(exec->globalData(), this); 254 #else 255 UNUSED_PARAM(exec); 256 #endif 260 finishCreation(exec->globalData()); 257 261 } 258 262 … … 271 275 272 276 static const ClassInfo s_info; 277 273 278 protected: 279 void finishCreation(JSGlobalData& globalData) 280 { 281 Base::finishCreation(globalData); 282 #if ENABLE(CODEBLOCK_SAMPLING) 283 if (SamplingTool* sampler = globalData.interpreter->sampler()) 284 sampler->notifyOfScope(globalData, this); 285 #endif 286 } 287 274 288 void recordParse(CodeFeatures features, bool hasCapturedVariables, int firstLine, int lastLine) 275 289 { -
trunk/Source/JavaScriptCore/runtime/GetterSetter.h
r93835 r93920 42 42 : JSCell(exec->globalData(), exec->globalData().getterSetterStructure.get()) 43 43 { 44 finishCreation(exec->globalData());45 44 } 46 45 … … 50 49 static GetterSetter* create(ExecState* exec) 51 50 { 52 return new (allocateCell<GetterSetter>(*exec->heap())) GetterSetter(exec); 51 GetterSetter* getterSetter = new (allocateCell<GetterSetter>(*exec->heap())) GetterSetter(exec); 52 getterSetter->finishCreation(exec->globalData()); 53 return getterSetter; 53 54 } 54 55 -
trunk/Source/JavaScriptCore/runtime/JSAPIValueWrapper.h
r93835 r93920 49 49 static JSAPIValueWrapper* create(ExecState* exec, JSValue value) 50 50 { 51 return new (allocateCell<JSAPIValueWrapper>(*exec->heap())) JSAPIValueWrapper(exec, value); 51 JSAPIValueWrapper* wrapper = new (allocateCell<JSAPIValueWrapper>(*exec->heap())) JSAPIValueWrapper(exec); 52 wrapper->finishCreation(exec, value); 53 return wrapper; 52 54 } 53 55 … … 61 63 62 64 private: 63 JSAPIValueWrapper(ExecState* exec , JSValue value)65 JSAPIValueWrapper(ExecState* exec) 64 66 : JSCell(exec->globalData(), exec->globalData().apiWrapperStructure.get()) 65 67 { 66 finishCreation(exec, value);67 68 } 68 69 -
trunk/Source/JavaScriptCore/runtime/JSObject.h
r93841 r93920 362 362 : JSObject(globalData, structure, m_inlineStorage) 363 363 { 364 finishCreation(globalData); 365 } 366 367 void finishCreation(JSGlobalData& globalData) 368 { 369 Base::finishCreation(globalData, m_inlineStorage); 364 370 ASSERT(!(OBJECT_OFFSETOF(JSNonFinalObject, m_inlineStorage) % sizeof(double))); 365 371 ASSERT(this->structure()->propertyStorageCapacity() == JSNonFinalObject_inlineStorageCapacity); … … 385 391 static JSFinalObject* create(ExecState* exec, Structure* structure) 386 392 { 387 return new (allocateCell<JSFinalObject>(*exec->heap())) JSFinalObject(exec->globalData(), structure); 393 JSFinalObject* finalObject = new (allocateCell<JSFinalObject>(*exec->heap())) JSFinalObject(exec->globalData(), structure); 394 finalObject->finishCreation(exec->globalData()); 395 return finalObject; 388 396 } 389 397 … … 391 399 { 392 400 return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info); 401 } 402 403 protected: 404 void finishCreation(JSGlobalData& globalData) 405 { 406 Base::finishCreation(globalData, m_inlineStorage); 407 ASSERT(!(OBJECT_OFFSETOF(JSFinalObject, m_inlineStorage) % sizeof(double))); 408 ASSERT(this->structure()->propertyStorageCapacity() == JSFinalObject_inlineStorageCapacity); 393 409 } 394 410 … … 397 413 : JSObject(globalData, structure, m_inlineStorage) 398 414 { 399 ASSERT(OBJECT_OFFSETOF(JSFinalObject, m_inlineStorage) % sizeof(double) == 0);400 ASSERT(this->structure()->propertyStorageCapacity() == JSFinalObject_inlineStorageCapacity);401 415 } 402 416 … … 447 461 , m_propertyStorage(inlineStorage) 448 462 { 449 finishCreation(globalData, inlineStorage);450 463 } 451 464 -
trunk/Source/JavaScriptCore/runtime/JSPropertyNameIterator.cpp
r93835 r93920 44 44 , m_jsStrings(adoptArrayPtr(new WriteBarrier<Unknown>[m_jsStringsSize])) 45 45 { 46 finishCreation(exec, propertyNameArrayData);47 46 } 48 47 … … 62 61 63 62 JSPropertyNameIterator* jsPropertyNameIterator = new (allocateCell<JSPropertyNameIterator>(*exec->heap())) JSPropertyNameIterator(exec, propertyNames.data(), numCacheableSlots); 63 jsPropertyNameIterator->finishCreation(exec, propertyNames.data()); 64 64 65 65 if (o->structure()->isDictionary()) -
trunk/Source/JavaScriptCore/runtime/JSPropertyNameIterator.h
r93835 r93920 49 49 static JSPropertyNameIterator* create(ExecState* exec, PropertyNameArrayData* propertyNameArrayData, size_t numCacheableSlot) 50 50 { 51 return new (allocateCell<JSPropertyNameIterator>(*exec->heap())) JSPropertyNameIterator(exec, propertyNameArrayData, numCacheableSlot); 51 JSPropertyNameIterator* iterator = new (allocateCell<JSPropertyNameIterator>(*exec->heap())) JSPropertyNameIterator(exec, propertyNameArrayData, numCacheableSlot); 52 iterator->finishCreation(exec, propertyNameArrayData); 53 return iterator; 52 54 } 53 55 -
trunk/Source/JavaScriptCore/runtime/RegExp.cpp
r93835 r93920 89 89 #endif 90 90 { 91 finishCreation(globalData);92 91 } 93 92 … … 108 107 RegExp* RegExp::createWithoutCaching(JSGlobalData& globalData, const UString& patternString, RegExpFlags flags) 109 108 { 110 return new (allocateCell<RegExp>(globalData.heap)) RegExp(globalData, patternString, flags); 109 RegExp* regExp = new (allocateCell<RegExp>(globalData.heap)) RegExp(globalData, patternString, flags); 110 regExp->finishCreation(globalData); 111 return regExp; 111 112 } 112 113 -
trunk/Source/JavaScriptCore/runtime/ScopeChain.h
r93841 r93920 44 44 , globalThis(*globalData, this, globalThis) 45 45 { 46 finishCreation(globalData, globalObject);47 46 } 48 47 … … 59 58 static ScopeChainNode* create(ExecState* exec, ScopeChainNode* next, JSObject* object, JSGlobalData* globalData, JSGlobalObject* globalObject, JSObject* globalThis) 60 59 { 61 return new (allocateCell<ScopeChainNode>(*exec->heap())) ScopeChainNode(next, object, globalData, globalObject, globalThis); 60 ScopeChainNode* node = new (allocateCell<ScopeChainNode>(*exec->heap())) ScopeChainNode(next, object, globalData, globalObject, globalThis); 61 node->finishCreation(globalData, globalObject); 62 return node; 62 63 } 63 64 static ScopeChainNode* create(ScopeChainNode* next, JSObject* object, JSGlobalData* globalData, JSGlobalObject* globalObject, JSObject* globalThis) 64 65 { 65 return new (allocateCell<ScopeChainNode>(globalData->heap)) ScopeChainNode(next, object, globalData, globalObject, globalThis); 66 ScopeChainNode* node = new (allocateCell<ScopeChainNode>(globalData->heap)) ScopeChainNode(next, object, globalData, globalObject, globalThis); 67 node->finishCreation(globalData, globalObject); 68 return node; 66 69 } 67 70 -
trunk/Source/JavaScriptCore/runtime/Structure.cpp
r93835 r93920 177 177 , m_didTransition(false) 178 178 { 179 finishCreation(globalData);180 ASSERT(m_prototype);181 ASSERT(m_prototype.isObject() || m_prototype.isNull());182 179 } 183 180 … … 201 198 , m_didTransition(false) 202 199 { 203 finishCreation(globalData, this, CreatingEarlyCell);204 ASSERT(m_prototype);205 ASSERT(m_prototype.isNull());206 ASSERT(!globalData.structureStructure);207 200 } 208 201 … … 224 217 , m_didTransition(true) 225 218 { 226 finishCreation(globalData);227 ASSERT(m_prototype);228 ASSERT(m_prototype.isObject() || m_prototype.isNull());229 219 } 230 220 -
trunk/Source/JavaScriptCore/runtime/Structure.h
r92706 r93920 67 67 ASSERT(globalData.structureStructure); 68 68 ASSERT(classInfo); 69 return new (allocateCell<Structure>(globalData.heap)) Structure(globalData, prototype, typeInfo, anonymousSlotCount, classInfo); 70 } 71 69 Structure* structure = new (allocateCell<Structure>(globalData.heap)) Structure(globalData, prototype, typeInfo, anonymousSlotCount, classInfo); 70 structure->finishCreation(globalData); 71 return structure; 72 } 73 74 protected: 75 void finishCreation(JSGlobalData& globalData) 76 { 77 Base::finishCreation(globalData); 78 ASSERT(m_prototype); 79 ASSERT(m_prototype.isObject() || m_prototype.isNull()); 80 } 81 82 void finishCreation(JSGlobalData& globalData, CreatingEarlyCellTag) 83 { 84 Base::finishCreation(globalData, this, CreatingEarlyCell); 85 ASSERT(m_prototype); 86 ASSERT(m_prototype.isNull()); 87 ASSERT(!globalData.structureStructure); 88 } 89 90 public: 72 91 static void dumpStatistics(); 73 92 … … 162 181 { 163 182 ASSERT(!globalData.structureStructure); 164 return new (allocateCell<Structure>(globalData.heap)) Structure(globalData); 183 Structure* structure = new (allocateCell<Structure>(globalData.heap)) Structure(globalData); 184 structure->finishCreation(globalData, CreatingEarlyCell); 185 return structure; 165 186 } 166 187 … … 175 196 { 176 197 ASSERT(globalData.structureStructure); 177 return new (allocateCell<Structure>(globalData.heap)) Structure(globalData, structure); 198 Structure* newStructure = new (allocateCell<Structure>(globalData.heap)) Structure(globalData, structure); 199 newStructure->finishCreation(globalData); 200 return newStructure; 178 201 } 179 202 -
trunk/Source/JavaScriptCore/runtime/StructureChain.cpp
r93835 r93920 35 35 ClassInfo StructureChain::s_info = { "StructureChain", 0, 0, 0 }; 36 36 37 StructureChain::StructureChain(JSGlobalData& globalData, Structure* structure , Structure* head)37 StructureChain::StructureChain(JSGlobalData& globalData, Structure* structure) 38 38 : JSCell(globalData, structure) 39 39 { 40 finishCreation(globalData, head);41 40 } 42 41 -
trunk/Source/JavaScriptCore/runtime/StructureChain.h
r93835 r93920 48 48 static StructureChain* create(JSGlobalData& globalData, Structure* head) 49 49 { 50 return new (allocateCell<StructureChain>(globalData.heap)) StructureChain(globalData, globalData.structureChainStructure.get(), head); 50 StructureChain* chain = new (allocateCell<StructureChain>(globalData.heap)) StructureChain(globalData, globalData.structureChainStructure.get()); 51 chain->finishCreation(globalData, head); 52 return chain; 51 53 } 52 54 WriteBarrier<Structure>* head() { return m_vector.get(); } … … 73 75 74 76 private: 75 StructureChain(JSGlobalData&, Structure* , Structure* head);77 StructureChain(JSGlobalData&, Structure*); 76 78 ~StructureChain(); 77 79 OwnArrayPtr<WriteBarrier<Structure> > m_vector;
Note: See TracChangeset
for help on using the changeset viewer.