Ignore:
Timestamp:
Sep 21, 2008, 1:37:01 AM (17 years ago)
Author:
[email protected]
Message:

2008-09-21 Cameron Zwarich <[email protected]>

Reviewed by Maciej Stachowiak.

Bug 20815: 'arguments' object creation is non-optimal
<https://bugs.webkit.org/show_bug.cgi?id=20815>

Fix our inefficient way of creating the arguments object by only
creating named properties for each of the arguments after a use of the
'delete' statement. This patch also speeds up access to the 'arguments'
object slightly, but it still does not use the array fast path for
indexed access that exists for many opcodes.

This is about a 20% improvement on the V8 Raytrace benchmark, and a 1.5%
improvement on the Earley-Boyer benchmark, which gives a 4% improvement
overall.

JavaScriptCore:

  • kjs/Arguments.cpp: (JSC::Arguments::Arguments): (JSC::Arguments::mark): (JSC::Arguments::getOwnPropertySlot): (JSC::Arguments::put): (JSC::Arguments::deleteProperty):
  • kjs/Arguments.h: (JSC::Arguments::ArgumentsData::ArgumentsData):
  • kjs/IndexToNameMap.h: (JSC::IndexToNameMap::size):
  • kjs/JSActivation.cpp: (JSC::JSActivation::createArgumentsObject):
  • kjs/JSActivation.h: (JSC::JSActivation::uncheckedSymbolTableGet): (JSC::JSActivation::uncheckedSymbolTableGetValue): (JSC::JSActivation::uncheckedSymbolTablePut):
  • kjs/JSFunction.h: (JSC::JSFunction::numParameters):

LayoutTests:

  • fast/js/arguments-expected.txt: Added.
  • fast/js/arguments.html: Added.
  • fast/js/resources/arguments.js: Added.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/JSFunction.h

    r36263 r36735  
    5757        const Identifier& getParameterName(int index);
    5858
     59        unsigned numParameters() const
     60        {
     61            return m_body->parameters().size();
     62        }
     63
    5964        void setScope(const ScopeChain& scopeChain) { m_scopeChain = scopeChain; }
    6065        ScopeChain& scope() { return m_scopeChain; }
Note: See TracChangeset for help on using the changeset viewer.