Changeset 92250 in webkit
- Timestamp:
- Aug 2, 2011 5:41:11 PM (13 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r92233 r92250 1 2011-07-30 Oliver Hunt <oliver@apple.com> 2 3 Simplify JSFunction creation for functions written in JS 4 https://bugs.webkit.org/show_bug.cgi?id=65422 5 6 Reviewed by Gavin Barraclough. 7 8 Remove hash lookups used to write name property and transition 9 function structure by caching the resultant structure and property 10 offset in JSGlobalObject. This doesn't impact performance, but 11 we can use this change to make other improvements later. 12 13 * runtime/Executable.cpp: 14 (JSC::FunctionExecutable::FunctionExecutable): 15 * runtime/Executable.h: 16 (JSC::ScriptExecutable::ScriptExecutable): 17 (JSC::FunctionExecutable::jsName): 18 * runtime/JSFunction.cpp: 19 (JSC::JSFunction::JSFunction): 20 * runtime/JSGlobalObject.cpp: 21 (JSC::JSGlobalObject::reset): 22 * runtime/JSGlobalObject.h: 23 (JSC::JSGlobalObject::namedFunctionStructure): 24 (JSC::JSGlobalObject::functionNameOffset): 25 1 26 2011-08-02 Filip Pizlo <fpizlo@apple.com> 2 27 -
trunk/Source/JavaScriptCore/runtime/Executable.cpp
r91933 r92250 145 145 m_firstLine = firstLine; 146 146 m_lastLine = lastLine; 147 m_nameValue.set(globalData, this, jsString(&globalData, name.ustring())); 147 148 } 148 149 … … 157 158 m_firstLine = firstLine; 158 159 m_lastLine = lastLine; 160 m_nameValue.set(exec->globalData(), this, jsString(&exec->globalData(), name.ustring())); 159 161 } 160 162 … … 440 442 ASSERT(structure()->typeInfo().overridesVisitChildren()); 441 443 ScriptExecutable::visitChildren(visitor); 444 if (m_nameValue) 445 visitor.append(&m_nameValue); 442 446 if (m_codeBlockForCall) 443 447 m_codeBlockForCall->visitAggregate(visitor); -
trunk/Source/JavaScriptCore/runtime/Executable.h
r91883 r92250 227 227 #if ENABLE(CODEBLOCK_SAMPLING) 228 228 if (SamplingTool* sampler = globalData.interpreter->sampler()) 229 sampler->notifyOfScope( *globalData, this);229 sampler->notifyOfScope(globalData, this); 230 230 #else 231 231 UNUSED_PARAM(globalData); … … 479 479 480 480 const Identifier& name() { return m_name; } 481 JSString* nameValue() const { return m_nameValue.get(); } 481 482 size_t parameterCount() const { return m_parameters->size(); } 482 483 unsigned capturedVariableCount() const { return m_numCapturedVariables; } … … 510 511 OwnPtr<FunctionCodeBlock> m_codeBlockForConstruct; 511 512 Identifier m_name; 513 WriteBarrier<JSString> m_nameValue; 512 514 SharedSymbolTable* m_symbolTable; 513 515 }; -
trunk/Source/JavaScriptCore/runtime/JSFunction.cpp
r90404 r92250 91 91 { 92 92 ASSERT(inherits(&s_info)); 93 const Identifier& name = static_cast<FunctionExecutable*>(m_executable.get())->name();94 putDirect (exec->globalData(), exec->globalData().propertyNames->name, jsString(exec, name.isNull() ? "" : name.ustring()), DontDelete | ReadOnly | DontEnum);93 setStructure(exec->globalData(), scopeChainNode->globalObject->namedFunctionStructure()); 94 putDirectOffset(exec->globalData(), scopeChainNode->globalObject->functionNameOffset(), executable->nameValue()); 95 95 } 96 96 -
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp
r92058 r92250 188 188 m_functionPrototype.set(exec->globalData(), this, FunctionPrototype::create(exec, this, FunctionPrototype::createStructure(exec->globalData(), jsNull()))); // The real prototype will be set once ObjectPrototype is created. 189 189 m_functionStructure.set(exec->globalData(), this, JSFunction::createStructure(exec->globalData(), m_functionPrototype.get())); 190 m_namedFunctionStructure.set(exec->globalData(), this, Structure::addPropertyTransition(exec->globalData(), m_functionStructure.get(), exec->globalData().propertyNames->name, DontDelete | ReadOnly | DontEnum, 0, m_functionNameOffset)); 190 191 m_internalFunctionStructure.set(exec->globalData(), this, InternalFunction::createStructure(exec->globalData(), m_functionPrototype.get())); 191 192 JSFunction* callFunction = 0; -
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h
r92058 r92250 117 117 WriteBarrier<Structure> m_errorStructure; 118 118 WriteBarrier<Structure> m_functionStructure; 119 WriteBarrier<Structure> m_namedFunctionStructure; 120 size_t m_functionNameOffset; 119 121 WriteBarrier<Structure> m_numberObjectStructure; 120 122 WriteBarrier<Structure> m_regExpMatchesArrayStructure; … … 230 232 Structure* errorStructure() const { return m_errorStructure.get(); } 231 233 Structure* functionStructure() const { return m_functionStructure.get(); } 234 Structure* namedFunctionStructure() const { return m_namedFunctionStructure.get(); } 235 size_t functionNameOffset() const { return m_functionNameOffset; } 232 236 Structure* numberObjectStructure() const { return m_numberObjectStructure.get(); } 233 237 Structure* internalFunctionStructure() const { return m_internalFunctionStructure.get(); }
Note: See TracChangeset
for help on using the changeset viewer.