Ignore:
Timestamp:
Jan 3, 2009, 10:19:44 PM (16 years ago)
Author:
[email protected]
Message:

2009-01-03 Sam Weinig <[email protected]>

Reviewed by Oliver Hunt.

Change the pcVector from storing native code pointers to storing offsets
from the base pointer. This will allow us to generate the pcVector on demand
for exceptions.

  • bytecode/CodeBlock.h: (JSC::PC::PC): (JSC::getNativePCOffset): (JSC::CodeBlock::getBytecodeIndex):
  • jit/JIT.cpp: (JSC::JIT::privateCompile):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/bytecode/CodeBlock.h

    r39366 r39577  
    152152
    153153    struct PC {
    154         PC(void* nativePC, unsigned bytecodeIndex)
    155             : nativePC(nativePC)
     154        PC(ptrdiff_t nativePCOffset, unsigned bytecodeIndex)
     155            : nativePCOffset(nativePCOffset)
    156156            , bytecodeIndex(bytecodeIndex)
    157157        {
    158158        }
    159        
    160         void* nativePC;
     159
     160        ptrdiff_t nativePCOffset;
    161161        unsigned bytecodeIndex;
    162162    };
     
    174174    }
    175175
    176     inline void* getNativePC(PC* pc)
     176    inline ptrdiff_t getNativePCOffset(PC* pc)
    177177    {
    178         return pc->nativePC;
     178        return pc->nativePCOffset;
    179179    }
    180180
     
    300300        unsigned getBytecodeIndex(void* nativePC)
    301301        {
    302             return binaryChop<PC, void*, getNativePC>(m_pcVector.begin(), m_pcVector.size(), nativePC)->bytecodeIndex;
     302            ptrdiff_t nativePCOffset = reinterpret_cast<void**>(nativePC) - reinterpret_cast<void**>(m_jitCode.code);
     303            return binaryChop<PC, ptrdiff_t, getNativePCOffset>(m_pcVector.begin(), m_pcVector.size(), nativePCOffset)->bytecodeIndex;
    303304        }
    304305
Note: See TracChangeset for help on using the changeset viewer.