Ignore:
Timestamp:
Feb 18, 2010, 10:23:25 PM (15 years ago)
Author:
[email protected]
Message:

2010-02-18 Oliver Hunt <[email protected]>

Reviewed by Gavin Barraclough.

Improve interpreter getter performance
https://bugs.webkit.org/show_bug.cgi?id=35138

Improve the performance of getter dispatch by making it possible
for the interpreter to cache the GetterSetter object lookup.

To do this we simply need to make PropertySlot aware of getters
as a potentially cacheable property, and record the base and this
objects for a getter access. This allows us to use more-or-less
identical code to that used by the normal get_by_id caching, with
the dispatch being the only actual difference.

I'm holding off of implementing this in the JIT until I do some
cleanup to try and making coding in the JIT not be as horrible
as it is currently.

  • bytecode/CodeBlock.cpp: (JSC::CodeBlock::dump): (JSC::CodeBlock::derefStructures): (JSC::CodeBlock::refStructures):
  • bytecode/Opcode.h:
  • interpreter/Interpreter.cpp: (JSC::Interpreter::resolveGlobal): (JSC::Interpreter::tryCacheGetByID): (JSC::Interpreter::privateExecute):
  • jit/JIT.cpp: (JSC::JIT::privateCompileMainPass):
  • jit/JITStubs.cpp: (JSC::JITThunks::tryCacheGetByID): (JSC::DEFINE_STUB_FUNCTION):
  • runtime/JSObject.cpp: (JSC::JSObject::fillGetterPropertySlot):
  • runtime/PropertySlot.cpp: (JSC::PropertySlot::functionGetter):
  • runtime/PropertySlot.h: (JSC::PropertySlot::isGetter): (JSC::PropertySlot::isCacheable): (JSC::PropertySlot::isCacheableValue): (JSC::PropertySlot::setValueSlot): (JSC::PropertySlot::setGetterSlot): (JSC::PropertySlot::setCacheableGetterSlot): (JSC::PropertySlot::clearOffset): (JSC::PropertySlot::thisValue):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/jit/JITStubs.cpp

    r54843 r55002  
    857857
    858858    // Uncacheable: give up.
    859     if (!slot.isCacheable()) {
     859    if (!slot.isCacheableValue()) {
    860860        ctiPatchCallByReturnAddress(codeBlock, returnAddress, FunctionPtr(cti_op_get_by_id_generic));
    861861        return;
    862862    }
     863    ASSERT(!slot.isGetter());
    863864
    864865    JSCell* baseCell = asCell(baseValue);
     
    12901291    // be an object.  (Assertion to ensure asObject() call below is safe, which comes after
    12911292    // an isCacheable() chceck.
    1292     ASSERT(!slot.isCacheable() || slot.slotBase().isObject());
     1293    ASSERT(!slot.isCacheableValue() || slot.slotBase().isObject());
    12931294
    12941295    // Check that:
     
    13011302    JSObject* slotBaseObject;
    13021303    if (baseValue.isCell()
    1303         && slot.isCacheable()
     1304        && slot.isCacheableValue()
    13041305        && !(structure = asCell(baseValue)->structure())->isUncacheableDictionary()
    13051306        && (slotBaseObject = asObject(slot.slotBase()))->getPropertySpecificValue(callFrame, ident, specific)
     
    13751376
    13761377    if (baseValue.isCell()
    1377         && slot.isCacheable()
     1378        && slot.isCacheableValue()
    13781379        && !asCell(baseValue)->structure()->isUncacheableDictionary()
    13791380        && slot.slotBase() == baseValue) {
     
    14481449    CHECK_FOR_EXCEPTION();
    14491450
    1450     if (!baseValue.isCell() || !slot.isCacheable() || asCell(baseValue)->structure()->isDictionary()) {
     1451    if (!baseValue.isCell() || !slot.isCacheableValue() || asCell(baseValue)->structure()->isDictionary()) {
    14511452        ctiPatchCallByReturnAddress(callFrame->codeBlock(), STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_id_proto_fail));
    14521453        return JSValue::encode(result);
     
    23042305    if (globalObject->getPropertySlot(callFrame, ident, slot)) {
    23052306        JSValue result = slot.getValue(callFrame, ident);
    2306         if (slot.isCacheable() && !globalObject->structure()->isUncacheableDictionary() && slot.slotBase() == globalObject) {
     2307        if (slot.isCacheableValue() && !globalObject->structure()->isUncacheableDictionary() && slot.slotBase() == globalObject) {
    23072308            GlobalResolveInfo& globalResolveInfo = callFrame->codeBlock()->globalResolveInfo(globalResolveInfoIndex);
    23082309            if (globalResolveInfo.structure)
Note: See TracChangeset for help on using the changeset viewer.