Title: [160745] branches/jsCStack/Source/_javascript_Core
Revision
160745
Author
[email protected]
Date
2013-12-17 19:38:14 -0800 (Tue, 17 Dec 2013)

Log 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.

Modified Paths

Diff

Modified: branches/jsCStack/Source/_javascript_Core/ChangeLog (160744 => 160745)


--- branches/jsCStack/Source/_javascript_Core/ChangeLog	2013-12-18 03:25:51 UTC (rev 160744)
+++ branches/jsCStack/Source/_javascript_Core/ChangeLog	2013-12-18 03:38:14 UTC (rev 160745)
@@ -1,5 +1,34 @@
 2013-12-17  Mark Lam  <[email protected]>
 
+        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.
+
+2013-12-17  Mark Lam  <[email protected]>
+
         Introduce a maxFrameExtentForSlowPathCallInRegisters value.
         https://bugs.webkit.org/show_bug.cgi?id=125877.
 

Modified: branches/jsCStack/Source/_javascript_Core/assembler/MaxFrameExtentForSlowPathCall.h (160744 => 160745)


--- branches/jsCStack/Source/_javascript_Core/assembler/MaxFrameExtentForSlowPathCall.h	2013-12-18 03:25:51 UTC (rev 160744)
+++ branches/jsCStack/Source/_javascript_Core/assembler/MaxFrameExtentForSlowPathCall.h	2013-12-18 03:38:14 UTC (rev 160745)
@@ -35,36 +35,43 @@
 // that can be used for outgoing args when calling a slow path C function
 // from JS code.
 
+// We also need to add space to account for CallerFrameAndPCSize (2 pointers)
+// and pad the sum up to a multiple of stackAlignmentBytes().
+
 #if ENABLE(LLINT_C_LOOP)
 static const size_t maxFrameExtentForSlowPathCall = 0;
 
 #elif CPU(X86_64) && OS(WINDOWS)
-// 4 args in registers, but stack space needs to be allocated for all args.
-static const size_t maxFrameExtentForSlowPathCall = 48;
+// 4 args in registers, but stack space needs to be allocated for all args,
+// plus 16 bytes for CallerFrameAndPCSize.
+static const size_t maxFrameExtentForSlowPathCall = 64;
 
 #elif CPU(X86_64)
-// All args in registers.
-static const size_t maxFrameExtentForSlowPathCall = 0;
+// All args in registers, plus 16 bytes for CallerFrameAndPCSize.
+static const size_t maxFrameExtentForSlowPathCall = 16;
 
 #elif CPU(X86)
-// 6 args on stack (24 bytes) + 8 bytes to align the stack.
+// 6 args on stack (24 bytes) plus 8 bytes for CallerFrameAndPCSize.
 static const size_t maxFrameExtentForSlowPathCall = 32;
 
 #elif CPU(ARM64)
-// All args in registers.
-static const size_t maxFrameExtentForSlowPathCall = 0;
+// All args in registers, plus 16 bytes for CallerFrameAndPCSize.
+static const size_t maxFrameExtentForSlowPathCall = 16;
 
 #elif CPU(ARM)
-// First four args in registers, remaining 4 args on stack.
-static const size_t maxFrameExtentForSlowPathCall = 16;
+// First four args in registers, remaining 4 args on stack,
+// plus 8 byte for CallerFrameAndPCSize and 8 bytes padding.
+static const size_t maxFrameExtentForSlowPathCall = 32;
 
 #elif CPU(SH4)
-// First four args in registers, remaining 4 args on stack.
-static const size_t maxFrameExtentForSlowPathCall = 16;
+// First four args in registers, remaining 4 args on stack,
+// plus 8 byte for CallerFrameAndPCSize and 8 bytes padding.
+static const size_t maxFrameExtentForSlowPathCall = 32;
 
 #elif CPU(MIPS)
-// Though args are in registers, there need to be space on the stack for all args.
-static const size_t maxFrameExtentForSlowPathCall = 32;
+// Though args are in registers, there need to be space on the stack for all args,
+// plus 8 bytes CallerFrameAndPCSize and 8 bytes padding.
+static const size_t maxFrameExtentForSlowPathCall = 48;
 
 #else
 #error "Unsupported CPU: need value for maxFrameExtentForSlowPathCall"

