Ignore:
Timestamp:
Feb 10, 2009, 8:57:08 PM (16 years ago)
Author:
[email protected]
Message:

2009-02-10 Gavin Barraclough <[email protected]>

Reviewed by Oliver Hunt.

Reduce use of void* / reinterpret_cast in JIT repatching code,
add strong types for Calls and for the various types of pointers
we retain into the JIT generated instruction stream.

No performance impact.

  • assembler/AbstractMacroAssembler.h: (JSC::AbstractMacroAssembler::ImmPtr::ImmPtr): (JSC::AbstractMacroAssembler::ImmPtr::asIntptr): (JSC::AbstractMacroAssembler::Imm32::Imm32): (JSC::AbstractMacroAssembler::Label::Label): (JSC::AbstractMacroAssembler::DataLabelPtr::DataLabelPtr): (JSC::AbstractMacroAssembler::Call::Call): (JSC::AbstractMacroAssembler::Call::link): (JSC::AbstractMacroAssembler::Call::linkTo): (JSC::AbstractMacroAssembler::Jump::Jump): (JSC::AbstractMacroAssembler::Jump::linkTo): (JSC::AbstractMacroAssembler::CodeLocationCommon::CodeLocationCommon): (JSC::AbstractMacroAssembler::CodeLocationCommon::operator bool): (JSC::AbstractMacroAssembler::CodeLocationCommon::reset): (JSC::AbstractMacroAssembler::CodeLocationLabel::CodeLocationLabel): (JSC::AbstractMacroAssembler::CodeLocationLabel::addressForSwitch): (JSC::AbstractMacroAssembler::CodeLocationLabel::addressForExceptionHandler): (JSC::AbstractMacroAssembler::CodeLocationLabel::addressForJSR): (JSC::AbstractMacroAssembler::CodeLocationLabel::getJumpDestination): (JSC::AbstractMacroAssembler::CodeLocationJump::CodeLocationJump): (JSC::AbstractMacroAssembler::CodeLocationJump::relink): (JSC::AbstractMacroAssembler::CodeLocationCall::CodeLocationCall): (JSC::AbstractMacroAssembler::CodeLocationCall::relink): (JSC::AbstractMacroAssembler::CodeLocationCall::calleeReturnAddressValue): (JSC::AbstractMacroAssembler::CodeLocationDataLabel32::CodeLocationDataLabel32): (JSC::AbstractMacroAssembler::CodeLocationDataLabel32::repatch): (JSC::AbstractMacroAssembler::CodeLocationDataLabelPtr::CodeLocationDataLabelPtr): (JSC::AbstractMacroAssembler::CodeLocationDataLabelPtr::repatch): (JSC::AbstractMacroAssembler::ProcessorReturnAddress::ProcessorReturnAddress): (JSC::AbstractMacroAssembler::ProcessorReturnAddress::relinkCallerToFunction): (JSC::AbstractMacroAssembler::ProcessorReturnAddress::operator void*): (JSC::AbstractMacroAssembler::PatchBuffer::entry): (JSC::AbstractMacroAssembler::PatchBuffer::trampolineAt): (JSC::AbstractMacroAssembler::PatchBuffer::link): (JSC::AbstractMacroAssembler::PatchBuffer::linkTailRecursive): (JSC::AbstractMacroAssembler::PatchBuffer::patch): (JSC::AbstractMacroAssembler::PatchBuffer::locationOf): (JSC::AbstractMacroAssembler::PatchBuffer::returnAddressOffset): (JSC::AbstractMacroAssembler::differenceBetween): (JSC::::CodeLocationCommon::labelAtOffset): (JSC::::CodeLocationCommon::jumpAtOffset): (JSC::::CodeLocationCommon::callAtOffset): (JSC::::CodeLocationCommon::dataLabelPtrAtOffset): (JSC::::CodeLocationCommon::dataLabel32AtOffset):
  • assembler/MacroAssemblerX86Common.h: (JSC::MacroAssemblerX86Common::call):
  • assembler/X86Assembler.h: (JSC::X86Assembler::getCallReturnOffset):
  • bytecode/CodeBlock.h: (JSC::CallLinkInfo::CallLinkInfo): (JSC::getStructureStubInfoReturnLocation): (JSC::getCallLinkInfoReturnLocation):
  • bytecode/Instruction.h: (JSC::PolymorphicAccessStructureList::PolymorphicStubInfo::set): (JSC::PolymorphicAccessStructureList::PolymorphicAccessStructureList):
  • bytecode/JumpTable.h: (JSC::StringJumpTable::ctiForValue): (JSC::SimpleJumpTable::ctiForValue):
  • bytecode/StructureStubInfo.h: (JSC::StructureStubInfo::StructureStubInfo):
  • bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::emitCatch): (JSC::prepareJumpTableForStringSwitch):
  • interpreter/Interpreter.cpp: (JSC::Interpreter::cti_op_get_by_id_self_fail): (JSC::getPolymorphicAccessStructureListSlot): (JSC::Interpreter::cti_op_throw): (JSC::Interpreter::cti_op_switch_imm): (JSC::Interpreter::cti_op_switch_char): (JSC::Interpreter::cti_op_switch_string): (JSC::Interpreter::cti_vm_throw):
  • jit/JIT.cpp: (JSC::ctiSetReturnAddress): (JSC::ctiPatchCallByReturnAddress): (JSC::JIT::privateCompile): (JSC::JIT::privateCompileCTIMachineTrampolines):
  • jit/JIT.h: (JSC::CallRecord::CallRecord): (JSC::JIT::compileGetByIdSelf): (JSC::JIT::compileGetByIdProto): (JSC::JIT::compileGetByIdChain): (JSC::JIT::compilePutByIdReplace): (JSC::JIT::compilePutByIdTransition): (JSC::JIT::compilePatchGetArrayLength): (JSC::JIT::emitCTICall):
  • jit/JITCall.cpp: (JSC::JIT::unlinkCall): (JSC::JIT::linkCall):
  • jit/JITInlineMethods.h: (JSC::JIT::emitNakedCall): (JSC::JIT::emitCTICall_internal):
  • jit/JITPropertyAccess.cpp: (JSC::JIT::compileGetByIdSlowCase): (JSC::JIT::compilePutByIdSlowCase): (JSC::JIT::privateCompilePutByIdTransition): (JSC::JIT::patchGetByIdSelf): (JSC::JIT::patchPutByIdReplace): (JSC::JIT::privateCompilePatchGetArrayLength): (JSC::JIT::privateCompileGetByIdSelf): (JSC::JIT::privateCompileGetByIdProto): (JSC::JIT::privateCompileGetByIdSelfList): (JSC::JIT::privateCompileGetByIdProtoList): (JSC::JIT::privateCompileGetByIdChainList): (JSC::JIT::privateCompileGetByIdChain): (JSC::JIT::privateCompilePutByIdReplace):
