Changeset 37859 in webkit for trunk/JavaScriptCore/kjs/nodes.cpp


Ignore:
Timestamp:
Oct 24, 2008, 1:44:58 PM (17 years ago)
Author:
[email protected]
Message:

2008-10-24 Cameron Zwarich <[email protected]>

Reviewed by Maciej Stachowiak.

Bug 21862: Create JSFunction prototype property lazily
<https://bugs.webkit.org/show_bug.cgi?id=21862>

This is a 1.5% speedup on SunSpider and a 1.4% speedup on the V8
benchmark suite, including a 3.8% speedup on Earley-Boyer.

  • kjs/JSFunction.cpp: (JSC::JSFunction::getOwnPropertySlot):
  • kjs/nodes.cpp: (JSC::FuncDeclNode::makeFunction): (JSC::FuncExprNode::makeFunction):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/nodes.cpp

    r37763 r37859  
    18721872JSFunction* FuncDeclNode::makeFunction(ExecState* exec, ScopeChainNode* scopeChain)
    18731873{
     1874    return new (exec) JSFunction(exec, m_ident, m_body.get(), scopeChain);
     1875}
     1876
     1877RegisterID* FuncDeclNode::emitCode(CodeGenerator&, RegisterID* dst)
     1878{
     1879    return dst;
     1880}
     1881
     1882// ------------------------------ FuncExprNode ---------------------------------
     1883
     1884RegisterID* FuncExprNode::emitCode(CodeGenerator& generator, RegisterID* dst)
     1885{
     1886    return generator.emitNewFunctionExpression(generator.finalDestination(dst), this);
     1887}
     1888
     1889JSFunction* FuncExprNode::makeFunction(ExecState* exec, ScopeChainNode* scopeChain)
     1890{
    18741891    JSFunction* func = new (exec) JSFunction(exec, m_ident, m_body.get(), scopeChain);
    1875 
    1876     JSObject* proto = constructEmptyObject(exec);
    1877     proto->putDirect(exec->propertyNames().constructor, func, DontEnum);
    1878     func->putDirect(exec->propertyNames().prototype, proto, DontDelete);
    1879     return func;
    1880 }
    1881 
    1882 RegisterID* FuncDeclNode::emitCode(CodeGenerator&, RegisterID* dst)
    1883 {
    1884     return dst;
    1885 }
    1886 
    1887 // ------------------------------ FuncExprNode ---------------------------------
    1888 
    1889 RegisterID* FuncExprNode::emitCode(CodeGenerator& generator, RegisterID* dst)
    1890 {
    1891     return generator.emitNewFunctionExpression(generator.finalDestination(dst), this);
    1892 }
    1893 
    1894 JSFunction* FuncExprNode::makeFunction(ExecState* exec, ScopeChainNode* scopeChain)
    1895 {
    1896     JSFunction* func = new (exec) JSFunction(exec, m_ident, m_body.get(), scopeChain);
    1897     JSObject* proto = constructEmptyObject(exec);
    1898     proto->putDirect(exec->propertyNames().constructor, func, DontEnum);
    1899     func->putDirect(exec->propertyNames().prototype, proto, DontDelete);
    19001892
    19011893    /*
Note: See TracChangeset for help on using the changeset viewer.