Changeset 48774 in webkit for trunk/JavaScriptCore
- Timestamp:
- Sep 25, 2009, 3:26:44 PM (16 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r48756 r48774 1 2009-09-25 Geoffrey Garen <[email protected]> 2 3 Reviewed by Darin Adler. 4 5 Inlined some object creation code, including lexicalGlobalObject access 6 https://bugs.webkit.org/show_bug.cgi?id=29750 7 8 SunSpider says 0.5% faster. 9 10 0.8% speedup on bench-alloc-nonretained.js. 11 2.5% speedup on v8-splay.js. 12 13 * interpreter/CachedCall.h: 14 (JSC::CachedCall::CachedCall): 15 * interpreter/CallFrame.h: 16 (JSC::ExecState::lexicalGlobalObject): 17 (JSC::ExecState::globalThisValue): 18 * interpreter/Interpreter.cpp: 19 (JSC::Interpreter::dumpRegisters): 20 (JSC::Interpreter::execute): 21 (JSC::Interpreter::privateExecute): 22 * jit/JITStubs.cpp: 23 (JSC::DEFINE_STUB_FUNCTION): 24 * runtime/FunctionConstructor.cpp: 25 (JSC::constructFunction): 26 * runtime/ScopeChain.cpp: 27 (JSC::ScopeChainNode::print): 28 * runtime/ScopeChain.h: 29 (JSC::ScopeChainNode::ScopeChainNode): 30 (JSC::ScopeChainNode::~ScopeChainNode): 31 (JSC::ScopeChainNode::push): 32 (JSC::ScopeChain::ScopeChain): 33 (JSC::ScopeChain::globalObject): Added a globalObject data member to ScopeChainNode. 34 Replaced accessor function for globalObject() with data member. Replaced 35 globalThisObject() accessor with direct access to globalThis, to match. 36 37 * runtime/JSGlobalObject.cpp: 38 (JSC::JSGlobalObject::init): 39 * runtime/JSGlobalObject.h: Inlined array and object construction. 40 1 41 2009-09-25 Laszlo Gombos <[email protected]> 2 42 -
trunk/JavaScriptCore/JavaScriptCore.exp
r48542 r48774 140 140 __ZN3JSC14SamplingThread5startEj 141 141 __ZN3JSC14TimeoutChecker5resetEv 142 __ZN3JSC14constructArrayEPNS_9ExecStateERKNS_7ArgListE143 142 __ZN3JSC15JSWrapperObject12markChildrenERNS_9MarkStackE 144 143 __ZN3JSC15toInt32SlowCaseEdRb … … 165 164 __ZN3JSC18PropertyDescriptor9setGetterENS_7JSValueE 166 165 __ZN3JSC18PropertyDescriptor9setSetterENS_7JSValueE 167 __ZN3JSC19constructEmptyArrayEPNS_9ExecStateE168 166 __ZN3JSC19initializeThreadingEv 169 167 __ZN3JSC20MarkedArgumentBuffer10slowAppendENS_7JSValueE 170 __ZN3JSC20constructEmptyObjectEPNS_9ExecStateE171 168 __ZN3JSC23AbstractSamplingCounter4dumpEv 172 169 __ZN3JSC23objectProtoFuncToStringEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE … … 214 211 __ZN3JSC7CStringaSERKS0_ 215 212 __ZN3JSC7JSArray4infoE 213 __ZN3JSC7JSArrayC1EN3WTF10PassRefPtrINS_9StructureEEE 214 __ZN3JSC7JSArrayC1EN3WTF10PassRefPtrINS_9StructureEEERKNS_7ArgListE 216 215 __ZN3JSC7Profile10restoreAllEv 217 216 __ZN3JSC7Profile5focusEPKNS_11ProfileNodeE … … 302 301 __ZN3WTF12randomNumberEv 303 302 __ZN3WTF13currentThreadEv 304 __ZN3WTF13tryFastMallocEm305 303 __ZN3WTF13tryFastCallocEmm 306 304 __ZN3WTF13tryFastMallocEm … … 356 354 __ZNK3JSC18PropertyDescriptor16isDataDescriptorEv 357 355 __ZNK3JSC18PropertyDescriptor20isAccessorDescriptorEv 356 __ZNK3JSC18PropertyDescriptor6getterEv 358 357 __ZNK3JSC18PropertyDescriptor6setterEv 359 __ZNK3JSC18PropertyDescriptor6getterEv360 358 __ZNK3JSC18PropertyDescriptor8writableEv 361 359 __ZNK3JSC4Heap10statisticsEv -
trunk/JavaScriptCore/interpreter/CachedCall.h
r47641 r48774 39 39 , m_interpreter(callFrame->interpreter()) 40 40 , m_exception(exception) 41 , m_globalObjectScope(callFrame, callFrame->globalData().dynamicGlobalObject ? callFrame->globalData().dynamicGlobalObject : function->scope(). node()->globalObject())41 , m_globalObjectScope(callFrame, callFrame->globalData().dynamicGlobalObject ? callFrame->globalData().dynamicGlobalObject : function->scope().globalObject()) 42 42 { 43 43 ASSERT(!function->isHostFunction()); -
trunk/JavaScriptCore/interpreter/CallFrame.h
r46598 r48774 52 52 JSGlobalObject* lexicalGlobalObject() const 53 53 { 54 return scopeChain()->globalObject ();54 return scopeChain()->globalObject; 55 55 } 56 56 … … 59 59 JSObject* globalThisValue() const 60 60 { 61 return scopeChain()->globalThis Object();61 return scopeChain()->globalThis; 62 62 } 63 63 -
trunk/JavaScriptCore/interpreter/Interpreter.cpp
r48590 r48774 386 386 387 387 CodeBlock* codeBlock = callFrame->codeBlock(); 388 RegisterFile* registerFile = &callFrame->scopeChain()->globalObject ()->globalData()->interpreter->registerFile();388 RegisterFile* registerFile = &callFrame->scopeChain()->globalObject->globalData()->interpreter->registerFile(); 389 389 const Register* it; 390 390 const Register* end; … … 630 630 } 631 631 632 DynamicGlobalObjectScope globalObjectScope(callFrame, scopeChain->globalObject ());632 DynamicGlobalObjectScope globalObjectScope(callFrame, scopeChain->globalObject); 633 633 634 634 JSGlobalObject* lastGlobalObject = m_registerFile.globalObject(); … … 690 690 } 691 691 692 DynamicGlobalObjectScope globalObjectScope(callFrame, callFrame->globalData().dynamicGlobalObject ? callFrame->globalData().dynamicGlobalObject : scopeChain->globalObject ());692 DynamicGlobalObjectScope globalObjectScope(callFrame, callFrame->globalData().dynamicGlobalObject ? callFrame->globalData().dynamicGlobalObject : scopeChain->globalObject); 693 693 694 694 CallFrame* newCallFrame = CallFrame::create(oldEnd); … … 820 820 } 821 821 822 DynamicGlobalObjectScope globalObjectScope(callFrame, callFrame->globalData().dynamicGlobalObject ? callFrame->globalData().dynamicGlobalObject : scopeChain->globalObject ());822 DynamicGlobalObjectScope globalObjectScope(callFrame, callFrame->globalData().dynamicGlobalObject ? callFrame->globalData().dynamicGlobalObject : scopeChain->globalObject); 823 823 824 824 EvalCodeBlock* codeBlock = &eval->bytecode(callFrame, scopeChain); … … 1243 1243 int dst = (++vPC)->u.operand; 1244 1244 int regExp = (++vPC)->u.operand; 1245 callFrame->r(dst) = JSValue(new (globalData) RegExpObject(callFrame->scopeChain()->globalObject ()->regExpStructure(), callFrame->codeBlock()->regexp(regExp)));1245 callFrame->r(dst) = JSValue(new (globalData) RegExpObject(callFrame->scopeChain()->globalObject->regExpStructure(), callFrame->codeBlock()->regexp(regExp))); 1246 1246 1247 1247 ++vPC; … … 2982 2982 Register* argv = newCallFrame - RegisterFile::CallFrameHeaderSize - argCount; 2983 2983 JSValue thisValue = argv[0].jsValue(); 2984 JSGlobalObject* globalObject = callFrame->scopeChain()->globalObject ();2984 JSGlobalObject* globalObject = callFrame->scopeChain()->globalObject; 2985 2985 2986 2986 if (thisValue == globalObject && funcVal == globalObject->evalFunction()) { … … 3430 3430 structure = asObject(prototype)->inheritorID(); 3431 3431 else 3432 structure = callDataScopeChain->globalObject ()->emptyObjectStructure();3432 structure = callDataScopeChain->globalObject->emptyObjectStructure(); 3433 3433 JSObject* newObject = new (globalData) JSObject(structure); 3434 3434 -
trunk/JavaScriptCore/jit/JITStubs.cpp
r48590 r48774 1183 1183 // purpose. The object is in no way exposed, and as such the check will always pass. 1184 1184 if (slot.slotBase() == baseValue) { 1185 JIT::patchMethodCallProto(codeBlock, methodCallLinkInfo, callee, structure, callFrame->scopeChain()->globalObject ()->methodCallDummy(), STUB_RETURN_ADDRESS);1185 JIT::patchMethodCallProto(codeBlock, methodCallLinkInfo, callee, structure, callFrame->scopeChain()->globalObject->methodCallDummy(), STUB_RETURN_ADDRESS); 1186 1186 return JSValue::encode(result); 1187 1187 } … … 1739 1739 structure = asObject(stackFrame.args[3].jsValue())->inheritorID(); 1740 1740 else 1741 structure = constructor->scope().node()->globalObject ()->emptyObjectStructure();1741 structure = constructor->scope().node()->globalObject->emptyObjectStructure(); 1742 1742 return new (stackFrame.globalData) JSObject(structure); 1743 1743 } … … 2642 2642 Register* argv = newCallFrame - RegisterFile::CallFrameHeaderSize - argCount; 2643 2643 JSValue thisValue = argv[0].jsValue(); 2644 JSGlobalObject* globalObject = callFrame->scopeChain()->globalObject ();2644 JSGlobalObject* globalObject = callFrame->scopeChain()->globalObject; 2645 2645 2646 2646 if (thisValue == globalObject && funcVal == globalObject->evalFunction()) { -
trunk/JavaScriptCore/runtime/FunctionConstructor.cpp
r47738 r48774 93 93 94 94 JSGlobalObject* globalObject = exec->lexicalGlobalObject(); 95 ScopeChain scopeChain(globalObject, globalObject->globalData(), exec->globalThisValue());95 ScopeChain scopeChain(globalObject, globalObject->globalData(), globalObject, exec->globalThisValue()); 96 96 return new (exec) JSFunction(exec, function, scopeChain.node()); 97 97 } -
trunk/JavaScriptCore/runtime/JSArray.cpp
r48542 r48774 1067 1067 #endif 1068 1068 1069 JSArray* constructEmptyArray(ExecState* exec)1070 {1071 return new (exec) JSArray(exec->lexicalGlobalObject()->arrayStructure());1072 }1073 1074 JSArray* constructEmptyArray(ExecState* exec, unsigned initialLength)1075 {1076 return new (exec) JSArray(exec->lexicalGlobalObject()->arrayStructure(), initialLength);1077 }1078 1079 JSArray* constructArray(ExecState* exec, JSValue singleItemValue)1080 {1081 MarkedArgumentBuffer values;1082 values.append(singleItemValue);1083 return new (exec) JSArray(exec->lexicalGlobalObject()->arrayStructure(), values);1084 }1085 1086 JSArray* constructArray(ExecState* exec, const ArgList& values)1087 {1088 return new (exec) JSArray(exec->lexicalGlobalObject()->arrayStructure(), values);1089 }1090 1091 1069 } // namespace JSC -
trunk/JavaScriptCore/runtime/JSArray.h
r48336 r48774 116 116 117 117 JSArray* asArray(JSValue); 118 119 JSArray* constructEmptyArray(ExecState*);120 JSArray* constructEmptyArray(ExecState*, unsigned initialLength);121 JSArray* constructArray(ExecState*, JSValue singleItemValue);122 JSArray* constructArray(ExecState*, const ArgList& values);123 118 124 119 inline JSArray* asArray(JSCell* cell) -
trunk/JavaScriptCore/runtime/JSGlobalObject.cpp
r48542 r48774 130 130 131 131 d()->globalData = Heap::heap(this)->globalData(); 132 d()->globalScopeChain = ScopeChain(this, d()->globalData.get(), this Value);132 d()->globalScopeChain = ScopeChain(this, d()->globalData.get(), this, thisValue); 133 133 134 134 JSGlobalObject::globalExec()->init(0, 0, d()->globalScopeChain.node(), CallFrame::noCaller(), 0, 0, 0); -
trunk/JavaScriptCore/runtime/JSGlobalObject.h
r48542 r48774 23 23 #define JSGlobalObject_h 24 24 25 #include "JSArray.h" 25 26 #include "JSGlobalData.h" 26 27 #include "JSVariableObject.h" … … 344 345 } 345 346 346 inline JSGlobalObject* ScopeChainNode::globalObject() const347 {348 const ScopeChainNode* n = this;349 while (n->next)350 n = n->next;351 return asGlobalObject(n->object);352 }353 354 347 inline JSValue Structure::prototypeForLookup(ExecState* exec) const 355 348 { … … 406 399 } 407 400 401 inline JSObject* constructEmptyObject(ExecState* exec) 402 { 403 return new (exec) JSObject(exec->lexicalGlobalObject()->emptyObjectStructure()); 404 } 405 406 inline JSArray* constructEmptyArray(ExecState* exec) 407 { 408 return new (exec) JSArray(exec->lexicalGlobalObject()->arrayStructure()); 409 } 410 411 inline JSArray* constructEmptyArray(ExecState* exec, unsigned initialLength) 412 { 413 return new (exec) JSArray(exec->lexicalGlobalObject()->arrayStructure(), initialLength); 414 } 415 416 inline JSArray* constructArray(ExecState* exec, JSValue singleItemValue) 417 { 418 MarkedArgumentBuffer values; 419 values.append(singleItemValue); 420 return new (exec) JSArray(exec->lexicalGlobalObject()->arrayStructure(), values); 421 } 422 423 inline JSArray* constructArray(ExecState* exec, const ArgList& values) 424 { 425 return new (exec) JSArray(exec->lexicalGlobalObject()->arrayStructure(), values); 426 } 427 408 428 class DynamicGlobalObjectScope : public Noncopyable { 409 429 public: -
trunk/JavaScriptCore/runtime/JSObject.cpp
r48582 r48774 512 512 { 513 513 allocatePropertyStorageInline(oldSize, newSize); 514 }515 516 JSObject* constructEmptyObject(ExecState* exec)517 {518 return new (exec) JSObject(exec->lexicalGlobalObject()->emptyObjectStructure());519 514 } 520 515 -
trunk/JavaScriptCore/runtime/JSObject.h
r48542 r48774 265 265 }; 266 266 267 JSObject* constructEmptyObject(ExecState*);268 269 267 inline JSObject* asObject(JSCell* cell) 270 268 { -
trunk/JavaScriptCore/runtime/ScopeChain.cpp
r47288 r48774 37 37 for (ScopeChainIterator scopeIter = begin(); scopeIter != scopeEnd; ++scopeIter) { 38 38 JSObject* o = *scopeIter; 39 PropertyNameArray propertyNames(globalObject ()->globalExec());40 o->getPropertyNames(globalObject ()->globalExec(), propertyNames);39 PropertyNameArray propertyNames(globalObject->globalExec()); 40 o->getPropertyNames(globalObject->globalExec(), propertyNames); 41 41 PropertyNameArray::const_iterator propEnd = propertyNames.end(); 42 42 -
trunk/JavaScriptCore/runtime/ScopeChain.h
r47025 r48774 34 34 class ScopeChainNode : public FastAllocBase { 35 35 public: 36 ScopeChainNode(ScopeChainNode* next, JSObject* object, JSGlobalData* globalData, JS Object* globalThis)36 ScopeChainNode(ScopeChainNode* next, JSObject* object, JSGlobalData* globalData, JSGlobalObject* globalObject, JSObject* globalThis) 37 37 : next(next) 38 38 , object(object) 39 39 , globalData(globalData) 40 , globalObject(globalObject) 40 41 , globalThis(globalThis) 41 42 , refCount(1) 42 43 { 43 44 ASSERT(globalData); 45 ASSERT(globalObject); 44 46 } 45 47 #ifndef NDEBUG … … 52 54 object = 0; 53 55 globalData = 0; 56 globalObject = 0; 54 57 globalThis = 0; 55 58 } … … 59 62 JSObject* object; 60 63 JSGlobalData* globalData; 64 JSGlobalObject* globalObject; 61 65 JSObject* globalThis; 62 66 int refCount; … … 83 87 ScopeChainIterator end() const; 84 88 85 JSGlobalObject* globalObject() const; // defined in JSGlobalObject.h86 JSObject* globalThisObject() const { return globalThis; }87 88 89 #ifndef NDEBUG 89 90 void print() const; … … 94 95 { 95 96 ASSERT(o); 96 return new ScopeChainNode(this, o, globalData, global This);97 return new ScopeChainNode(this, o, globalData, globalObject, globalThis); 97 98 } 98 99 … … 164 165 } 165 166 166 ScopeChain(JSObject* o, JSGlobalData* globalData, JS Object* globalThis)167 : m_node(new ScopeChainNode(0, o, globalData, global This))167 ScopeChain(JSObject* o, JSGlobalData* globalData, JSGlobalObject* globalObject, JSObject* globalThis) 168 : m_node(new ScopeChainNode(0, o, globalData, globalObject, globalThis)) 168 169 { 169 170 } … … 204 205 void clear() { m_node->deref(); m_node = 0; } 205 206 206 JSGlobalObject* globalObject() const { return m_node->globalObject (); }207 JSGlobalObject* globalObject() const { return m_node->globalObject; } 207 208 208 209 void markAggregate(MarkStack&) const;
Note:
See TracChangeset
for help on using the changeset viewer.