Changeset 38688 in webkit for trunk/JavaScriptCore/interpreter


Ignore:
Timestamp:
Nov 21, 2008, 7:34:43 PM (17 years ago)
Author:
[email protected]
Message:

2008-11-21 Gavin Barraclough <[email protected]>

Reviewed by Oliver Hunt.

Add (really) polymorphic caching for get by id self.
Very similar to caching of prototype accesses, described below.

Oh, also, probably shouldn't have been leaking those structure list objects.


4% preogression on deltablue.

  • bytecode/CodeBlock.cpp: (JSC::CodeBlock::dump): (JSC::CodeBlock::derefStructures): (JSC::PrototypeStructureList::derefStructures):
  • bytecode/Instruction.h:
  • bytecode/Opcode.h:
  • interpreter/Interpreter.cpp: (JSC::Interpreter::privateExecute): (JSC::Interpreter::cti_op_get_by_id_self_fail):
  • jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): (JSC::JIT::privateCompileGetByIdSelfList): (JSC::JIT::patchGetByIdSelf):
  • jit/JIT.h: (JSC::JIT::compileGetByIdSelfList):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/interpreter/Interpreter.cpp

    r38652 r38688  
    25872587        NEXT_INSTRUCTION();
    25882588    }
     2589    DEFINE_OPCODE(op_get_by_id_self_list) {
     2590        // Polymorphic self access caching currently only supported when JITting.
     2591        ASSERT_NOT_REACHED();
     2592        // This case of the switch must not be empty, else (op_get_by_id_self_list == op_get_by_id_chain)!
     2593        vPC += 8;
     2594        NEXT_INSTRUCTION();
     2595    }
    25892596    DEFINE_OPCODE(op_get_by_id_proto_list) {
    25902597        // Polymorphic prototype access caching currently only supported when JITting.
     
    45944601    JSValue* result = baseValue->get(callFrame, ident, slot);
    45954602
    4596     CHECK_FOR_EXCEPTION_AT_END();
     4603    CHECK_FOR_EXCEPTION();
     4604
     4605    if (baseValue->isObject()
     4606        && slot.isCacheable()
     4607        && !asCell(baseValue)->structure()->isDictionary()
     4608        && slot.slotBase() == baseValue) {
     4609
     4610        CodeBlock* codeBlock = callFrame->codeBlock();
     4611        unsigned vPCIndex = codeBlock->ctiReturnAddressVPCMap.get(CTI_RETURN_ADDRESS);
     4612        Instruction* vPC = codeBlock->instructions.begin() + vPCIndex;
     4613
     4614        ASSERT(slot.slotBase()->isObject());
     4615
     4616        StructureStubInfo* stubInfo = &codeBlock->getStubInfo(CTI_RETURN_ADDRESS);
     4617
     4618        PolymorphicAccessStructureList* polymorphicStructureList;
     4619        int listIndex = 1;
     4620
     4621        if (vPC[0].u.opcode == ARG_globalData->interpreter->getOpcode(op_get_by_id_self)) {
     4622            ASSERT(!stubInfo->stubRoutine);
     4623            polymorphicStructureList = new PolymorphicAccessStructureList(vPC[4].u.structure, 0, vPC[5].u.operand, 0);
     4624
     4625            vPC[0] = ARG_globalData->interpreter->getOpcode(op_get_by_id_self_list);
     4626            vPC[4] = polymorphicStructureList;
     4627            vPC[5] = 2;
     4628        } else {
     4629            polymorphicStructureList = vPC[4].u.polymorphicStructures;
     4630            listIndex = vPC[5].u.operand;
     4631
     4632            vPC[5] = listIndex + 1;
     4633        }
     4634
     4635        JIT::compileGetByIdSelfList(callFrame->scopeChain()->globalData, codeBlock, stubInfo, polymorphicStructureList, listIndex, asCell(baseValue)->structure(), slot.cachedOffset());
     4636
     4637        if (listIndex == (POLYMORPHIC_LIST_CACHE_SIZE - 1))
     4638            ctiRepatchCallByReturnAddress(CTI_RETURN_ADDRESS, reinterpret_cast<void*>(cti_op_get_by_id_generic));
     4639    } else {
     4640        ctiRepatchCallByReturnAddress(CTI_RETURN_ADDRESS, reinterpret_cast<void*>(cti_op_get_by_id_generic));
     4641    }
    45974642    return result;
    45984643}
     
    46354680        StructureStubInfo* stubInfo = &codeBlock->getStubInfo(CTI_RETURN_ADDRESS);
    46364681
    4637         PrototypeStructureList* prototypeStructureList;
     4682        PolymorphicAccessStructureList* prototypeStructureList;
    46384683        int listIndex = 1;
    46394684
    46404685        if (vPC[0].u.opcode == ARG_globalData->interpreter->getOpcode(op_get_by_id_proto)) {
    4641             prototypeStructureList = new PrototypeStructureList(vPC[4].u.structure, vPC[5].u.structure, vPC[6].u.operand, stubInfo->stubRoutine);
     4686            prototypeStructureList = new PolymorphicAccessStructureList(vPC[4].u.structure, vPC[5].u.structure, vPC[6].u.operand, stubInfo->stubRoutine);
    46424687            stubInfo->stubRoutine = 0;
    46434688
     
    46464691            vPC[5] = 2;
    46474692        } else {
    4648             prototypeStructureList = vPC[4].u.prototypeStructure;
     4693            prototypeStructureList = vPC[4].u.polymorphicStructures;
    46494694            listIndex = vPC[5].u.operand;
    46504695
     
    46544699        JIT::compileGetByIdProtoList(callFrame->scopeChain()->globalData, callFrame, codeBlock, stubInfo, prototypeStructureList, listIndex, structure, slotBaseObject->structure(), slot.cachedOffset());
    46554700
    4656         if (listIndex == (PROTOTYPE_LIST_CACHE_SIZE - 1))
     4701        if (listIndex == (POLYMORPHIC_LIST_CACHE_SIZE - 1))
    46574702            ctiRepatchCallByReturnAddress(CTI_RETURN_ADDRESS, reinterpret_cast<void*>(cti_op_get_by_id_proto_list_full));
    46584703    } else {
Note: See TracChangeset for help on using the changeset viewer.