File:
1 edited

Legend:

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

    r40813 r40846  
    45214521        if (stubInfo->opcodeID == op_get_by_id_self) {
    45224522            ASSERT(!stubInfo->stubRoutine);
    4523             polymorphicStructureList = new PolymorphicAccessStructureList(0, stubInfo->u.getByIdSelf.baseObjectStructure);
     4523            polymorphicStructureList = new PolymorphicAccessStructureList(MacroAssembler::CodeLocationLabel(), stubInfo->u.getByIdSelf.baseObjectStructure);
    45244524            stubInfo->initGetByIdSelfList(polymorphicStructureList, 2);
    45254525        } else {
     
    45474547    case op_get_by_id_proto:
    45484548        prototypeStructureList = new PolymorphicAccessStructureList(stubInfo->stubRoutine, stubInfo->u.getByIdProto.baseObjectStructure, stubInfo->u.getByIdProto.prototypeStructure);
    4549         stubInfo->stubRoutine = 0;
     4549        stubInfo->stubRoutine.reset();
    45504550        stubInfo->initGetByIdProtoList(prototypeStructureList, 2);
    45514551        break;
    45524552    case op_get_by_id_chain:
    45534553        prototypeStructureList = new PolymorphicAccessStructureList(stubInfo->stubRoutine, stubInfo->u.getByIdChain.baseObjectStructure, stubInfo->u.getByIdChain.chain);
    4554         stubInfo->stubRoutine = 0;
     4554        stubInfo->stubRoutine.reset();
    45554555        stubInfo->initGetByIdProtoList(prototypeStructureList, 2);
    45564556        break;
     
    57795779
    57805780    ARG_setCallFrame(callFrame);
    5781     void* catchRoutine = handler->nativeCode;
     5781    void* catchRoutine = handler->nativeCode.addressForExceptionHandler();
    57825782    ASSERT(catchRoutine);
    57835783    STUB_SET_RETURN_ADDRESS(catchRoutine);
     
    59735973
    59745974    if (scrutinee.isInt32Fast())
    5975         return codeBlock->immediateSwitchJumpTable(tableIndex).ctiForValue(scrutinee.getInt32Fast());
     5975        return codeBlock->immediateSwitchJumpTable(tableIndex).ctiForValue(scrutinee.getInt32Fast()).addressForSwitch();
    59765976    else {
    59775977        int32_t value;
    59785978        if (scrutinee.numberToInt32(value))
    5979             return codeBlock->immediateSwitchJumpTable(tableIndex).ctiForValue(value);
     5979            return codeBlock->immediateSwitchJumpTable(tableIndex).ctiForValue(value).addressForSwitch();
    59805980        else
    5981             return codeBlock->immediateSwitchJumpTable(tableIndex).ctiDefault;
     5981            return codeBlock->immediateSwitchJumpTable(tableIndex).ctiDefault.addressForSwitch();
    59825982    }
    59835983}
     
    59925992    CodeBlock* codeBlock = callFrame->codeBlock();
    59935993
    5994     void* result = codeBlock->characterSwitchJumpTable(tableIndex).ctiDefault;
     5994    void* result = codeBlock->characterSwitchJumpTable(tableIndex).ctiDefault.addressForSwitch();
    59955995
    59965996    if (scrutinee.isString()) {
    59975997        UString::Rep* value = asString(scrutinee)->value().rep();
    59985998        if (value->size() == 1)
    5999             result = codeBlock->characterSwitchJumpTable(tableIndex).ctiForValue(value->data()[0]);
     5999            result = codeBlock->characterSwitchJumpTable(tableIndex).ctiForValue(value->data()[0]).addressForSwitch();
    60006000    }
    60016001
     
    60126012    CodeBlock* codeBlock = callFrame->codeBlock();
    60136013
    6014     void* result = codeBlock->stringSwitchJumpTable(tableIndex).ctiDefault;
     6014    void* result = codeBlock->stringSwitchJumpTable(tableIndex).ctiDefault.addressForSwitch();
    60156015
    60166016    if (scrutinee.isString()) {
    60176017        UString::Rep* value = asString(scrutinee)->value().rep();
    6018         result = codeBlock->stringSwitchJumpTable(tableIndex).ctiForValue(value);
     6018        result = codeBlock->stringSwitchJumpTable(tableIndex).ctiForValue(value).addressForSwitch();
    60196019    }
    60206020
     
    61206120
    61216121    ARG_setCallFrame(callFrame);
    6122     void* catchRoutine = handler->nativeCode;
     6122    void* catchRoutine = handler->nativeCode.addressForExceptionHandler();
    61236123    ASSERT(catchRoutine);
    61246124    STUB_SET_RETURN_ADDRESS(catchRoutine);
Note: See TracChangeset for help on using the changeset viewer.