Changeset 44705 in webkit for trunk/JavaScriptCore


Ignore:
Timestamp:
Jun 15, 2009, 8:01:12 PM (16 years ago)
Author:
[email protected]
Message:

2009-06-15 Gavin Barraclough <[email protected]>

Reviewed by Sam Weinig.

Having introduced the RepatchBuffer, ProcessorReturnAddress is now a do-nothing
wrapper around ReturnAddressPtr. Remove it. In tugging on this piece of string
it made sense to roll out the use of ReturnAddressPtr a little further into
JITStubs (which had always been the intention).

No performance impact.

  • assembler/AbstractMacroAssembler.h: (JSC::AbstractMacroAssembler::RepatchBuffer::relinkCallerToTrampoline): (JSC::AbstractMacroAssembler::RepatchBuffer::relinkCallerToFunction): (JSC::AbstractMacroAssembler::RepatchBuffer::relinkNearCallerToTrampoline):
  • assembler/MacroAssemblerCodeRef.h: (JSC::ReturnAddressPtr::ReturnAddressPtr):
  • bytecode/CodeBlock.h: (JSC::CodeBlock::getStubInfo): (JSC::CodeBlock::getCallLinkInfo): (JSC::CodeBlock::getMethodCallLinkInfo): (JSC::CodeBlock::getBytecodeIndex):
  • interpreter/Interpreter.cpp: (JSC::bytecodeOffsetForPC):
  • jit/JIT.cpp: (JSC::ctiPatchNearCallByReturnAddress): (JSC::ctiPatchCallByReturnAddress):
  • jit/JIT.h: (JSC::JIT::compileGetByIdProto): (JSC::JIT::compileGetByIdChain): (JSC::JIT::compilePutByIdTransition): (JSC::JIT::compilePatchGetArrayLength):
  • jit/JITPropertyAccess.cpp: (JSC::JIT::privateCompilePutByIdTransition): (JSC::JIT::patchGetByIdSelf): (JSC::JIT::patchPutByIdReplace): (JSC::JIT::privateCompilePatchGetArrayLength): (JSC::JIT::privateCompileGetByIdProto): (JSC::JIT::privateCompileGetByIdChain):
  • jit/JITStubs.cpp: (JSC::JITThunks::tryCachePutByID): (JSC::JITThunks::tryCacheGetByID): (JSC::StackHack::StackHack): (JSC::returnToThrowTrampoline): (JSC::throwStackOverflowError): (JSC::JITStubs::DEFINE_STUB_FUNCTION):
  • jit/JITStubs.h: (JSC::): (JSC::JITStackFrame::returnAddressSlot):
  • runtime/JSGlobalData.h:
