Ignore:
Timestamp:
Feb 28, 2016, 9:26:05 PM (9 years ago)
Author:
[email protected]
Message:

Make JSFunction.name allocation fully lazy.
<https://webkit.org/b/154806>

Reviewed by Saam Barati.

We were reifying the "name" field on functions lazily, but created the string
value itself up front. This patch gets rid of the up-front allocation,
saving us a JSString allocation per function in most cases.

  • builtins/BuiltinExecutables.cpp:

(JSC::createExecutableInternal):

  • bytecode/UnlinkedFunctionExecutable.cpp:

(JSC::UnlinkedFunctionExecutable::visitChildren):

  • bytecode/UnlinkedFunctionExecutable.h:
  • runtime/CodeCache.cpp:

(JSC::CodeCache::getFunctionExecutableFromGlobalCode):

  • runtime/Executable.h:
  • runtime/JSFunction.cpp:

(JSC::JSFunction::reifyName):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/CodeCache.cpp

    r196272 r197308  
    188188        return nullptr;
    189189   
     190    metadata->overrideName(name);
    190191    metadata->setEndPosition(positionBeforeLastNewline);
    191192    // The Function constructor only has access to global variables, so no variables will be under TDZ.
     
    193194    UnlinkedFunctionExecutable* functionExecutable = UnlinkedFunctionExecutable::create(&vm, source, metadata, UnlinkedNormalFunction, ConstructAbility::CanConstruct, emptyTDZVariables, DerivedContextType::None);
    194195
    195     functionExecutable->m_nameValue.set(vm, functionExecutable, jsString(&vm, name.string()));
    196 
    197196    m_sourceCode.addCache(key, SourceCodeValue(vm, functionExecutable, m_sourceCode.age()));
    198197    return functionExecutable;
Note: See TracChangeset for help on using the changeset viewer.