Changeset 38688 in webkit for trunk/JavaScriptCore/jit/JIT.cpp


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/jit/JIT.cpp

    r38669 r38688  
    23602360        case op_get_by_id_proto_list:
    23612361        case op_get_by_id_self:
     2362        case op_get_by_id_self_list:
    23622363        case op_get_string_length:
    23632364        case op_put_by_id_generic:
     
    32313232
    32323233#if USE(CTI_REPATCH_PIC)
    3233 void JIT::privateCompileGetByIdProtoList(StructureStubInfo* stubInfo, PrototypeStructureList* prototypeStructures, int currentIndex, Structure* structure, Structure* prototypeStructure, size_t cachedOffset, CallFrame* callFrame)
     3234void JIT::privateCompileGetByIdSelfList(StructureStubInfo* stubInfo, PolymorphicAccessStructureList* polymorphicStructures, int currentIndex, Structure* structure, size_t cachedOffset)
     3235{
     3236    JmpSrc failureCase = checkStructure(X86::eax, structure);
     3237    __ movl_mr(FIELD_OFFSET(JSObject, m_propertyStorage), X86::eax, X86::eax);
     3238    __ movl_mr(cachedOffset * sizeof(JSValue*), X86::eax, X86::eax);
     3239    JmpSrc success = __ jmp();
     3240
     3241    void* code = __ executableCopy();
     3242    ASSERT(code);
     3243
     3244    // Use the repatch information to link the failure cases back to the original slow case routine.
     3245    void* lastProtoBegin = polymorphicStructures->list[currentIndex - 1].stubRoutine;
     3246    if (!lastProtoBegin)
     3247        lastProtoBegin = reinterpret_cast<char*>(stubInfo->callReturnLocation) - repatchOffsetGetByIdSlowCaseCall;
     3248
     3249    X86Assembler::link(code, failureCase, lastProtoBegin);
     3250
     3251    // On success return back to the hot patch code, at a point it will perform the store to dest for us.
     3252    intptr_t successDest = reinterpret_cast<intptr_t>(stubInfo->hotPathBegin) + repatchOffsetGetByIdPropertyMapOffset;
     3253    X86Assembler::link(code, success, reinterpret_cast<void*>(successDest));
     3254
     3255    structure->ref();
     3256    polymorphicStructures->list[currentIndex].set(structure, 0, cachedOffset, 0/*code*/);
     3257
     3258    // Finally repatch the jump to slow case back in the hot path to jump here instead.
     3259    intptr_t jmpLocation = reinterpret_cast<intptr_t>(stubInfo->hotPathBegin) + repatchOffsetGetByIdBranchToSlowCase;
     3260    X86Assembler::repatchBranchOffset(jmpLocation, code);
     3261}
     3262
     3263void JIT::privateCompileGetByIdProtoList(StructureStubInfo* stubInfo, PolymorphicAccessStructureList* prototypeStructures, int currentIndex, Structure* structure, Structure* prototypeStructure, size_t cachedOffset, CallFrame* callFrame)
    32343264{
    32353265    // The prototype object definitely exists (if this stub exists the CodeBlock is referencing a Structure that is
     
    36673697    // We don't want to repatch more than once - in future go to cti_op_get_by_id_generic.
    36683698    // Should probably go to Interpreter::cti_op_get_by_id_fail, but that doesn't do anything interesting right now.
    3669     ctiRepatchCallByReturnAddress(returnAddress, reinterpret_cast<void*>(Interpreter::cti_op_get_by_id_generic));
     3699    ctiRepatchCallByReturnAddress(returnAddress, reinterpret_cast<void*>(Interpreter::cti_op_get_by_id_self_fail));
    36703700
    36713701    // Repatch the offset into the propoerty map to load from, then repatch the Structure to look for.
Note: See TracChangeset for help on using the changeset viewer.