Skip to content
  • barraclough@apple.com's avatar
    How many copies of the parameters do you need? · cf6fa796
    barraclough@apple.com authored
    https://bugs.webkit.org/show_bug.cgi?id=28701
    
    Reviewed by Darin Adler.
    
    The function parameters in JSC get copied a lot - and unnecessarily so.
    
    Originally this happened due to duplicating FunctionBodyNodes on recompilation,
    though the problem has been exacerbated by copying the parameters from the
    original function body onto the executable, then back onto the real body that
    will be generated (this happens on every function).  And this is all made worse
    since the data structures in question are a little ugly - C style arrays of C++
    objects containing ref counts, so they need a full copy-construct (rather than
    a simple memcpy).
    
    This can all be greatly simplified by just punting the parameters off into
    their own ref-counted object, and forgoing all the copying.
    
    ~no performance change, possible slight progression.
    
    * bytecompiler/BytecodeGenerator.cpp:
    (JSC::BytecodeGenerator::BytecodeGenerator):
    * bytecompiler/BytecodeGenerator.h:
    (JSC::BytecodeGenerator::makeFunction):
    * parser/Nodes.cpp:
    (JSC::FunctionParameters::FunctionParameters):
    (JSC::FunctionBodyNode::FunctionBodyNode):
    (JSC::FunctionBodyNode::finishParsing):
    * parser/Nodes.h:
    (JSC::FunctionBodyNode::parameters):
    (JSC::FunctionBodyNode::parameterCount):
    * runtime/Executable.cpp:
    (JSC::FunctionExecutable::~FunctionExecutable):
    (JSC::FunctionExecutable::compile):
    (JSC::FunctionExecutable::reparseExceptionInfo):
    (JSC::FunctionExecutable::fromGlobalCode):
    (JSC::FunctionExecutable::paramString):
    * runtime/Executable.h:
    (JSC::FunctionExecutable::FunctionExecutable):
    (JSC::FunctionExecutable::parameterCount):
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@47775 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    cf6fa796