Location:
trunk/JavaScriptCore
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r44702 r44705  
     12009-06-15  Gavin Barraclough  <[email protected]>
     2
     3        Reviewed by Sam Weinig.
     4
     5        Having introduced the RepatchBuffer, ProcessorReturnAddress is now a do-nothing
     6        wrapper around ReturnAddressPtr.  Remove it.  In tugging on this piece of string
     7        it made sense to roll out the use of ReturnAddressPtr a little further into
     8        JITStubs (which had always been the intention).
     9
     10        No performance impact.
     11
     12        * assembler/AbstractMacroAssembler.h:
     13        (JSC::AbstractMacroAssembler::RepatchBuffer::relinkCallerToTrampoline):
     14        (JSC::AbstractMacroAssembler::RepatchBuffer::relinkCallerToFunction):
     15        (JSC::AbstractMacroAssembler::RepatchBuffer::relinkNearCallerToTrampoline):
     16        * assembler/MacroAssemblerCodeRef.h:
     17        (JSC::ReturnAddressPtr::ReturnAddressPtr):
     18        * bytecode/CodeBlock.h:
     19        (JSC::CodeBlock::getStubInfo):
     20        (JSC::CodeBlock::getCallLinkInfo):
     21        (JSC::CodeBlock::getMethodCallLinkInfo):
     22        (JSC::CodeBlock::getBytecodeIndex):
     23        * interpreter/Interpreter.cpp:
     24        (JSC::bytecodeOffsetForPC):
     25        * jit/JIT.cpp:
     26        (JSC::ctiPatchNearCallByReturnAddress):
     27        (JSC::ctiPatchCallByReturnAddress):
     28        * jit/JIT.h:
     29        (JSC::JIT::compileGetByIdProto):
     30        (JSC::JIT::compileGetByIdChain):
     31        (JSC::JIT::compilePutByIdTransition):
     32        (JSC::JIT::compilePatchGetArrayLength):
     33        * jit/JITPropertyAccess.cpp:
     34        (JSC::JIT::privateCompilePutByIdTransition):
     35        (JSC::JIT::patchGetByIdSelf):
     36        (JSC::JIT::patchPutByIdReplace):
     37        (JSC::JIT::privateCompilePatchGetArrayLength):
     38        (JSC::JIT::privateCompileGetByIdProto):
     39        (JSC::JIT::privateCompileGetByIdChain):
     40        * jit/JITStubs.cpp:
     41        (JSC::JITThunks::tryCachePutByID):
     42        (JSC::JITThunks::tryCacheGetByID):
     43        (JSC::StackHack::StackHack):
     44        (JSC::returnToThrowTrampoline):
     45        (JSC::throwStackOverflowError):
     46        (JSC::JITStubs::DEFINE_STUB_FUNCTION):
     47        * jit/JITStubs.h:
     48        (JSC::):
     49        (JSC::JITStackFrame::returnAddressSlot):
     50        * runtime/JSGlobalData.h:
     51
    1522009-06-15  Simon Fraser  <[email protected]>
    253
  • trunk/JavaScriptCore/assembler/AbstractMacroAssembler.h

    r44700 r44705  
    5858    class CodeLocationDataLabel32;
    5959    class CodeLocationDataLabelPtr;
    60     class ProcessorReturnAddress;
    6160
    6261    typedef typename AssemblerType::RegisterID RegisterID;
     
    493492        friend class PatchBuffer;
    494493        friend class RepatchBuffer;
    495         friend class ProcessorReturnAddress;
    496494
    497495    public:
     
    628626        {
    629627        }
    630     };
    631 
    632     // ProcessorReturnAddress:
    633     //
    634     // This class can be used to relink a call identified by its return address.
    635     class ProcessorReturnAddress {
    636     public:
    637         ProcessorReturnAddress(void* location)
    638             : m_location(location)
    639         {
    640         }
    641 
    642         void* addressForLookup()
    643         {
    644             return m_location.value();
    645         }
    646 
    647         ReturnAddressPtr m_location;
    648628    };
    649629
     
    863843        }
    864844
    865         void relinkCallerToTrampoline(ProcessorReturnAddress returnAddress, CodeLocationLabel label)
    866         {
    867             relink(CodeLocationCall(CodePtr(returnAddress.m_location)), label);
    868         }
    869        
    870         void relinkCallerToTrampoline(ProcessorReturnAddress returnAddress, CodePtr newCalleeFunction)
     845        void relinkCallerToTrampoline(ReturnAddressPtr returnAddress, CodeLocationLabel label)
     846        {
     847            relink(CodeLocationCall(CodePtr(returnAddress)), label);
     848        }
     849       
     850        void relinkCallerToTrampoline(ReturnAddressPtr returnAddress, CodePtr newCalleeFunction)
    871851        {
    872852            relinkCallerToTrampoline(returnAddress, CodeLocationLabel(newCalleeFunction));
    873853        }
    874854
    875         void relinkCallerToFunction(ProcessorReturnAddress returnAddress, FunctionPtr function)
    876         {
    877             relink(CodeLocationCall(CodePtr(returnAddress.m_location)), function);
    878         }
    879        
    880         void relinkNearCallerToTrampoline(ProcessorReturnAddress returnAddress, CodeLocationLabel label)
    881         {
    882             relink(CodeLocationNearCall(CodePtr(returnAddress.m_location)), label);
    883         }
    884        
    885         void relinkNearCallerToTrampoline(ProcessorReturnAddress returnAddress, CodePtr newCalleeFunction)
     855        void relinkCallerToFunction(ReturnAddressPtr returnAddress, FunctionPtr function)
     856        {
     857            relink(CodeLocationCall(CodePtr(returnAddress)), function);
     858        }
     859       
     860        void relinkNearCallerToTrampoline(ReturnAddressPtr returnAddress, CodeLocationLabel label)
     861        {
     862            relink(CodeLocationNearCall(CodePtr(returnAddress)), label);
     863        }
     864       
     865        void relinkNearCallerToTrampoline(ReturnAddressPtr returnAddress, CodePtr newCalleeFunction)
    886866        {
    887867            relinkNearCallerToTrampoline(returnAddress, CodeLocationLabel(newCalleeFunction));
  • trunk/JavaScriptCore/assembler/MacroAssemblerCodeRef.h

    r44514 r44705  
    9999    }
    100100
     101    explicit ReturnAddressPtr(FunctionPtr function)
     102        : m_value(function.value())
     103    {
     104        ASSERT_VALID_CODE_POINTER(m_value);
     105    }
     106
    101107    void* value() const { return m_value; }
    102108
  • trunk/JavaScriptCore/bytecode/CodeBlock.h

    r44693 r44705  
    287287        }
    288288
    289         StructureStubInfo& getStubInfo(void* returnAddress)
    290         {
    291             return *(binaryChop<StructureStubInfo, void*, getStructureStubInfoReturnLocation>(m_structureStubInfos.begin(), m_structureStubInfos.size(), returnAddress));
    292         }
    293 
    294         CallLinkInfo& getCallLinkInfo(void* returnAddress)
    295         {
    296             return *(binaryChop<CallLinkInfo, void*, getCallLinkInfoReturnLocation>(m_callLinkInfos.begin(), m_callLinkInfos.size(), returnAddress));
    297         }
    298 
    299         MethodCallLinkInfo& getMethodCallLinkInfo(void* returnAddress)
    300         {
    301             return *(binaryChop<MethodCallLinkInfo, void*, getMethodCallLinkInfoReturnLocation>(m_methodCallLinkInfos.begin(), m_methodCallLinkInfos.size(), returnAddress));
    302         }
    303 
    304         unsigned getBytecodeIndex(CallFrame* callFrame, void* nativePC)
     289        StructureStubInfo& getStubInfo(ReturnAddressPtr returnAddress)
     290        {
     291            return *(binaryChop<StructureStubInfo, void*, getStructureStubInfoReturnLocation>(m_structureStubInfos.begin(), m_structureStubInfos.size(), returnAddress.value()));
     292        }
     293
     294        CallLinkInfo& getCallLinkInfo(ReturnAddressPtr returnAddress)
     295        {
     296            return *(binaryChop<CallLinkInfo, void*, getCallLinkInfoReturnLocation>(m_callLinkInfos.begin(), m_callLinkInfos.size(), returnAddress.value()));
     297        }
     298
     299        MethodCallLinkInfo& getMethodCallLinkInfo(ReturnAddressPtr returnAddress)
     300        {
     301            return *(binaryChop<MethodCallLinkInfo, void*, getMethodCallLinkInfoReturnLocation>(m_methodCallLinkInfos.begin(), m_methodCallLinkInfos.size(), returnAddress.value()));
     302        }
     303
     304        unsigned getBytecodeIndex(CallFrame* callFrame, ReturnAddressPtr returnAddress)
    305305        {
    306306            reparseForExceptionInfoIfNecessary(callFrame);
    307             return binaryChop<CallReturnOffsetToBytecodeIndex, unsigned, getCallReturnOffset>(m_exceptionInfo->m_callReturnIndexVector.begin(), m_exceptionInfo->m_callReturnIndexVector.size(), ownerNode()->generatedJITCode().offsetOf(nativePC))->bytecodeIndex;
     307            return binaryChop<CallReturnOffsetToBytecodeIndex, unsigned, getCallReturnOffset>(m_exceptionInfo->m_callReturnIndexVector.begin(), m_exceptionInfo->m_callReturnIndexVector.size(), ownerNode()->generatedJITCode().offsetOf(returnAddress.value()))->bytecodeIndex;
    308308        }
    309309       
  • trunk/JavaScriptCore/interpreter/Interpreter.cpp

    r44088 r44705  
    7777{
    7878#if ENABLE(JIT)
    79     return codeBlock->getBytecodeIndex(callFrame, pc);
     79    return codeBlock->getBytecodeIndex(callFrame, ReturnAddressPtr(pc));
    8080#else
    8181    UNUSED_PARAM(callFrame);
  • trunk/JavaScriptCore/jit/JIT.cpp

    r44700 r44705  
    4747namespace JSC {
    4848
    49 void ctiPatchNearCallByReturnAddress(MacroAssembler::ProcessorReturnAddress returnAddress, MacroAssemblerCodePtr newCalleeFunction)
     49void ctiPatchNearCallByReturnAddress(ReturnAddressPtr returnAddress, MacroAssemblerCodePtr newCalleeFunction)
    5050{
    5151    MacroAssembler::RepatchBuffer repatchBuffer;
     
    5353}
    5454
    55 void ctiPatchCallByReturnAddress(MacroAssembler::ProcessorReturnAddress returnAddress, MacroAssemblerCodePtr newCalleeFunction)
     55void ctiPatchCallByReturnAddress(ReturnAddressPtr returnAddress, MacroAssemblerCodePtr newCalleeFunction)
    5656{
    5757    MacroAssembler::RepatchBuffer repatchBuffer;
     
    5959}
    6060
    61 void ctiPatchCallByReturnAddress(MacroAssembler::ProcessorReturnAddress returnAddress, FunctionPtr newCalleeFunction)
     61void ctiPatchCallByReturnAddress(ReturnAddressPtr returnAddress, FunctionPtr newCalleeFunction)
    6262{
    6363    MacroAssembler::RepatchBuffer repatchBuffer;
  • trunk/JavaScriptCore/jit/JIT.h

    r44693 r44705  
    167167
    168168    // Near calls can only be patched to other JIT code, regular calls can be patched to JIT code or relinked to stub functions.
    169     void ctiPatchNearCallByReturnAddress(MacroAssembler::ProcessorReturnAddress returnAddress, MacroAssemblerCodePtr newCalleeFunction);
    170     void ctiPatchCallByReturnAddress(MacroAssembler::ProcessorReturnAddress returnAddress, MacroAssemblerCodePtr newCalleeFunction);
    171     void ctiPatchCallByReturnAddress(MacroAssembler::ProcessorReturnAddress returnAddress, FunctionPtr newCalleeFunction);
     169    void ctiPatchNearCallByReturnAddress(ReturnAddressPtr returnAddress, MacroAssemblerCodePtr newCalleeFunction);
     170    void ctiPatchCallByReturnAddress(ReturnAddressPtr returnAddress, MacroAssemblerCodePtr newCalleeFunction);
     171    void ctiPatchCallByReturnAddress(ReturnAddressPtr returnAddress, FunctionPtr newCalleeFunction);
    172172
    173173    class JIT : private MacroAssembler {
     
    335335        }
    336336
    337         static void compileGetByIdProto(JSGlobalData* globalData, CallFrame* callFrame, CodeBlock* codeBlock, StructureStubInfo* stubInfo, Structure* structure, Structure* prototypeStructure, size_t cachedOffset, ProcessorReturnAddress returnAddress)
     337        static void compileGetByIdProto(JSGlobalData* globalData, CallFrame* callFrame, CodeBlock* codeBlock, StructureStubInfo* stubInfo, Structure* structure, Structure* prototypeStructure, size_t cachedOffset, ReturnAddressPtr returnAddress)
    338338        {
    339339            JIT jit(globalData, codeBlock);
     
    357357        }
    358358
    359         static void compileGetByIdChain(JSGlobalData* globalData, CallFrame* callFrame, CodeBlock* codeBlock, StructureStubInfo* stubInfo, Structure* structure, StructureChain* chain, size_t count, size_t cachedOffset, ProcessorReturnAddress returnAddress)
     359        static void compileGetByIdChain(JSGlobalData* globalData, CallFrame* callFrame, CodeBlock* codeBlock, StructureStubInfo* stubInfo, Structure* structure, StructureChain* chain, size_t count, size_t cachedOffset, ReturnAddressPtr returnAddress)
    360360        {
    361361            JIT jit(globalData, codeBlock);
     
    363363        }
    364364       
    365         static void compilePutByIdTransition(JSGlobalData* globalData, CodeBlock* codeBlock, StructureStubInfo* stubInfo, Structure* oldStructure, Structure* newStructure, size_t cachedOffset, StructureChain* chain, ProcessorReturnAddress returnAddress)
     365        static void compilePutByIdTransition(JSGlobalData* globalData, CodeBlock* codeBlock, StructureStubInfo* stubInfo, Structure* oldStructure, Structure* newStructure, size_t cachedOffset, StructureChain* chain, ReturnAddressPtr returnAddress)
    366366        {
    367367            JIT jit(globalData, codeBlock);
     
    375375        }
    376376
    377         static void patchGetByIdSelf(StructureStubInfo*, Structure*, size_t cachedOffset, ProcessorReturnAddress returnAddress);
    378         static void patchPutByIdReplace(StructureStubInfo*, Structure*, size_t cachedOffset, ProcessorReturnAddress returnAddress);
     377        static void patchGetByIdSelf(StructureStubInfo*, Structure*, size_t cachedOffset, ReturnAddressPtr returnAddress);
     378        static void patchPutByIdReplace(StructureStubInfo*, Structure*, size_t cachedOffset, ReturnAddressPtr returnAddress);
    379379        static void patchMethodCallProto(MethodCallLinkInfo&, JSFunction*, Structure*, JSObject*);
    380380
    381         static void compilePatchGetArrayLength(JSGlobalData* globalData, CodeBlock* codeBlock, ProcessorReturnAddress returnAddress)
     381        static void compilePatchGetArrayLength(JSGlobalData* globalData, CodeBlock* codeBlock, ReturnAddressPtr returnAddress)
    382382        {
    383383            JIT jit(globalData, codeBlock);
     
    406406        void privateCompileSlowCases();
    407407        void privateCompile();
    408         void privateCompileGetByIdProto(StructureStubInfo*, Structure*, Structure* prototypeStructure, size_t cachedOffset, ProcessorReturnAddress returnAddress, CallFrame* callFrame);
     408        void privateCompileGetByIdProto(StructureStubInfo*, Structure*, Structure* prototypeStructure, size_t cachedOffset, ReturnAddressPtr returnAddress, CallFrame* callFrame);
    409409        void privateCompileGetByIdSelfList(StructureStubInfo*, PolymorphicAccessStructureList*, int, Structure*, size_t cachedOffset);
    410410        void privateCompileGetByIdProtoList(StructureStubInfo*, PolymorphicAccessStructureList*, int, Structure*, Structure* prototypeStructure, size_t cachedOffset, CallFrame* callFrame);
    411411        void privateCompileGetByIdChainList(StructureStubInfo*, PolymorphicAccessStructureList*, int, Structure*, StructureChain* chain, size_t count, size_t cachedOffset, CallFrame* callFrame);
    412         void privateCompileGetByIdChain(StructureStubInfo*, Structure*, StructureChain*, size_t count, size_t cachedOffset, ProcessorReturnAddress returnAddress, CallFrame* callFrame);
    413         void privateCompilePutByIdTransition(StructureStubInfo*, Structure*, Structure*, size_t cachedOffset, StructureChain*, ProcessorReturnAddress returnAddress);
     412        void privateCompileGetByIdChain(StructureStubInfo*, Structure*, StructureChain*, size_t count, size_t cachedOffset, ReturnAddressPtr returnAddress, CallFrame* callFrame);
     413        void privateCompilePutByIdTransition(StructureStubInfo*, Structure*, Structure*, size_t cachedOffset, StructureChain*, ReturnAddressPtr returnAddress);
    414414
    415415        void privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executablePool, JSGlobalData* data, CodePtr* ctiArrayLengthTrampoline, CodePtr* ctiStringLengthTrampoline, CodePtr* ctiVirtualCallPreLink, CodePtr* ctiVirtualCallLink, CodePtr* ctiVirtualCall, CodePtr* ctiNativeCallThunk);
    416         void privateCompilePatchGetArrayLength(ProcessorReturnAddress returnAddress);
     416        void privateCompilePatchGetArrayLength(ReturnAddressPtr returnAddress);
    417417
    418418        void addSlowCase(Jump);
  • trunk/JavaScriptCore/jit/JITPropertyAccess.cpp

    r44700 r44705  
    422422}
    423423
    424 void JIT::privateCompilePutByIdTransition(StructureStubInfo* stubInfo, Structure* oldStructure, Structure* newStructure, size_t cachedOffset, StructureChain* chain, ProcessorReturnAddress returnAddress)
     424void JIT::privateCompilePutByIdTransition(StructureStubInfo* stubInfo, Structure* oldStructure, Structure* newStructure, size_t cachedOffset, StructureChain* chain, ReturnAddressPtr returnAddress)
    425425{
    426426    JumpList failureCases;
     
    503503}
    504504
    505 void JIT::patchGetByIdSelf(StructureStubInfo* stubInfo, Structure* structure, size_t cachedOffset, ProcessorReturnAddress returnAddress)
     505void JIT::patchGetByIdSelf(StructureStubInfo* stubInfo, Structure* structure, size_t cachedOffset, ReturnAddressPtr returnAddress)
    506506{
    507507    RepatchBuffer repatchBuffer;
     
    537537}
    538538
    539 void JIT::patchPutByIdReplace(StructureStubInfo* stubInfo, Structure* structure, size_t cachedOffset, ProcessorReturnAddress returnAddress)
     539void JIT::patchPutByIdReplace(StructureStubInfo* stubInfo, Structure* structure, size_t cachedOffset, ReturnAddressPtr returnAddress)
    540540{
    541541    RepatchBuffer repatchBuffer;
     
    557557}
    558558
    559 void JIT::privateCompilePatchGetArrayLength(ProcessorReturnAddress returnAddress)
    560 {
    561     StructureStubInfo* stubInfo = &m_codeBlock->getStubInfo(returnAddress.addressForLookup());
     559void JIT::privateCompilePatchGetArrayLength(ReturnAddressPtr returnAddress)
     560{
     561    StructureStubInfo* stubInfo = &m_codeBlock->getStubInfo(returnAddress);
    562562
    563563    // Check eax is an array
     
    596596}
    597597
    598 void JIT::privateCompileGetByIdProto(StructureStubInfo* stubInfo, Structure* structure, Structure* prototypeStructure, size_t cachedOffset, ProcessorReturnAddress returnAddress, CallFrame* callFrame)
     598void JIT::privateCompileGetByIdProto(StructureStubInfo* stubInfo, Structure* structure, Structure* prototypeStructure, size_t cachedOffset, ReturnAddressPtr returnAddress, CallFrame* callFrame)
    599599{
    600600    // The prototype object definitely exists (if this stub exists the CodeBlock is referencing a Structure that is
     
    770770}
    771771
    772 void JIT::privateCompileGetByIdChain(StructureStubInfo* stubInfo, Structure* structure, StructureChain* chain, size_t count, size_t cachedOffset, ProcessorReturnAddress returnAddress, CallFrame* callFrame)
     772void JIT::privateCompileGetByIdChain(StructureStubInfo* stubInfo, Structure* structure, StructureChain* chain, size_t count, size_t cachedOffset, ReturnAddressPtr returnAddress, CallFrame* callFrame)
    773773{
    774774    ASSERT(count);
  • trunk/JavaScriptCore/jit/JITStubs.cpp

    r44693 r44705  
    323323#if ENABLE(JIT_OPTIMIZE_PROPERTY_ACCESS)
    324324
    325 NEVER_INLINE void JITThunks::tryCachePutByID(CallFrame* callFrame, CodeBlock* codeBlock, void* returnAddress, JSValue baseValue, const PutPropertySlot& slot)
     325NEVER_INLINE void JITThunks::tryCachePutByID(CallFrame* callFrame, CodeBlock* codeBlock, ReturnAddressPtr returnAddress, JSValue baseValue, const PutPropertySlot& slot)
    326326{
    327327    // The interpreter checks for recursion here; I do not believe this can occur in CTI.
     
    367367}
    368368
    369 NEVER_INLINE void JITThunks::tryCacheGetByID(CallFrame* callFrame, CodeBlock* codeBlock, void* returnAddress, JSValue baseValue, const Identifier& propertyName, const PropertySlot& slot)
     369NEVER_INLINE void JITThunks::tryCacheGetByID(CallFrame* callFrame, CodeBlock* codeBlock, ReturnAddressPtr returnAddress, JSValue baseValue, const Identifier& propertyName, const PropertySlot& slot)
    370370{
    371371    // FIXME: Write a test that proves we need to check for recursion here just
     
    474474        , savedReturnAddress(*stackFrame.returnAddressSlot())
    475475    {
    476         *stackFrame.returnAddressSlot() = reinterpret_cast<void*>(jscGeneratedNativeCode);
     476        *stackFrame.returnAddressSlot() = ReturnAddressPtr(FunctionPtr(jscGeneratedNativeCode));
    477477    }
    478478
     
    483483
    484484    JITStackFrame& stackFrame;
    485     void* savedReturnAddress;
     485    ReturnAddressPtr savedReturnAddress;
    486486};
    487487
    488488#define STUB_INIT_STACK_FRAME(stackFrame) SETUP_VA_LISTL_ARGS; JITStackFrame& stackFrame = *reinterpret_cast<JITStackFrame*>(STUB_ARGS); StackHack stackHack(stackFrame)
    489 #define STUB_SET_RETURN_ADDRESS(returnAddress) stackHack.savedReturnAddress = returnAddress
     489#define STUB_SET_RETURN_ADDRESS(returnAddress) stackHack.savedReturnAddress = ReturnAddressPtr(returnAddress)
    490490#define STUB_RETURN_ADDRESS stackHack.savedReturnAddress
    491491
     
    493493
    494494#define STUB_INIT_STACK_FRAME(stackFrame) SETUP_VA_LISTL_ARGS; JITStackFrame& stackFrame = *reinterpret_cast<JITStackFrame*>(STUB_ARGS)
    495 #define STUB_SET_RETURN_ADDRESS(returnAddress) *stackFrame.returnAddressSlot() = returnAddress
     495#define STUB_SET_RETURN_ADDRESS(returnAddress) *stackFrame.returnAddressSlot() = ReturnAddressPtr(returnAddress)
    496496#define STUB_RETURN_ADDRESS *stackFrame.returnAddressSlot()
    497497
     
    502502// good to keep the code size down by leaving as much of the exception
    503503// handling code out of line as possible.
    504 static NEVER_INLINE void returnToThrowTrampoline(JSGlobalData* globalData, void* exceptionLocation, void*& returnAddressSlot)
     504static NEVER_INLINE void returnToThrowTrampoline(JSGlobalData* globalData, ReturnAddressPtr exceptionLocation, ReturnAddressPtr& returnAddressSlot)
    505505{
    506506    ASSERT(globalData->exception);
    507507    globalData->exceptionLocation = exceptionLocation;
    508     returnAddressSlot = reinterpret_cast<void*>(ctiVMThrowTrampoline);
    509 }
    510 
    511 static NEVER_INLINE void throwStackOverflowError(CallFrame* callFrame, JSGlobalData* globalData, void* exceptionLocation, void*& returnAddressSlot)
     508    returnAddressSlot = ReturnAddressPtr(FunctionPtr(ctiVMThrowTrampoline));
     509}
     510
     511static NEVER_INLINE void throwStackOverflowError(CallFrame* callFrame, JSGlobalData* globalData, ReturnAddressPtr exceptionLocation, ReturnAddressPtr& returnAddressSlot)
    512512{
    513513    globalData->exception = createStackOverflowError(callFrame);
     
    673673    CallFrame* oldCallFrame = stackFrame.callFrame->callerFrame();
    674674    stackFrame.callFrame = oldCallFrame;
    675     throwStackOverflowError(oldCallFrame, stackFrame.globalData, oldCallFrame->returnPC(), STUB_RETURN_ADDRESS);
     675    throwStackOverflowError(oldCallFrame, stackFrame.globalData, ReturnAddressPtr(oldCallFrame->returnPC()), STUB_RETURN_ADDRESS);
    676676}
    677677
     
    12791279        CallFrame* callFrame = CallFrame::create(previousCallFrame->registers() + registerOffset);
    12801280
    1281         callFrame->init(0, static_cast<Instruction*>(STUB_RETURN_ADDRESS), previousCallFrame->scopeChain(), previousCallFrame, 0, argCount, 0);
     1281        callFrame->init(0, static_cast<Instruction*>((STUB_RETURN_ADDRESS).value()), previousCallFrame->scopeChain(), previousCallFrame, 0, argCount, 0);
    12821282        stackFrame.callFrame = callFrame;
    12831283
  • trunk/JavaScriptCore/jit/JITStubs.h

    r44523 r44705  
    6969        RegExp* regExp() { return static_cast<RegExp*>(asPointer); }
    7070        JSPropertyNameIterator* propertyNameIterator() { return static_cast<JSPropertyNameIterator*>(asPointer); }
    71         void* returnAddress() { return asPointer; }
     71        ReturnAddressPtr returnAddress() { return ReturnAddressPtr(asPointer); }
    7272    };
    7373
     
    9393
    9494        // When JIT code makes a call, it pushes its return address just below the rest of the stack.
    95         void** returnAddressSlot() { return reinterpret_cast<void**>(this) - 1; }
     95        ReturnAddressPtr* returnAddressSlot() { return reinterpret_cast<ReturnAddressPtr*>(this) - 1; }
    9696    };
    9797#elif PLATFORM(X86)
     
    114114       
    115115        // When JIT code makes a call, it pushes its return address just below the rest of the stack.
    116         void** returnAddressSlot() { return reinterpret_cast<void**>(this) - 1; }
     116        ReturnAddressPtr* returnAddressSlot() { return reinterpret_cast<ReturnAddressPtr*>(this) - 1; }
    117117    };
    118118#elif PLATFORM(ARM_V7)
     
    121121        JITStubArg args[6];
    122122
    123         void* thunkReturnAddress;
     123        ReturnAddressPtr thunkReturnAddress;
    124124
    125125        void* preservedReturnAddress;
     
    137137        JSGlobalData* globalData;
    138138       
    139         void** returnAddressSlot() { return &thunkReturnAddress; }
     139        ReturnAddressPtr* returnAddressSlot() { return &thunkReturnAddress; }
    140140    };
    141141#else
     
    196196        JITThunks(JSGlobalData*);
    197197
    198         static void tryCacheGetByID(CallFrame*, CodeBlock*, void* returnAddress, JSValue baseValue, const Identifier& propertyName, const PropertySlot&);
    199         static void tryCachePutByID(CallFrame*, CodeBlock*, void* returnAddress, JSValue baseValue, const PutPropertySlot&);
     198        static void tryCacheGetByID(CallFrame*, CodeBlock*, ReturnAddressPtr returnAddress, JSValue baseValue, const Identifier& propertyName, const PropertySlot&);
     199        static void tryCachePutByID(CallFrame*, CodeBlock*, ReturnAddressPtr returnAddress, JSValue baseValue, const PutPropertySlot&);
    200200       
    201201        MacroAssemblerCodePtr ctiArrayLengthTrampoline() { return m_ctiArrayLengthTrampoline; }
  • trunk/JavaScriptCore/runtime/JSGlobalData.h

    r44550 r44705  
    132132        JSValue exception;
    133133#if ENABLE(JIT)
    134         void* exceptionLocation;
     134        ReturnAddressPtr exceptionLocation;
    135135#endif
    136136
Note: See TracChangeset for help on using the changeset viewer.