Modified: branches/jsCStack/Source/_javascript_Core/bytecode/VirtualRegister.h (160744 => 160745)


--- branches/jsCStack/Source/_javascript_Core/bytecode/VirtualRegister.h	2013-12-18 03:25:51 UTC (rev 160744)
+++ branches/jsCStack/Source/_javascript_Core/bytecode/VirtualRegister.h	2013-12-18 03:38:14 UTC (rev 160745)
@@ -65,6 +65,7 @@
     int toArgument() const { ASSERT(isArgument()); return operandToArgument(m_virtualRegister); }
     int toConstantIndex() const { ASSERT(isConstant()); return m_virtualRegister - s_firstConstantRegisterIndex; }
     int offset() const { return m_virtualRegister; }
+    int offsetInBytes() const { return m_virtualRegister * sizeof(Register); }
 
     bool operator==(const VirtualRegister other) const { return m_virtualRegister == other.m_virtualRegister; }
     bool operator!=(const VirtualRegister other) const { return m_virtualRegister != other.m_virtualRegister; }

Modified: branches/jsCStack/Source/_javascript_Core/dfg/DFGGraph.cpp (160744 => 160745)


--- branches/jsCStack/Source/_javascript_Core/dfg/DFGGraph.cpp	2013-12-18 03:25:51 UTC (rev 160744)
+++ branches/jsCStack/Source/_javascript_Core/dfg/DFGGraph.cpp	2013-12-18 03:38:14 UTC (rev 160745)
@@ -36,6 +36,7 @@
 #include "FunctionExecutableDump.h"
 #include "JIT.h"
 #include "JSActivation.h"
+#include "MaxFrameExtentForSlowPathCall.h"
 #include "OperandsInlines.h"
 #include "Operations.h"
 #include "StackAlignment.h"
@@ -704,7 +705,7 @@
 
 unsigned Graph::frameRegisterCount()
 {
-    unsigned result = m_nextMachineLocal + std::max(m_parameterSlots, static_cast<unsigned>(JSStack::CallerFrameAndPCSize));
+    unsigned result = m_nextMachineLocal + std::max(m_parameterSlots, static_cast<unsigned>(maxFrameExtentForSlowPathCallInRegisters));
     result = WTF::roundUpToMultipleOf(stackAlignmentRegisters(), result);
     return result;
 }

Modified: branches/jsCStack/Source/_javascript_Core/jit/JIT.cpp (160744 => 160745)


--- branches/jsCStack/Source/_javascript_Core/jit/JIT.cpp	2013-12-18 03:25:51 UTC (rev 160744)
+++ branches/jsCStack/Source/_javascript_Core/jit/JIT.cpp	2013-12-18 03:38:14 UTC (rev 160745)
@@ -48,6 +48,7 @@
 #include "ResultType.h"
 #include "SamplingTool.h"
 #include "SlowPathCall.h"
+#include "StackAlignment.h"
 #include <wtf/CryptographicallyRandomNumber.h>
 
 using namespace std;
@@ -539,7 +540,7 @@
         }
 #endif
 
-        addPtr(TrustedImm32(virtualRegisterForLocal(frameRegisterCountFor(m_codeBlock) - 1).offset() * sizeof(Register) - maxFrameExtentForSlowPathCall), callFrameRegister, regT1);
+        addPtr(TrustedImm32(virtualRegisterForLocal(frameRegisterCountFor(m_codeBlock) - 1).offsetInBytes()), callFrameRegister, regT1);
         stackCheck = branchPtr(Above, AbsoluteAddress(m_vm->addressOfJSStackLimit()), regT1);
     }
 
@@ -779,6 +780,12 @@
     jumpToExceptionHandler();
 }
 
+unsigned JIT::frameRegisterCountFor(CodeBlock* codeBlock)
+{
+    size_t registerCount = codeBlock->m_numCalleeRegisters + maxFrameExtentForSlowPathCallInRegisters;
+    ASSERT(registerCount == WTF::roundUpToMultipleOf(stackAlignmentRegisters(), registerCount));
+    return registerCount;
+}
 
 } // namespace JSC
 

