Changeset 39577 in webkit for trunk/JavaScriptCore


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):
Location:
trunk/JavaScriptCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r39572 r39577  
     12009-01-03  Sam Weinig  <[email protected]>
     2
     3        Reviewed by Oliver Hunt.
     4
     5        Change the pcVector from storing native code pointers to storing offsets
     6        from the base pointer. This will allow us to generate the pcVector on demand
     7        for exceptions.
     8
     9        * bytecode/CodeBlock.h:
     10        (JSC::PC::PC):
     11        (JSC::getNativePCOffset):
     12        (JSC::CodeBlock::getBytecodeIndex):
     13        * jit/JIT.cpp:
     14        (JSC::JIT::privateCompile):
     15
    1162009-01-02  Oliver Hunt  <[email protected]>
    217
  • 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
  • trunk/JavaScriptCore/jit/JIT.cpp

    r39540 r39577  
    16391639        if (iter->to)
    16401640            patchBuffer.link(iter->from, iter->to);
    1641         m_codeBlock->pcVector().append(PC(patchBuffer.addressOf(iter->from), iter->bytecodeIndex));
     1641        m_codeBlock->pcVector().append(PC(reinterpret_cast<void**>(patchBuffer.addressOf(iter->from)) - reinterpret_cast<void**>(code), iter->bytecodeIndex));
    16421642    }
    16431643
Note: See TracChangeset for help on using the changeset viewer.