Changeset 229815 in webkit


Ignore:
Timestamp:
Mar 21, 2018 11:23:30 AM (6 years ago)
Author:
mark.lam@apple.com
Message:

Use CodeBlock::instructions()[] and CodeBlock::bytecodeOffset() instead of doing own pointer math.
https://bugs.webkit.org/show_bug.cgi?id=183857
<rdar://problem/38712184>

Reviewed by JF Bastien.

We should avoid doing pointer math with CodeBlock::instructions().begin().
Instead, we should use the operator[] that comes with CodeBlock::instructions()
for computing an Instruction*, and use CodeBlock::bytecodeOffset() for computing
the bytecode offset of a given Instruction*. These methods will do assertions
which helps catch bugs sooner, plus they are more descriptive of the operation
we're trying to do.

  • bytecode/BytecodeKills.h:

(JSC::BytecodeKills::operandIsKilled const):
(JSC::BytecodeKills::forEachOperandKilledAt const):

  • bytecode/CallLinkStatus.cpp:

(JSC::CallLinkStatus::computeFromLLInt):

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::dumpBytecode):
(JSC::CodeBlock::arithProfileForBytecodeOffset):
(JSC::CodeBlock::bytecodeOffsetFromCallSiteIndex):

  • bytecode/GetByIdStatus.cpp:

(JSC::GetByIdStatus::computeFromLLInt):

  • bytecode/PutByIdStatus.cpp:

(JSC::PutByIdStatus::computeFromLLInt):

  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::getPredictionWithoutOSRExit):

  • dfg/DFGOSRExit.cpp:

(JSC::DFG::reifyInlinedCallFrames):

  • dfg/DFGOSRExitCompilerCommon.cpp:

(JSC::DFG::reifyInlinedCallFrames):

  • interpreter/CallFrame.cpp:

(JSC::CallFrame::callSiteBitsAsBytecodeOffset const):
(JSC::CallFrame::currentVPC const):
(JSC::CallFrame::setCurrentVPC):

  • jit/JITCall.cpp:

(JSC::JIT::compileOpCall):

  • jit/JITInlines.h:

(JSC::JIT::updateTopCallFrame):
(JSC::JIT::copiedInstruction):

  • jit/JITOpcodes.cpp:

(JSC::JIT::privateCompileHasIndexedProperty):

  • jit/JITOpcodes32_64.cpp:

(JSC::JIT::privateCompileHasIndexedProperty):

  • jit/JITPropertyAccess.cpp:

(JSC::JIT::privateCompileGetByVal):
(JSC::JIT::privateCompileGetByValWithCachedId):
(JSC::JIT::privateCompilePutByVal):
(JSC::JIT::privateCompilePutByValWithCachedId):

  • jit/SlowPathCall.h:

(JSC::JITSlowPathCall::call):

  • llint/LLIntSlowPaths.cpp:

(JSC::LLInt::llint_trace_operand):
(JSC::LLInt::llint_trace_value):
(JSC::LLInt::LLINT_SLOW_PATH_DECL):
(JSC::LLInt::setupGetByIdPrototypeCache): Deleted.
(JSC::LLInt::getByVal): Deleted.
(JSC::LLInt::handleHostCall): Deleted.
(JSC::LLInt::setUpCall): Deleted.
(JSC::LLInt::genericCall): Deleted.
(JSC::LLInt::varargsSetup): Deleted.
(JSC::LLInt::llint_throw_stack_overflow_error): Deleted.
(JSC::LLInt::llint_stack_check_at_vm_entry): Deleted.
(JSC::LLInt::llint_write_barrier_slow): Deleted.
(JSC::LLInt::llint_crash): Deleted.

  • runtime/SamplingProfiler.cpp:

(JSC::tryGetBytecodeIndex):