Modified: branches/jsCStack/Source/_javascript_Core/jit/JIT.h (160744 => 160745)


--- branches/jsCStack/Source/_javascript_Core/jit/JIT.h	2013-12-18 03:25:51 UTC (rev 160744)
+++ branches/jsCStack/Source/_javascript_Core/jit/JIT.h	2013-12-18 03:38:14 UTC (rev 160745)
@@ -244,11 +244,7 @@
         static void linkFor(ExecState*, JSFunction* callee, CodeBlock* callerCodeBlock, CodeBlock* calleeCodeBlock, CodePtr, CallLinkInfo*, VM*, CodeSpecializationKind);
         static void linkSlowCall(CodeBlock* callerCodeBlock, CallLinkInfo*);
         
-        static unsigned frameRegisterCountFor(CodeBlock* codeBlock)
-        {
-            ASSERT(!(codeBlock->m_numCalleeRegisters & 1));
-            return codeBlock->m_numCalleeRegisters;
-        }
+        static unsigned frameRegisterCountFor(CodeBlock*);
 
     private:
         JIT(VM*, CodeBlock* = 0);

Modified: branches/jsCStack/Source/_javascript_Core/jit/JITOpcodes.cpp (160744 => 160745)


--- branches/jsCStack/Source/_javascript_Core/jit/JITOpcodes.cpp	2013-12-18 03:25:51 UTC (rev 160744)
+++ branches/jsCStack/Source/_javascript_Core/jit/JITOpcodes.cpp	2013-12-18 03:38:14 UTC (rev 160745)
@@ -637,9 +637,8 @@
     move(TrustedImmPtr(m_vm), regT3);
     load64(Address(regT3, VM::callFrameForThrowOffset()), callFrameRegister);
 
-    size_t frameExtent = JIT::frameRegisterCountFor(codeBlock()) * sizeof(Register) + maxFrameExtentForSlowPathCall;
-    ASSERT(frameExtent == WTF::roundUpToMultipleOf(stackAlignmentBytes(), frameExtent));
-    addPtr(TrustedImm32(-frameExtent), callFrameRegister, stackPointerRegister);
+    int offset = virtualRegisterForLocal(frameRegisterCountFor(codeBlock()) - 1).offsetInBytes();
+    addPtr(TrustedImm32(offset), callFrameRegister, stackPointerRegister);
 
     load64(Address(regT3, VM::exceptionOffset()), regT0);
     store64(TrustedImm64(JSValue::encode(JSValue())), Address(regT3, VM::exceptionOffset()));

Modified: branches/jsCStack/Source/_javascript_Core/jit/JITOpcodes32_64.cpp (160744 => 160745)


--- branches/jsCStack/Source/_javascript_Core/jit/JITOpcodes32_64.cpp	2013-12-18 03:25:51 UTC (rev 160744)
+++ branches/jsCStack/Source/_javascript_Core/jit/JITOpcodes32_64.cpp	2013-12-18 03:38:14 UTC (rev 160745)
@@ -924,9 +924,8 @@
     // operationThrow returns the callFrame for the handler.
     load32(Address(regT3, VM::callFrameForThrowOffset()), callFrameRegister);
 
-    size_t frameExtent = JIT::frameRegisterCountFor(codeBlock()) * sizeof(Register) + maxFrameExtentForSlowPathCall;
-    ASSERT(frameExtent == WTF::roundUpToMultipleOf(stackAlignmentBytes(), frameExtent));
-    addPtr(TrustedImm32(-frameExtent), callFrameRegister, stackPointerRegister);
+    int offset = virtualRegisterForLocal(frameRegisterCountFor(codeBlock()) - 1).offsetInBytes();
+    addPtr(TrustedImm32(offset), callFrameRegister, stackPointerRegister);
 
     // Now store the exception returned by operationThrow.
     load32(Address(regT3, VM::exceptionOffset() + OBJECT_OFFSETOF(JSValue, u.asBits.payload)), regT0);

