Changeset 160745 in webkit


Ignore:
Timestamp:
Dec 17, 2013, 7:38:14 PM (12 years ago)
Author:
mark.lam@apple.com
Message:

frameRegisterCount() should include maxFrameExtentForSlowPathCall.
https://bugs.webkit.org/show_bug.cgi?id=125881.

Reviewed by Geoffrey Garen, Michael Saboff, and Filip Pizlo.

  • assembler/MaxFrameExtentForSlowPathCall.h:
  • Added CallerFrameAndPCSize to all the maxFrameExtentForSlowPathCall values.
  • bytecode/VirtualRegister.h:

(JSC::VirtualRegister::offsetInBytes):

  • dfg/DFGGraph.cpp:

(JSC::DFG::Graph::frameRegisterCount):

  • jit/JIT.cpp:

(JSC::JIT::privateCompile):
(JSC::JIT::frameRegisterCountFor):

  • jit/JIT.h:
  • jit/JITOpcodes.cpp:

(JSC::JIT::emit_op_catch):

  • jit/JITOpcodes32_64.cpp:

(JSC::JIT::emit_op_catch):

  • llint/LLIntData.cpp:

(JSC::LLInt::Data::performAssertions):

  • Adjusted maxFrameExtentForSlowPathCall values for CallerFrameAndPCSize.
  • llint/LLIntEntrypoint.cpp:

(JSC::LLInt::frameRegisterCountFor):

  • llint/LowLevelInterpreter.asm:
  • Adjusted maxFrameExtentForSlowPathCall values for CallerFrameAndPCSize.