Location:
trunk/Source/JavaScriptCore
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r229810 r229815  
     12018-03-21  Mark Lam  <mark.lam@apple.com>
     2
     3        Use CodeBlock::instructions()[] and CodeBlock::bytecodeOffset() instead of doing own pointer math.
     4        https://bugs.webkit.org/show_bug.cgi?id=183857
     5        <rdar://problem/38712184>
     6
     7        Reviewed by JF Bastien.
     8
     9        We should avoid doing pointer math with CodeBlock::instructions().begin().
     10        Instead, we should use the operator[] that comes with CodeBlock::instructions()
     11        for computing an Instruction*, and use CodeBlock::bytecodeOffset() for computing
     12        the bytecode offset of a given Instruction*.  These methods will do assertions
     13        which helps catch bugs sooner, plus they are more descriptive of the operation
     14        we're trying to do.
     15
     16        * bytecode/BytecodeKills.h:
     17        (JSC::BytecodeKills::operandIsKilled const):
     18        (JSC::BytecodeKills::forEachOperandKilledAt const):
     19        * bytecode/CallLinkStatus.cpp:
     20        (JSC::CallLinkStatus::computeFromLLInt):
     21        * bytecode/CodeBlock.cpp:
     22        (JSC::CodeBlock::dumpBytecode):
     23        (JSC::CodeBlock::arithProfileForBytecodeOffset):
     24        (JSC::CodeBlock::bytecodeOffsetFromCallSiteIndex):
     25        * bytecode/GetByIdStatus.cpp:
     26        (JSC::GetByIdStatus::computeFromLLInt):
     27        * bytecode/PutByIdStatus.cpp:
     28        (JSC::PutByIdStatus::computeFromLLInt):
     29        * dfg/DFGByteCodeParser.cpp:
     30        (JSC::DFG::ByteCodeParser::getPredictionWithoutOSRExit):
     31        * dfg/DFGOSRExit.cpp:
     32        (JSC::DFG::reifyInlinedCallFrames):
     33        * dfg/DFGOSRExitCompilerCommon.cpp:
     34        (JSC::DFG::reifyInlinedCallFrames):
     35        * interpreter/CallFrame.cpp:
     36        (JSC::CallFrame::callSiteBitsAsBytecodeOffset const):
     37        (JSC::CallFrame::currentVPC const):
     38        (JSC::CallFrame::setCurrentVPC):
     39        * jit/JITCall.cpp:
     40        (JSC::JIT::compileOpCall):
     41        * jit/JITInlines.h:
     42        (JSC::JIT::updateTopCallFrame):
     43        (JSC::JIT::copiedInstruction):
     44        * jit/JITOpcodes.cpp:
     45        (JSC::JIT::privateCompileHasIndexedProperty):
     46        * jit/JITOpcodes32_64.cpp:
     47        (JSC::JIT::privateCompileHasIndexedProperty):
     48        * jit/JITPropertyAccess.cpp:
     49        (JSC::JIT::privateCompileGetByVal):
     50        (JSC::JIT::privateCompileGetByValWithCachedId):
     51        (JSC::JIT::privateCompilePutByVal):
     52        (JSC::JIT::privateCompilePutByValWithCachedId):
     53        * jit/SlowPathCall.h:
     54        (JSC::JITSlowPathCall::call):
     55        * llint/LLIntSlowPaths.cpp:
     56        (JSC::LLInt::llint_trace_operand):
     57        (JSC::LLInt::llint_trace_value):
     58        (JSC::LLInt::LLINT_SLOW_PATH_DECL):
     59        (JSC::LLInt::setupGetByIdPrototypeCache): Deleted.
     60        (JSC::LLInt::getByVal): Deleted.
     61        (JSC::LLInt::handleHostCall): Deleted.
     62        (JSC::LLInt::setUpCall): Deleted.
     63        (JSC::LLInt::genericCall): Deleted.
     64        (JSC::LLInt::varargsSetup): Deleted.
     65        (JSC::LLInt::llint_throw_stack_overflow_error): Deleted.
     66        (JSC::LLInt::llint_stack_check_at_vm_entry): Deleted.
     67        (JSC::LLInt::llint_write_barrier_slow): Deleted.
     68        (JSC::LLInt::llint_crash): Deleted.
     69        * runtime/SamplingProfiler.cpp:
     70        (JSC::tryGetBytecodeIndex):
     71
    1722018-03-21  Keith Miller  <keith_miller@apple.com>
    273
  • trunk/Source/JavaScriptCore/bytecode/BytecodeKills.h

    r229309 r229815  
    5353    bool operandIsKilled(Instruction* instruction, int operand) const
    5454    {
    55         return operandIsKilled(instruction - m_codeBlock->instructions().begin(), operand);
     55        return operandIsKilled(m_codeBlock->bytecodeOffset(instruction), operand);
    5656    }
    5757   
     
    6969    void forEachOperandKilledAt(Instruction* pc, const Functor& functor) const
    7070    {
    71         forEachOperandKilledAt(pc - m_codeBlock->instructions().begin(), functor);
     71        forEachOperandKilledAt(m_codeBlock->bytecodeOffset(pc), functor);
    7272    }
    7373   
  • trunk/Source/JavaScriptCore/bytecode/CallLinkStatus.cpp

    r226942 r229815  
    6767#endif
    6868
    69     Instruction* instruction = profiledBlock->instructions().begin() + bytecodeIndex;
     69    Instruction* instruction = &profiledBlock->instructions()[bytecodeIndex];
    7070    OpcodeID op = Interpreter::getOpcodeID(instruction[0].u.opcode);
    7171    if (op != op_call && op != op_construct && op != op_tail_call)
  • trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp

    r229413 r229815  
    254254    const StubInfoMap& stubInfos, const CallLinkInfoMap& callLinkInfos)
    255255{
    256     const Instruction* it = instructions().begin() + bytecodeOffset;
     256    const Instruction* it = &instructions()[bytecodeOffset];
    257257    dumpBytecode(out, instructions().begin(), it, stubInfos, callLinkInfos);
    258258}
     
    28752875ArithProfile* CodeBlock::arithProfileForBytecodeOffset(int bytecodeOffset)
    28762876{
    2877     return arithProfileForPC(instructions().begin() + bytecodeOffset);
     2877    return arithProfileForPC(&instructions()[bytecodeOffset]);
    28782878}
    28792879
     
    30223022#else
    30233023        Instruction* instruction = bitwise_cast<Instruction*>(callSiteIndex.bits());
    3024         bytecodeOffset = instruction - instructions().begin();
     3024        bytecodeOffset = this->bytecodeOffset(instruction);
    30253025#endif
    30263026    } else if (jitType == JITCode::DFGJIT || jitType == JITCode::FTLJIT) {
  • trunk/Source/JavaScriptCore/bytecode/GetByIdStatus.cpp

    r226928 r229815  
    8383    VM& vm = *profiledBlock->vm();
    8484   
    85     Instruction* instruction = profiledBlock->instructions().begin() + bytecodeIndex;
     85    Instruction* instruction = &profiledBlock->instructions()[bytecodeIndex];
    8686
    8787    Opcode opcode = instruction[0].u.opcode;
  • trunk/Source/JavaScriptCore/bytecode/PutByIdStatus.cpp

    r226928 r229815  
    7373    VM& vm = *profiledBlock->vm();
    7474   
    75     Instruction* instruction = profiledBlock->instructions().begin() + bytecodeIndex;
     75    Instruction* instruction = &profiledBlock->instructions()[bytecodeIndex];
    7676
    7777    StructureID structureID = instruction[4].u.structureID;
  • trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp

    r229743 r229815  
    830830        // inlined tail call frames, we use SpecFullTop
    831831        // to avoid a spurious OSR exit.
    832         Instruction* instruction = m_inlineStackTop->m_profiledBlock->instructions().begin() + bytecodeIndex;
     832        Instruction* instruction = &m_inlineStackTop->m_profiledBlock->instructions()[bytecodeIndex];
    833833        OpcodeID opcodeID = Interpreter::getOpcodeID(instruction->u.opcode);
    834834
  • trunk/Source/JavaScriptCore/dfg/DFGOSRExit.cpp

    r229609 r229815  
    808808            frame.setOperand(inlineCallFrame->stackOffset + CallFrameSlot::callee, JSValue(inlineCallFrame->calleeConstant()));
    809809#else // USE(JSVALUE64) // so this is the 32-bit part
    810         Instruction* instruction = baselineCodeBlock->instructions().begin() + codeOrigin->bytecodeIndex;
     810        Instruction* instruction = &baselineCodeBlock->instructions()[codeOrigin->bytecodeIndex];
    811811        uint32_t locationBits = CallSiteIndex(instruction).bits();
    812812        frame.setOperand<uint32_t>(inlineCallFrame->stackOffset + CallFrameSlot::argumentCount, TagOffset, locationBits);
     
    822822        uint32_t locationBits = CallSiteIndex(codeOrigin->bytecodeIndex).bits();
    823823#else
    824         Instruction* instruction = outermostBaselineCodeBlock->instructions().begin() + codeOrigin->bytecodeIndex;
     824        Instruction* instruction = &outermostBaselineCodeBlock->instructions()[codeOrigin->bytecodeIndex];
    825825        uint32_t locationBits = CallSiteIndex(instruction).bits();
    826826#endif
  • trunk/Source/JavaScriptCore/dfg/DFGOSRExitCompilerCommon.cpp

    r229609 r229815  
    232232#else // USE(JSVALUE64) // so this is the 32-bit part
    233233        jit.storePtr(callerFrameGPR, AssemblyHelpers::addressForByteOffset(inlineCallFrame->callerFrameOffset()));
    234         Instruction* instruction = baselineCodeBlock->instructions().begin() + codeOrigin->bytecodeIndex;
     234        Instruction* instruction = &baselineCodeBlock->instructions()[codeOrigin->bytecodeIndex];
    235235        uint32_t locationBits = CallSiteIndex(instruction).bits();
    236236        jit.store32(AssemblyHelpers::TrustedImm32(locationBits), AssemblyHelpers::tagFor((VirtualRegister)(inlineCallFrame->stackOffset + CallFrameSlot::argumentCount)));
     
    246246        uint32_t locationBits = CallSiteIndex(codeOrigin->bytecodeIndex).bits();
    247247#else
    248         Instruction* instruction = jit.baselineCodeBlock()->instructions().begin() + codeOrigin->bytecodeIndex;
     248        Instruction* instruction = &jit.baselineCodeBlock()->instructions()[codeOrigin->bytecodeIndex];
    249249        uint32_t locationBits = CallSiteIndex(instruction).bits();
    250250#endif
  • trunk/Source/JavaScriptCore/interpreter/CallFrame.cpp

    r229810 r229815  
    122122    ASSERT(codeBlock());
    123123    ASSERT(callSiteBitsAreBytecodeOffset());
    124     return currentVPC() - codeBlock()->instructions().begin();     
     124    return codeBlock()->bytecodeOffset(currentVPC());     
    125125}
    126126
     
    129129{
    130130    ASSERT(callSiteBitsAreBytecodeOffset());
    131     return codeBlock()->instructions().begin() + callSiteBitsAsBytecodeOffset();
     131    return &codeBlock()->instructions()[callSiteBitsAsBytecodeOffset()];
    132132}
    133133
    134134void CallFrame::setCurrentVPC(Instruction* vpc)
    135135{
    136     CallSiteIndex callSite(vpc - codeBlock()->instructions().begin());
     136    CallSiteIndex callSite(codeBlock()->bytecodeOffset(vpc));
    137137    this[CallFrameSlot::argumentCount].tag() = static_cast<int32_t>(callSite.bits());
    138138}
  • trunk/Source/JavaScriptCore/jit/JITCall.cpp

    r229087 r229815  
    176176    } // SP holds newCallFrame + sizeof(CallerFrameAndPC), with ArgumentCount initialized.
    177177   
    178     uint32_t bytecodeOffset = instruction - m_codeBlock->instructions().begin();
     178    uint32_t bytecodeOffset = m_codeBlock->bytecodeOffset(instruction);
    179179    uint32_t locationBits = CallSiteIndex(bytecodeOffset).bits();
    180180    store32(TrustedImm32(locationBits), Address(callFrameRegister, CallFrameSlot::argumentCount * static_cast<int>(sizeof(Register)) + TagOffset));
  • trunk/Source/JavaScriptCore/jit/JITInlines.h

    r229767 r229815  
    139139    ASSERT(static_cast<int>(m_bytecodeOffset) >= 0);
    140140#if USE(JSVALUE32_64)
    141     Instruction* instruction = m_codeBlock->instructions().begin() + m_bytecodeOffset;
     141    Instruction* instruction = &m_codeBlock->instructions()[m_bytecodeOffset];
    142142    uint32_t locationBits = CallSiteIndex(instruction).bits();
    143143#else
     
    741741inline Instruction* JIT::copiedInstruction(Instruction* inst)
    742742{
    743     ASSERT(inst >= m_codeBlock->instructions().begin() && inst < m_codeBlock->instructions().end());
    744     return m_instructions.begin() + (inst - m_codeBlock->instructions().begin());
     743    return &m_instructions[m_codeBlock->bytecodeOffset(inst)];
    745744}
    746745
  • trunk/Source/JavaScriptCore/jit/JITOpcodes.cpp

    r229609 r229815  
    10641064void JIT::privateCompileHasIndexedProperty(ByValInfo* byValInfo, ReturnAddressPtr returnAddress, JITArrayMode arrayMode)
    10651065{
    1066     Instruction* currentInstruction = m_codeBlock->instructions().begin() + byValInfo->bytecodeIndex;
     1066    Instruction* currentInstruction = &m_codeBlock->instructions()[byValInfo->bytecodeIndex];
    10671067   
    10681068    PatchableJump badType;
  • trunk/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp

    r229609 r229815  
    915915void JIT::privateCompileHasIndexedProperty(ByValInfo* byValInfo, ReturnAddressPtr returnAddress, JITArrayMode arrayMode)
    916916{
    917     Instruction* currentInstruction = m_codeBlock->instructions().begin() + byValInfo->bytecodeIndex;
     917    Instruction* currentInstruction = &m_codeBlock->instructions()[byValInfo->bytecodeIndex];
    918918   
    919919    PatchableJump badType;
  • trunk/Source/JavaScriptCore/jit/JITPropertyAccess.cpp

    r229767 r229815  
    12231223void JIT::privateCompileGetByVal(ByValInfo* byValInfo, ReturnAddressPtr returnAddress, JITArrayMode arrayMode)
    12241224{
    1225     Instruction* currentInstruction = m_codeBlock->instructions().begin() + byValInfo->bytecodeIndex;
     1225    Instruction* currentInstruction = &m_codeBlock->instructions()[byValInfo->bytecodeIndex];
    12261226   
    12271227    PatchableJump badType;
     
    12751275void JIT::privateCompileGetByValWithCachedId(ByValInfo* byValInfo, ReturnAddressPtr returnAddress, const Identifier& propertyName)
    12761276{
    1277     Instruction* currentInstruction = m_codeBlock->instructions().begin() + byValInfo->bytecodeIndex;
     1277    Instruction* currentInstruction = &m_codeBlock->instructions()[byValInfo->bytecodeIndex];
    12781278
    12791279    Jump fastDoneCase;
     
    13081308void JIT::privateCompilePutByVal(ByValInfo* byValInfo, ReturnAddressPtr returnAddress, JITArrayMode arrayMode)
    13091309{
    1310     Instruction* currentInstruction = m_codeBlock->instructions().begin() + byValInfo->bytecodeIndex;
     1310    Instruction* currentInstruction = &m_codeBlock->instructions()[byValInfo->bytecodeIndex];
    13111311   
    13121312    PatchableJump badType;
     
    13671367void JIT::privateCompilePutByValWithCachedId(ByValInfo* byValInfo, ReturnAddressPtr returnAddress, PutKind putKind, const Identifier& propertyName)
    13681368{
    1369     Instruction* currentInstruction = m_codeBlock->instructions().begin() + byValInfo->bytecodeIndex;
     1369    Instruction* currentInstruction = &m_codeBlock->instructions()[byValInfo->bytecodeIndex];
    13701370
    13711371    JumpList doneCases;
  • trunk/Source/JavaScriptCore/jit/SlowPathCall.h

    r229767 r229815  
    4747#if ENABLE(OPCODE_SAMPLING)
    4848        if (m_jit->m_bytecodeOffset != std::numeric_limits<unsigned>::max())
    49             m_jit->sampleInstruction(m_jit->m_codeBlock->instructions().begin() + m_jit->m_bytecodeOffset, true);
     49            m_jit->sampleInstruction(&m_jit->m_codeBlock->instructions()[m_jit->m_bytecodeOffset], true);
    5050#endif
    5151        m_jit->updateTopCallFrame();
     
    7676#if ENABLE(OPCODE_SAMPLING)
    7777        if (m_jit->m_bytecodeOffset != std::numeric_limits<unsigned>::max())
    78             m_jit->sampleInstruction(m_jit->m_codeBlock->instructions().begin() + m_jit->m_bytecodeOffset, false);
     78            m_jit->sampleInstruction(&m_jit->m_codeBlock->instructions()[m_jit->m_bytecodeOffset], false);
    7979#endif
    8080       
  • trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp

    r229547 r229815  
    197197            exec->codeBlock(),
    198198            exec,
    199             static_cast<intptr_t>(pc - exec->codeBlock()->instructions().begin()),
     199            static_cast<intptr_t>(exec->codeBlock()->bytecodeOffset(pc)),
    200200            Interpreter::getOpcodeID(pc[0].u.opcode),
    201201            fromWhere,
     
    221221        exec->codeBlock(),
    222222        exec,
    223         static_cast<intptr_t>(pc - exec->codeBlock()->instructions().begin()),
     223        static_cast<intptr_t>(exec->codeBlock()->bytecodeOffset(pc)),
    224224        Interpreter::getOpcodeID(pc[0].u.opcode),
    225225        fromWhere,
     
    281281            exec->codeBlock(),
    282282            exec,
    283             static_cast<intptr_t>(pc - exec->codeBlock()->instructions().begin()),
     283            static_cast<intptr_t>(exec->codeBlock()->bytecodeOffset(pc)),
    284284            opcodeNames[opcodeID], pc);
    285285    if (opcodeID == op_enter) {
     
    300300            exec->codeBlock(),
    301301            exec,
    302             static_cast<intptr_t>(pc - exec->codeBlock()->instructions().begin()),
     302            static_cast<intptr_t>(exec->codeBlock()->bytecodeOffset(pc)),
    303303            Interpreter::getOpcodeID(pc[0].u.opcode),
    304304            exec->returnPC().value());
     
    430430    }
    431431   
    432     unsigned loopOSREntryBytecodeOffset = pc - codeBlock->instructions().begin();
     432    unsigned loopOSREntryBytecodeOffset = codeBlock->bytecodeOffset(pc);
    433433
    434434    if (!shouldJIT(codeBlock)) {
     
    440440        LLINT_RETURN_TWO(0, 0);
    441441   
    442     CODEBLOCK_LOG_EVENT(codeBlock, "osrEntry", ("at bc#", pc - codeBlock->instructions().begin()));
     442    CODEBLOCK_LOG_EVENT(codeBlock, "osrEntry", ("at bc#", loopOSREntryBytecodeOffset));
    443443
    444444    ASSERT(codeBlock->jitType() == JITCode::BaselineJIT);
     
    446446    Vector<BytecodeAndMachineOffset> map;
    447447    codeBlock->jitCodeMap()->decode(map);
    448     BytecodeAndMachineOffset* mapping = binarySearch<BytecodeAndMachineOffset, unsigned>(map, map.size(), pc - codeBlock->instructions().begin(), BytecodeAndMachineOffset::getBytecodeIndex);
     448    BytecodeAndMachineOffset* mapping = binarySearch<BytecodeAndMachineOffset, unsigned>(map, map.size(), loopOSREntryBytecodeOffset, BytecodeAndMachineOffset::getBytecodeIndex);
    449449    ASSERT(mapping);
    450     ASSERT(mapping->m_bytecodeIndex == static_cast<unsigned>(pc - codeBlock->instructions().begin()));
     450    ASSERT(mapping->m_bytecodeIndex == loopOSREntryBytecodeOffset);
    451451   
    452452    void* jumpTarget = codeBlock->jitCode()->executableAddressAtOffset(mapping->m_machineCodeOffset);
     
    715715        && ident == vm.propertyNames->length) {
    716716        pc[0].u.opcode = LLInt::getOpcode(op_get_array_length);
    717         ArrayProfile* arrayProfile = codeBlock->getOrAddArrayProfile(pc - codeBlock->instructions().begin());
     717        ArrayProfile* arrayProfile = codeBlock->getOrAddArrayProfile(codeBlock->bytecodeOffset(pc));
    718718        arrayProfile->observeStructure(baseValue.asCell()->structure());
    719719        pc[4].u.arrayProfile = arrayProfile;
  • trunk/Source/JavaScriptCore/runtime/SamplingProfiler.cpp

    r229174 r229815  
    436436#else
    437437    Instruction* instruction = bitwise_cast<Instruction*>(llintPC);
    438     if (instruction >= codeBlock->instructions().begin() && instruction < codeBlock->instructions().begin() + codeBlock->instructionCount()) {
     438    if (instruction >= codeBlock->instructions().begin() && instruction < codeBlock->instructions().end()) {
    439439        isValid = true;
    440         unsigned bytecodeIndex = instruction - codeBlock->instructions().begin();
    441         return bytecodeIndex;
     440        return codeBlock->bytecodeOffset(instruction);
    442441    }
    443442    isValid = false;
Note: See TracChangeset for help on using the changeset viewer.