Modified: branches/jsCStack/Source/_javascript_Core/llint/LLIntData.cpp (160744 => 160745)


--- branches/jsCStack/Source/_javascript_Core/llint/LLIntData.cpp	2013-12-18 03:25:51 UTC (rev 160744)
+++ branches/jsCStack/Source/_javascript_Core/llint/LLIntData.cpp	2013-12-18 03:38:14 UTC (rev 160745)
@@ -125,12 +125,16 @@
     ASSERT(ValueUndefined == (TagBitTypeOther | TagBitUndefined));
     ASSERT(ValueNull == TagBitTypeOther);
 #endif
-#if CPU(X86_64) || CPU(ARM64) || ENABLE(LLINT_C_LOOP)
+#if ENABLE(LLINT_C_LOOP)
     ASSERT(maxFrameExtentForSlowPathCall == 0);
-#elif CPU(ARM) || CPU(SH4)
+#elif CPU(X86_64) && OS(WINDOWS)
+    ASSERT(maxFrameExtentForSlowPathCall == 64);
+#elif CPU(X86_64) || CPU(ARM64)
     ASSERT(maxFrameExtentForSlowPathCall == 16);
-#elif CPU(X86) || CPU(MIPS)
+#elif CPU(X86) || CPU(ARM) || CPU(SH4)
     ASSERT(maxFrameExtentForSlowPathCall == 32);
+#elif CPU(MIPS)
+    ASSERT(maxFrameExtentForSlowPathCall == 48);
 #endif
     ASSERT(StringType == 5);
     ASSERT(ObjectType == 17);

Modified: branches/jsCStack/Source/_javascript_Core/llint/LLIntEntrypoint.cpp (160744 => 160745)


--- branches/jsCStack/Source/_javascript_Core/llint/LLIntEntrypoint.cpp	2013-12-18 03:25:51 UTC (rev 160744)
+++ branches/jsCStack/Source/_javascript_Core/llint/LLIntEntrypoint.cpp	2013-12-18 03:38:14 UTC (rev 160745)
@@ -33,6 +33,8 @@
 #include "JSObject.h"
 #include "LLIntThunks.h"
 #include "LowLevelInterpreter.h"
+#include "MaxFrameExtentForSlowPathCall.h"
+#include "StackAlignment.h"
 #include "VM.h"
 
 namespace JSC { namespace LLInt {
@@ -123,7 +125,9 @@
 
 unsigned frameRegisterCountFor(CodeBlock* codeBlock)
 {
-    return codeBlock->m_numCalleeRegisters;
+    size_t registerCount = codeBlock->m_numCalleeRegisters + maxFrameExtentForSlowPathCallInRegisters;
+    ASSERT(registerCount == WTF::roundUpToMultipleOf(stackAlignmentRegisters(), registerCount));
+    return registerCount;
 }
 
 } } // namespace JSC::LLInt

Modified: branches/jsCStack/Source/_javascript_Core/llint/LowLevelInterpreter.asm (160744 => 160745)


--- branches/jsCStack/Source/_javascript_Core/llint/LowLevelInterpreter.asm	2013-12-18 03:25:51 UTC (rev 160744)
+++ branches/jsCStack/Source/_javascript_Core/llint/LowLevelInterpreter.asm	2013-12-18 03:38:14 UTC (rev 160745)
@@ -73,12 +73,14 @@
 const LowestTag = DeletedValueTag
 end
 
-if X86_64 or ARM64 or C_LOOP
+if C_LOOP
 const maxFrameExtentForSlowPathCall = 0
-elsif ARM or ARMv7_TRADITIONAL or ARMv7 or SH4
+elsif X86_64 or ARM64
 const maxFrameExtentForSlowPathCall = 16
-elsif X86 or MIPS
+elsif X86 or ARM or ARMv7_TRADITIONAL or ARMv7 or SH4
 const maxFrameExtentForSlowPathCall = 32
+elsif MIPS
+const maxFrameExtentForSlowPathCall = 48
 end
 
 # Watchpoint states
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to