Changeset 39182 in webkit for trunk/JavaScriptCore/interpreter


Ignore:
Timestamp:
Dec 10, 2008, 12:05:53 PM (16 years ago)
Author:
[email protected]
Message:

2008-12-10 Sam Weinig <[email protected]>

Reviewed by Geoffrey Garen.

<rdar://problem/6428332> Remove the CTI return address table from CodeBlock

Step 2:

Convert the return address table from a HashMap to a sorted Vector. This
reduces the size of the data structure by ~4.5MB on Membuster head.

SunSpider reports a 0.5% progression.

  • bytecode/CodeBlock.cpp: (JSC::sizeInBytes): Generic method to get the cost of a Vector. (JSC::CodeBlock::dumpStatistics): Add dumping of member sizes.
  • bytecode/CodeBlock.h: (JSC::PC::PC): Struct representing NativePC -> VirtualPC mappings. (JSC::getNativePC): Helper for binary chop. (JSC::CodeBlock::getBytecodeIndex): Used to get the VirtualPC from a NativePC using a binary chop of the pcVector. (JSC::CodeBlock::pcVector): Accessor.
  • interpreter/Interpreter.cpp: (JSC::vPCForPC): Use getBytecodeIndex instead of jitReturnAddressVPCMap().get(). (JSC::Interpreter::cti_op_instanceof): Ditto. (JSC::Interpreter::cti_op_resolve): Ditto. (JSC::Interpreter::cti_op_resolve_func): Ditto. (JSC::Interpreter::cti_op_resolve_skip): Ditto. (JSC::Interpreter::cti_op_resolve_with_base): Ditto. (JSC::Interpreter::cti_op_throw): Ditto. (JSC::Interpreter::cti_op_in): Ditto. (JSC::Interpreter::cti_vm_throw): Ditto.
  • jit/JIT.cpp: (JSC::JIT::privateCompile): Reserve exact capacity and fill the pcVector.
File:
1 edited

