Ignore:
Timestamp:
Aug 17, 2008, 12:57:39 AM (17 years ago)
Author:
[email protected]
Message:

2007-08-16 Geoffrey Garen <[email protected]>

Reviewed by Oliver Hunt.


Sped up property access for array.length and string.length by adding a
mechanism for returning a temporary value directly instead of returning
a pointer to a function that retrieves the value.


Also removed some unused cruft from PropertySlot.


SunSpider says 0.5% - 1.2% faster.

NOTE: This optimization is not a good idea in general, because it's
actually a pessimization in the case of resolve for assignment,
and it may get in the way of other optimizations in the future.

File:
1 edited

Legend:

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

    r35691 r35806  
    174174}
    175175
    176 JSValue* JSArray::lengthGetter(ExecState* exec, const Identifier&, const PropertySlot& slot)
    177 {
    178     return jsNumber(exec, static_cast<JSArray*>(slot.slotBase())->m_length);
    179 }
    180 
    181176bool JSArray::getOwnPropertySlot(ExecState* exec, unsigned i, PropertySlot& slot)
    182177{
     
    211206{
    212207    if (propertyName == exec->propertyNames().length) {
    213         slot.setCustom(this, lengthGetter);
     208        slot.setValue(jsNumber(exec, getLength()));
    214209        return true;
    215210    }
Note: See TracChangeset for help on using the changeset viewer.