Location:
branches/jsCStack/Source/JavaScriptCore
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • branches/jsCStack/Source/JavaScriptCore/ChangeLog

    r160730 r160745  
     12013-12-17  Mark Lam  <mark.lam@apple.com>
     2
     3        frameRegisterCount() should include maxFrameExtentForSlowPathCall.
     4        https://bugs.webkit.org/show_bug.cgi?id=125881.
     5
     6        Reviewed by Geoffrey Garen, Michael Saboff, and Filip Pizlo.
     7
     8        * assembler/MaxFrameExtentForSlowPathCall.h:
     9        - Added CallerFrameAndPCSize to all the maxFrameExtentForSlowPathCall values.
     10        * bytecode/VirtualRegister.h:
     11        (JSC::VirtualRegister::offsetInBytes):
     12        * dfg/DFGGraph.cpp:
     13        (JSC::DFG::Graph::frameRegisterCount):
     14        * jit/JIT.cpp:
     15        (JSC::JIT::privateCompile):
     16        (JSC::JIT::frameRegisterCountFor):
     17        * jit/JIT.h:
     18        * jit/JITOpcodes.cpp:
     19        (JSC::JIT::emit_op_catch):
     20        * jit/JITOpcodes32_64.cpp:
     21        (JSC::JIT::emit_op_catch):
     22        * llint/LLIntData.cpp:
     23        (JSC::LLInt::Data::performAssertions):
     24        - Adjusted maxFrameExtentForSlowPathCall values for CallerFrameAndPCSize.
     25        * llint/LLIntEntrypoint.cpp:
     26        (JSC::LLInt::frameRegisterCountFor):
     27        * llint/LowLevelInterpreter.asm:
     28        - Adjusted maxFrameExtentForSlowPathCall values for CallerFrameAndPCSize.
     29
    1302013-12-17  Mark Lam  <mark.lam@apple.com>
    231
  • branches/jsCStack/Source/JavaScriptCore/assembler/MaxFrameExtentForSlowPathCall.h

    r160730 r160745  
    3636// from JS code.
    3737
     38// We also need to add space to account for CallerFrameAndPCSize (2 pointers)
     39// and pad the sum up to a multiple of stackAlignmentBytes().
     40
    3841#if ENABLE(LLINT_C_LOOP)
    3942static const size_t maxFrameExtentForSlowPathCall = 0;
    4043
    4144#elif CPU(X86_64) && OS(WINDOWS)
    42 // 4 args in registers, but stack space needs to be allocated for all args.
    43 static const size_t maxFrameExtentForSlowPathCall = 48;
     45// 4 args in registers, but stack space needs to be allocated for all args,
     46// plus 16 bytes for CallerFrameAndPCSize.
     47static const size_t maxFrameExtentForSlowPathCall = 64;
    4448
    4549#elif CPU(X86_64)
    46 // All args in registers.
    47 static const size_t maxFrameExtentForSlowPathCall = 0;
     50// All args in registers, plus 16 bytes for CallerFrameAndPCSize.
     51static const size_t maxFrameExtentForSlowPathCall = 16;
    4852
    4953#elif CPU(X86)
    50 // 6 args on stack (24 bytes) + 8 bytes to align the stack.
     54// 6 args on stack (24 bytes) plus 8 bytes for CallerFrameAndPCSize.
    5155static const size_t maxFrameExtentForSlowPathCall = 32;
    5256
    5357#elif CPU(ARM64)
    54 // All args in registers.
    55 static const size_t maxFrameExtentForSlowPathCall = 0;
     58// All args in registers, plus 16 bytes for CallerFrameAndPCSize.
     59static const size_t maxFrameExtentForSlowPathCall = 16;
    5660
    5761#elif CPU(ARM)
    58 // First four args in registers, remaining 4 args on stack.
    59 static const size_t maxFrameExtentForSlowPathCall = 16;
     62// First four args in registers, remaining 4 args on stack,
     63// plus 8 byte for CallerFrameAndPCSize and 8 bytes padding.
     64static const size_t maxFrameExtentForSlowPathCall = 32;
    6065
    6166#elif CPU(SH4)
    62 // First four args in registers, remaining 4 args on stack.
    63 static const size_t maxFrameExtentForSlowPathCall = 16;
     67// First four args in registers, remaining 4 args on stack,
     68// plus 8 byte for CallerFrameAndPCSize and 8 bytes padding.
     69static const size_t maxFrameExtentForSlowPathCall = 32;
    6470
    6571#elif CPU(MIPS)
    66 // Though args are in registers, there need to be space on the stack for all args.
    67 static const size_t maxFrameExtentForSlowPathCall = 32;
     72// Though args are in registers, there need to be space on the stack for all args,
     73// plus 8 bytes CallerFrameAndPCSize and 8 bytes padding.
     74static const size_t maxFrameExtentForSlowPathCall = 48;
    6875
    6976#else
  • branches/jsCStack/Source/JavaScriptCore/bytecode/VirtualRegister.h

    r158237 r160745  
    6666    int toConstantIndex() const { ASSERT(isConstant()); return m_virtualRegister - s_firstConstantRegisterIndex; }
    6767    int offset() const { return m_virtualRegister; }
     68    int offsetInBytes() const { return m_virtualRegister * sizeof(Register); }
    6869
    6970    bool operator==(const VirtualRegister other) const { return m_virtualRegister == other.m_virtualRegister; }
  • branches/jsCStack/Source/JavaScriptCore/dfg/DFGGraph.cpp

    r160562 r160745  
    3737#include "JIT.h"
    3838#include "JSActivation.h"
     39#include "MaxFrameExtentForSlowPathCall.h"
    3940#include "OperandsInlines.h"
    4041#include "Operations.h"
     
    705706unsigned Graph::frameRegisterCount()
    706707{
    707     unsigned result = m_nextMachineLocal + std::max(m_parameterSlots, static_cast<unsigned>(JSStack::CallerFrameAndPCSize));
     708    unsigned result = m_nextMachineLocal + std::max(m_parameterSlots, static_cast<unsigned>(maxFrameExtentForSlowPathCallInRegisters));
    708709    result = WTF::roundUpToMultipleOf(stackAlignmentRegisters(), result);
    709710    return result;
  • branches/jsCStack/Source/JavaScriptCore/jit/JIT.cpp

    r160527 r160745  
    4949#include "SamplingTool.h"
    5050#include "SlowPathCall.h"
     51#include "StackAlignment.h"
    5152#include <wtf/CryptographicallyRandomNumber.h>
    5253
     
    540541#endif
    541542
    542         addPtr(TrustedImm32(virtualRegisterForLocal(frameRegisterCountFor(m_codeBlock) - 1).offset() * sizeof(Register) - maxFrameExtentForSlowPathCall), callFrameRegister, regT1);
     543        addPtr(TrustedImm32(virtualRegisterForLocal(frameRegisterCountFor(m_codeBlock) - 1).offsetInBytes()), callFrameRegister, regT1);
    543544        stackCheck = branchPtr(Above, AbsoluteAddress(m_vm->addressOfJSStackLimit()), regT1);
    544545    }
     
    780781}
    781782
     783unsigned JIT::frameRegisterCountFor(CodeBlock* codeBlock)
     784{
     785    size_t registerCount = codeBlock->m_numCalleeRegisters + maxFrameExtentForSlowPathCallInRegisters;
     786    ASSERT(registerCount == WTF::roundUpToMultipleOf(stackAlignmentRegisters(), registerCount));
     787    return registerCount;
     788}
    782789
    783790} // namespace JSC
  • branches/jsCStack/Source/JavaScriptCore/jit/JIT.h

    r160340 r160745  
    245245        static void linkSlowCall(CodeBlock* callerCodeBlock, CallLinkInfo*);
    246246       
    247         static unsigned frameRegisterCountFor(CodeBlock* codeBlock)
    248         {
    249             ASSERT(!(codeBlock->m_numCalleeRegisters & 1));
    250             return codeBlock->m_numCalleeRegisters;
    251         }
     247        static unsigned frameRegisterCountFor(CodeBlock*);
    252248
    253249    private:
  • branches/jsCStack/Source/JavaScriptCore/jit/JITOpcodes.cpp

    r160656 r160745  
    638638    load64(Address(regT3, VM::callFrameForThrowOffset()), callFrameRegister);
    639639
    640     size_t frameExtent = JIT::frameRegisterCountFor(codeBlock()) * sizeof(Register) + maxFrameExtentForSlowPathCall;
    641     ASSERT(frameExtent == WTF::roundUpToMultipleOf(stackAlignmentBytes(), frameExtent));
    642     addPtr(TrustedImm32(-frameExtent), callFrameRegister, stackPointerRegister);
     640    int offset = virtualRegisterForLocal(frameRegisterCountFor(codeBlock()) - 1).offsetInBytes();
     641    addPtr(TrustedImm32(offset), callFrameRegister, stackPointerRegister);
    643642
    644643    load64(Address(regT3, VM::exceptionOffset()), regT0);
  • branches/jsCStack/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp

    r160656 r160745  
    925925    load32(Address(regT3, VM::callFrameForThrowOffset()), callFrameRegister);
    926926
    927     size_t frameExtent = JIT::frameRegisterCountFor(codeBlock()) * sizeof(Register) + maxFrameExtentForSlowPathCall;
    928     ASSERT(frameExtent == WTF::roundUpToMultipleOf(stackAlignmentBytes(), frameExtent));
    929     addPtr(TrustedImm32(-frameExtent), callFrameRegister, stackPointerRegister);
     927    int offset = virtualRegisterForLocal(frameRegisterCountFor(codeBlock()) - 1).offsetInBytes();
     928    addPtr(TrustedImm32(offset), callFrameRegister, stackPointerRegister);
    930929
    931930    // Now store the exception returned by operationThrow.
  • branches/jsCStack/Source/JavaScriptCore/llint/LLIntData.cpp

    r160522 r160745  
    126126    ASSERT(ValueNull == TagBitTypeOther);
    127127#endif
    128 #if CPU(X86_64) || CPU(ARM64) || ENABLE(LLINT_C_LOOP)
     128#if ENABLE(LLINT_C_LOOP)
    129129    ASSERT(maxFrameExtentForSlowPathCall == 0);
    130 #elif CPU(ARM) || CPU(SH4)
     130#elif CPU(X86_64) && OS(WINDOWS)
     131    ASSERT(maxFrameExtentForSlowPathCall == 64);
     132#elif CPU(X86_64) || CPU(ARM64)
    131133    ASSERT(maxFrameExtentForSlowPathCall == 16);
    132 #elif CPU(X86) || CPU(MIPS)
     134#elif CPU(X86) || CPU(ARM) || CPU(SH4)
    133135    ASSERT(maxFrameExtentForSlowPathCall == 32);
     136#elif CPU(MIPS)
     137    ASSERT(maxFrameExtentForSlowPathCall == 48);
    134138#endif
    135139    ASSERT(StringType == 5);
  • branches/jsCStack/Source/JavaScriptCore/llint/LLIntEntrypoint.cpp

    r160186 r160745  
    3434#include "LLIntThunks.h"
    3535#include "LowLevelInterpreter.h"
     36#include "MaxFrameExtentForSlowPathCall.h"
     37#include "StackAlignment.h"
    3638#include "VM.h"
    3739
     
    124126unsigned frameRegisterCountFor(CodeBlock* codeBlock)
    125127{
    126     return codeBlock->m_numCalleeRegisters;
     128    size_t registerCount = codeBlock->m_numCalleeRegisters + maxFrameExtentForSlowPathCallInRegisters;
     129    ASSERT(registerCount == WTF::roundUpToMultipleOf(stackAlignmentRegisters(), registerCount));
     130    return registerCount;
    127131}
    128132
  • branches/jsCStack/Source/JavaScriptCore/llint/LowLevelInterpreter.asm

    r160694 r160745  
    7474end
    7575
    76 if X86_64 or ARM64 or C_LOOP
     76if C_LOOP
    7777const maxFrameExtentForSlowPathCall = 0
    78 elsif ARM or ARMv7_TRADITIONAL or ARMv7 or SH4
     78elsif X86_64 or ARM64
    7979const maxFrameExtentForSlowPathCall = 16
    80 elsif X86 or MIPS
     80elsif X86 or ARM or ARMv7_TRADITIONAL or ARMv7 or SH4
    8181const maxFrameExtentForSlowPathCall = 32
     82elsif MIPS
     83const maxFrameExtentForSlowPathCall = 48
    8284end
    8385
Note: See TracChangeset for help on using the changeset viewer.