Ignore:
Timestamp:
Sep 2, 2014, 3:29:59 PM (11 years ago)
Author:
[email protected]
Message:

Optimize own property GetByVals with rope string subscripts.
<https://webkit.org/b/136458>

For simple JSObjects that don't override getOwnPropertySlot to implement
custom properties, we have a fast path that grabs directly at the object
property storage.

Make this fast path even faster when the property name is an unresolved
rope string by using JSString::toExistingAtomicString(). This is faster
because it avoids allocating a new StringImpl if the string is already
a known Identifier, which is guaranteed to be the case if it's present
as an own property on the object.)

~10% speed-up on Dromaeo/dom-attr.html

Reviewed by Geoffrey Garen.

  • dfg/DFGOperations.cpp:
  • jit/JITOperations.cpp:

(JSC::getByVal):

  • llint/LLIntSlowPaths.cpp:

(JSC::LLInt::getByVal):

When using the fastGetOwnProperty() optimization, get the String
out of JSString by using toExistingAtomicString(). This avoids
StringImpl allocation and lets us bypass the PropertyTable lookup
entirely if no AtomicString is found.

  • runtime/JSCell.h:
  • runtime/JSCellInlines.h:

(JSC::JSCell::fastGetOwnProperty):

Make fastGetOwnProperty() take a PropertyName instead of a String.
This avoids churning the ref count, since we don't need to create
a temporary wrapper around the AtomicStringImpl* found in GetByVal.

  • runtime/PropertyName.h:

(JSC::PropertyName::PropertyName):

Add constructor: PropertyName(AtomicStringImpl*)

  • runtime/PropertyMapHashTable.h:

(JSC::PropertyTable::get):
(JSC::PropertyTable::findWithString): Deleted.

  • runtime/Structure.h:
  • runtime/StructureInlines.h:

(JSC::Structure::get):

Remove code for querying a PropertyTable with an unhashed string key
since the only client is now gone.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp

    r173082 r173188  
    726726        Structure& structure = *baseValue.asCell()->structure(vm);
    727727        if (JSCell::canUseFastGetOwnProperty(structure)) {
    728             if (JSValue result = baseValue.asCell()->fastGetOwnProperty(vm, structure, asString(subscript)->value(exec)))
    729                 return result;
     728            if (AtomicStringImpl* existingAtomicString = asString(subscript)->toExistingAtomicString(exec)) {
     729                if (JSValue result = baseValue.asCell()->fastGetOwnProperty(vm, structure, existingAtomicString))
     730                    return result;
     731            }
    730732        }
    731733    }
Note: See TracChangeset for help on using the changeset viewer.