Legend:

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

    r39161 r39182  
    9696        return static_cast<Instruction*>(pc);
    9797
    98     ASSERT(codeBlock->jitReturnAddressVPCMap().contains(pc));
    99     unsigned vPCIndex = codeBlock->jitReturnAddressVPCMap().get(pc);
     98    unsigned vPCIndex = codeBlock->getBytecodeIndex(pc);
    10099    return codeBlock->instructions().begin() + vPCIndex;
    101100}
     
    47664765        CallFrame* callFrame = ARG_callFrame;
    47674766        CodeBlock* codeBlock = callFrame->codeBlock();
    4768         ASSERT(codeBlock->jitReturnAddressVPCMap().contains(CTI_RETURN_ADDRESS));
    4769         unsigned vPCIndex = codeBlock->jitReturnAddressVPCMap().get(CTI_RETURN_ADDRESS);
     4767        unsigned vPCIndex = codeBlock->getBytecodeIndex(CTI_RETURN_ADDRESS);
    47704768        ARG_globalData->exception = createInvalidParamError(callFrame, "instanceof", baseVal, codeBlock->instructions().begin() + vPCIndex, codeBlock);
    47714769        VM_THROW_EXCEPTION();
     
    50655063
    50665064    CodeBlock* codeBlock = callFrame->codeBlock();
    5067     ASSERT(codeBlock->jitReturnAddressVPCMap().contains(CTI_RETURN_ADDRESS));
    5068     unsigned vPCIndex = codeBlock->jitReturnAddressVPCMap().get(CTI_RETURN_ADDRESS);
     5065    unsigned vPCIndex = codeBlock->getBytecodeIndex(CTI_RETURN_ADDRESS);
    50695066    ARG_globalData->exception = createUndefinedVariableError(callFrame, ident, codeBlock->instructions().begin() + vPCIndex, codeBlock);
    50705067    VM_THROW_EXCEPTION();
     
    51925189
    51935190    CodeBlock* codeBlock = callFrame->codeBlock();
    5194     ASSERT(codeBlock->jitReturnAddressVPCMap().contains(CTI_RETURN_ADDRESS));
    5195     unsigned vPCIndex = codeBlock->jitReturnAddressVPCMap().get(CTI_RETURN_ADDRESS);
     5191    unsigned vPCIndex = codeBlock->getBytecodeIndex(CTI_RETURN_ADDRESS);
    51965192    ARG_globalData->exception = createUndefinedVariableError(callFrame, ident, codeBlock->instructions().begin() + vPCIndex, codeBlock);
    51975193    VM_THROW_EXCEPTION_2();
     
    53505346
    53515347    CodeBlock* codeBlock = callFrame->codeBlock();
    5352     ASSERT(codeBlock->jitReturnAddressVPCMap().contains(CTI_RETURN_ADDRESS));
    5353     unsigned vPCIndex = codeBlock->jitReturnAddressVPCMap().get(CTI_RETURN_ADDRESS);
     5348    unsigned vPCIndex = codeBlock->getBytecodeIndex(CTI_RETURN_ADDRESS);
    53545349    ARG_globalData->exception = createUndefinedVariableError(callFrame, ident, codeBlock->instructions().begin() + vPCIndex, codeBlock);
    53555350    VM_THROW_EXCEPTION();
     
    55895584
    55905585    CodeBlock* codeBlock = callFrame->codeBlock();
    5591     ASSERT(codeBlock->jitReturnAddressVPCMap().contains(CTI_RETURN_ADDRESS));
    5592     unsigned vPCIndex = codeBlock->jitReturnAddressVPCMap().get(CTI_RETURN_ADDRESS);
     5586    unsigned vPCIndex = codeBlock->getBytecodeIndex(CTI_RETURN_ADDRESS);
    55935587    ARG_globalData->exception = createUndefinedVariableError(callFrame, ident, codeBlock->instructions().begin() + vPCIndex, codeBlock);
    55945588    VM_THROW_EXCEPTION_2();
     
    57475741    CodeBlock* codeBlock = callFrame->codeBlock();
    57485742
    5749     ASSERT(codeBlock->jitReturnAddressVPCMap().contains(CTI_RETURN_ADDRESS));
    5750     unsigned vPCIndex = codeBlock->jitReturnAddressVPCMap().get(CTI_RETURN_ADDRESS);
     5743    unsigned vPCIndex = codeBlock->getBytecodeIndex(CTI_RETURN_ADDRESS);
    57515744
    57525745    JSValue* exceptionValue = ARG_src1;
     
    59015894        CallFrame* callFrame = ARG_callFrame;
    59025895        CodeBlock* codeBlock = callFrame->codeBlock();
    5903         ASSERT(codeBlock->jitReturnAddressVPCMap().contains(CTI_RETURN_ADDRESS));
    5904         unsigned vPCIndex = codeBlock->jitReturnAddressVPCMap().get(CTI_RETURN_ADDRESS);
     5896        unsigned vPCIndex = codeBlock->getBytecodeIndex(CTI_RETURN_ADDRESS);
    59055897        ARG_globalData->exception = createInvalidParamError(callFrame, "in", baseVal, codeBlock->instructions().begin() + vPCIndex, codeBlock);
    59065898        VM_THROW_EXCEPTION();
     
    60926084    JSGlobalData* globalData = ARG_globalData;
    60936085
    6094     ASSERT(codeBlock->jitReturnAddressVPCMap().contains(globalData->exceptionLocation));
    6095     unsigned vPCIndex = codeBlock->jitReturnAddressVPCMap().get(globalData->exceptionLocation);
     6086    unsigned vPCIndex = codeBlock->getBytecodeIndex(globalData->exceptionLocation);
    60966087
    60976088    JSValue* exceptionValue = globalData->exception;
Note: See TracChangeset for help on using the changeset viewer.