Title: [202862] trunk/Source/_javascript_Core
Revision
202862
Author
[email protected]
Date
2016-07-06 10:19:20 -0700 (Wed, 06 Jul 2016)

Log Message

Rename VM stack limit fields to better describe their purpose.
https://bugs.webkit.org/show_bug.cgi?id=159451

Reviewed by Keith Miller.

This is in preparation for an upcoming patch that changes what stack limit values
are used under various circumstances.  This patch aims to do some minimal work to
rename the fields so that it will be easier to reason about the upcoming patch.
    
In this patch, we make the following changes:

1. Rename VM::m_stackLimit to VM::m_jsCPUStackLimit.

2. VM::m_jsStackLimit used to have an overloaded meaning:
   a. For JIT builds, m_jsStackLimit is synonymous with m_stackLimit.
   b. For C Loop builds, m_jsStackLimit is a separate pointer that points to the
      emulated JS stack that the C Loop uses.

   In place of m_jsStackLimit, this patch introduces 2 new fields:
   VM::m_jsEmulatedStackLimit and VM::m_llintStackLimit.

   m_llintStackLimit is the limit that the LLInt assembly uses for its stack
   check.  m_llintStackLimit behaves like the old m_jsStackLimit in that:
   a. For JIT builds, m_llintStackLimit is synonymous with m_jsCPUStackLimit.
   b. For C Loop builds, m_llintStackLimit is synonymous with m_jsEmulatedStackLimit.

   m_jsEmulatedStackLimit is used for the emulated stack that the C Loop uses.

3. Rename the following methods to match the above:
     VM::stackLimit() ==> VM::jsCPUStackLimit()
     VM::addressOfStackLimit() ==> VM::addressOfJSCPUStackLimit()
     VM::jsStackLimit() ==> VM::jsEmulatedStackLimit()
     VM::setJSStackLimit() ==> VM::setJSEmulatedStackLimit()
     JSStack::setStackLimit() ==> JSStack::setEmulatedStackLimit()

4. With change (2) and (3), the limits will be used as follows:
   a. VM code doing stack recursion checks will only use m_jsCPUStackLimit.
   b. JIT code will only use m_jsCPUStackLimit.
   c. C Loop emulated stack code in JSStack will only use m_jsEmulatedStackLimit.
      Note: the part of JSStack that operates on a JIT build will use
            m_jsCPUStackLimit as expected.
   d. LLINT assembly code will only use m_llintStackLimit.

This patch only contains the above refactoring changes.  There is no behavior
change.

* dfg/DFGJITCompiler.cpp:
(JSC::DFG::JITCompiler::compile):
(JSC::DFG::JITCompiler::compileFunction):
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::lower):
* interpreter/JSStack.cpp:
(JSC::JSStack::JSStack):
(JSC::JSStack::growSlowCase):
(JSC::JSStack::lowAddress):
(JSC::JSStack::highAddress):
* interpreter/JSStack.h:
* interpreter/JSStackInlines.h:
(JSC::JSStack::ensureCapacityFor):
(JSC::JSStack::shrink):
(JSC::JSStack::grow):
(JSC::JSStack::setJSEmulatedStackLimit):
(JSC::JSStack::setStackLimit): Deleted.
* jit/JIT.cpp:
(JSC::JIT::compileWithoutLinking):
* jit/SetupVarargsFrame.cpp:
(JSC::emitSetupVarargsFrameFastCase):
* llint/LLIntSlowPaths.cpp:
(JSC::LLInt::LLINT_SLOW_PATH_DECL):
* llint/LowLevelInterpreter.asm:
* llint/LowLevelInterpreter32_64.asm:
* llint/LowLevelInterpreter64.asm:
* runtime/RegExp.cpp:
(JSC::RegExp::finishCreation):
(JSC::RegExp::compile):
(JSC::RegExp::compileMatchOnly):
* runtime/VM.cpp:
(JSC::VM::VM):
(JSC::VM::updateStackLimit):
* runtime/VM.h:
(JSC::VM::reservedZoneSize):
(JSC::VM::jsCPUStackLimit):
(JSC::VM::addressOfJSCPUStackLimit):
(JSC::VM::jsEmulatedStackLimit):
(JSC::VM::setJSEmulatedStackLimit):
(JSC::VM::isSafeToRecurse):
(JSC::VM::jsStackLimit): Deleted.
(JSC::VM::setJSStackLimit): Deleted.
(JSC::VM::stackLimit): Deleted.
(JSC::VM::addressOfStackLimit): Deleted.
* wasm/WASMFunctionCompiler.h:
(JSC::WASMFunctionCompiler::startFunction):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (202861 => 202862)


--- trunk/Source/_javascript_Core/ChangeLog	2016-07-06 17:04:28 UTC (rev 202861)
+++ trunk/Source/_javascript_Core/ChangeLog	2016-07-06 17:19:20 UTC (rev 202862)
@@ -1,3 +1,98 @@
+2016-07-05  Mark Lam  <[email protected]>
+
+        Rename VM stack limit fields to better describe their purpose.
+        https://bugs.webkit.org/show_bug.cgi?id=159451
+
+        Reviewed by Keith Miller.
+
+        This is in preparation for an upcoming patch that changes what stack limit values
+        are used under various circumstances.  This patch aims to do some minimal work to
+        rename the fields so that it will be easier to reason about the upcoming patch.
+    
+        In this patch, we make the following changes:
+
+        1. Rename VM::m_stackLimit to VM::m_jsCPUStackLimit.
+
+        2. VM::m_jsStackLimit used to have an overloaded meaning:
+           a. For JIT builds, m_jsStackLimit is synonymous with m_stackLimit.
+           b. For C Loop builds, m_jsStackLimit is a separate pointer that points to the
+              emulated JS stack that the C Loop uses.
+
+           In place of m_jsStackLimit, this patch introduces 2 new fields:
+           VM::m_jsEmulatedStackLimit and VM::m_llintStackLimit.
+
+           m_llintStackLimit is the limit that the LLInt assembly uses for its stack
+           check.  m_llintStackLimit behaves like the old m_jsStackLimit in that:
+           a. For JIT builds, m_llintStackLimit is synonymous with m_jsCPUStackLimit.
+           b. For C Loop builds, m_llintStackLimit is synonymous with m_jsEmulatedStackLimit.
+
+           m_jsEmulatedStackLimit is used for the emulated stack that the C Loop uses.
+
+        3. Rename the following methods to match the above:
+             VM::stackLimit() ==> VM::jsCPUStackLimit()
+             VM::addressOfStackLimit() ==> VM::addressOfJSCPUStackLimit()
+             VM::jsStackLimit() ==> VM::jsEmulatedStackLimit()
+             VM::setJSStackLimit() ==> VM::setJSEmulatedStackLimit()
+             JSStack::setStackLimit() ==> JSStack::setEmulatedStackLimit()
+
+        4. With change (2) and (3), the limits will be used as follows:
+           a. VM code doing stack recursion checks will only use m_jsCPUStackLimit.
+           b. JIT code will only use m_jsCPUStackLimit.
+           c. C Loop emulated stack code in JSStack will only use m_jsEmulatedStackLimit.
+              Note: the part of JSStack that operates on a JIT build will use
+                    m_jsCPUStackLimit as expected.
+           d. LLINT assembly code will only use m_llintStackLimit.
+
+        This patch only contains the above refactoring changes.  There is no behavior
+        change.
+
+        * dfg/DFGJITCompiler.cpp:
+        (JSC::DFG::JITCompiler::compile):
+        (JSC::DFG::JITCompiler::compileFunction):
+        * ftl/FTLLowerDFGToB3.cpp:
+        (JSC::FTL::DFG::LowerDFGToB3::lower):
+        * interpreter/JSStack.cpp:
+        (JSC::JSStack::JSStack):
+        (JSC::JSStack::growSlowCase):
+        (JSC::JSStack::lowAddress):
+        (JSC::JSStack::highAddress):
+        * interpreter/JSStack.h:
+        * interpreter/JSStackInlines.h:
+        (JSC::JSStack::ensureCapacityFor):
+        (JSC::JSStack::shrink):
+        (JSC::JSStack::grow):
+        (JSC::JSStack::setJSEmulatedStackLimit):
+        (JSC::JSStack::setStackLimit): Deleted.
+        * jit/JIT.cpp:
+        (JSC::JIT::compileWithoutLinking):
+        * jit/SetupVarargsFrame.cpp:
+        (JSC::emitSetupVarargsFrameFastCase):
+        * llint/LLIntSlowPaths.cpp:
+        (JSC::LLInt::LLINT_SLOW_PATH_DECL):
+        * llint/LowLevelInterpreter.asm:
+        * llint/LowLevelInterpreter32_64.asm:
+        * llint/LowLevelInterpreter64.asm:
+        * runtime/RegExp.cpp:
+        (JSC::RegExp::finishCreation):
+        (JSC::RegExp::compile):
+        (JSC::RegExp::compileMatchOnly):
+        * runtime/VM.cpp:
+        (JSC::VM::VM):
+        (JSC::VM::updateStackLimit):
+        * runtime/VM.h:
+        (JSC::VM::reservedZoneSize):
+        (JSC::VM::jsCPUStackLimit):
+        (JSC::VM::addressOfJSCPUStackLimit):
+        (JSC::VM::jsEmulatedStackLimit):
+        (JSC::VM::setJSEmulatedStackLimit):
+        (JSC::VM::isSafeToRecurse):
+        (JSC::VM::jsStackLimit): Deleted.
+        (JSC::VM::setJSStackLimit): Deleted.
+        (JSC::VM::stackLimit): Deleted.
+        (JSC::VM::addressOfStackLimit): Deleted.
+        * wasm/WASMFunctionCompiler.h:
+        (JSC::WASMFunctionCompiler::startFunction):
+
 2016-07-05  Saam Barati  <[email protected]>
 
         StackVisitor::unwindToMachineCodeBlockFrame() may unwind past a VM entry frame when catching an exception and the frame has inlined tail calls

Modified: trunk/Source/_javascript_Core/dfg/DFGJITCompiler.cpp (202861 => 202862)


--- trunk/Source/_javascript_Core/dfg/DFGJITCompiler.cpp	2016-07-06 17:04:28 UTC (rev 202861)
+++ trunk/Source/_javascript_Core/dfg/DFGJITCompiler.cpp	2016-07-06 17:19:20 UTC (rev 202862)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011, 2013-2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2011, 2013-2016 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -342,7 +342,7 @@
 
     // Plant a check that sufficient space is available in the JSStack.
     addPtr(TrustedImm32(virtualRegisterForLocal(m_graph.requiredRegisterCountForExecutionAndExit() - 1).offset() * sizeof(Register)), GPRInfo::callFrameRegister, GPRInfo::regT1);
-    Jump stackOverflow = branchPtr(Above, AbsoluteAddress(m_vm->addressOfStackLimit()), GPRInfo::regT1);
+    Jump stackOverflow = branchPtr(Above, AbsoluteAddress(m_vm->addressOfJSCPUStackLimit()), GPRInfo::regT1);
 
     addPtr(TrustedImm32(m_graph.stackPointerOffset() * sizeof(Register)), GPRInfo::callFrameRegister, stackPointerRegister);
     checkStackPointerAlignment();
@@ -405,7 +405,7 @@
     Label fromArityCheck(this);
     // Plant a check that sufficient space is available in the JSStack.
     addPtr(TrustedImm32(virtualRegisterForLocal(m_graph.requiredRegisterCountForExecutionAndExit() - 1).offset() * sizeof(Register)), GPRInfo::callFrameRegister, GPRInfo::regT1);
-    Jump stackOverflow = branchPtr(Above, AbsoluteAddress(m_vm->addressOfStackLimit()), GPRInfo::regT1);
+    Jump stackOverflow = branchPtr(Above, AbsoluteAddress(m_vm->addressOfJSCPUStackLimit()), GPRInfo::regT1);
 
     // Move the stack pointer down to accommodate locals
     addPtr(TrustedImm32(m_graph.stackPointerOffset() * sizeof(Register)), GPRInfo::callFrameRegister, stackPointerRegister);

Modified: trunk/Source/_javascript_Core/ftl/FTLLowerDFGToB3.cpp (202861 => 202862)


--- trunk/Source/_javascript_Core/ftl/FTLLowerDFGToB3.cpp	2016-07-06 17:04:28 UTC (rev 202861)
+++ trunk/Source/_javascript_Core/ftl/FTLLowerDFGToB3.cpp	2016-07-06 17:19:20 UTC (rev 202862)
@@ -189,7 +189,7 @@
 
         // Stack Overflow Check.
         unsigned exitFrameSize = m_graph.requiredRegisterCountForExit() * sizeof(Register);
-        MacroAssembler::AbsoluteAddress addressOfStackLimit(vm().addressOfStackLimit());
+        MacroAssembler::AbsoluteAddress addressOfStackLimit(vm().addressOfJSCPUStackLimit());
         PatchpointValue* stackOverflowHandler = m_out.patchpoint(Void);
         CallSiteIndex callSiteIndex = callSiteIndexForCodeOrigin(m_ftlState, CodeOrigin(0));
         stackOverflowHandler->appendSomeRegister(m_callFrame);

Modified: trunk/Source/_javascript_Core/interpreter/JSStack.cpp (202861 => 202862)


--- trunk/Source/_javascript_Core/interpreter/JSStack.cpp	2016-07-06 17:04:28 UTC (rev 202861)
+++ trunk/Source/_javascript_Core/interpreter/JSStack.cpp	2016-07-06 17:19:20 UTC (rev 202862)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008, 2013, 2014, 2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2008, 2013-2016 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -62,7 +62,7 @@
     ASSERT(capacity && isPageAligned(capacity));
 
     m_reservation = PageReservation::reserve(WTF::roundUpToMultipleOf(commitSize(), capacity), OSAllocator::JSVMStackPages);
-    setStackLimit(highAddress());
+    setJSEmulatedStackLimit(highAddress());
     m_commitTop = highAddress();
     
     m_lastStackTop = baseOfStack();
@@ -87,7 +87,7 @@
     // If we have already committed enough memory to satisfy this request,
     // just update the end pointer and return.
     if (newTopOfStackWithReservedZone >= m_commitTop) {
-        setStackLimit(newTopOfStack);
+        setJSEmulatedStackLimit(newTopOfStack);
         return true;
     }
 
@@ -104,7 +104,7 @@
     m_reservation.commit(newCommitTop, delta);
     addToCommittedByteCount(delta);
     m_commitTop = newCommitTop;
-    setStackLimit(newTopOfStack);
+    setJSEmulatedStackLimit(newTopOfStack);
     return true;
 }
 
@@ -156,7 +156,7 @@
 Register* JSStack::lowAddress() const
 {
     ASSERT(wtfThreadData().stack().isGrowingDownward());
-    return reinterpret_cast<Register*>(m_vm.stackLimit());
+    return reinterpret_cast<Register*>(m_vm.jsCPUStackLimit());
 }
 
 Register* JSStack::highAddress() const

Modified: trunk/Source/_javascript_Core/interpreter/JSStack.h (202861 => 202862)


--- trunk/Source/_javascript_Core/interpreter/JSStack.h	2016-07-06 17:04:28 UTC (rev 202861)
+++ trunk/Source/_javascript_Core/interpreter/JSStack.h	2016-07-06 17:19:20 UTC (rev 202862)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008, 2009, 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2008-2009, 2013-2014, 2016 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -130,7 +130,7 @@
         void releaseExcessCapacity();
         void addToCommittedByteCount(long);
 
-        void setStackLimit(Register* newTopOfStack);
+        void setJSEmulatedStackLimit(Register* newTopOfStack);
 #endif // !ENABLE(JIT)
 
         VM& m_vm;

Modified: trunk/Source/_javascript_Core/interpreter/JSStackInlines.h (202861 => 202862)


--- trunk/Source/_javascript_Core/interpreter/JSStackInlines.h	2016-07-06 17:04:28 UTC (rev 202861)
+++ trunk/Source/_javascript_Core/interpreter/JSStackInlines.h	2016-07-06 17:19:20 UTC (rev 202862)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012, 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2012-2014, 2016 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -39,7 +39,7 @@
     return grow(newTopOfStack);
 #else
     ASSERT(wtfThreadData().stack().isGrowingDownward());
-    return newTopOfStack >= m_vm.stackLimit();
+    return newTopOfStack >= m_vm.jsCPUStackLimit();
 #endif
 }
 
@@ -62,7 +62,7 @@
     Register* newEnd = newTopOfStack - 1;
     if (newEnd >= m_end)
         return;
-    setStackLimit(newTopOfStack);
+    setJSEmulatedStackLimit(newTopOfStack);
     // Note: Clang complains of an unresolved linkage to maxExcessCapacity if
     // invoke std::max() with it as an argument. To work around this, we first
     // assign the constant to a local variable, and use the local instead.
@@ -80,11 +80,11 @@
     return growSlowCase(newTopOfStack);
 }
 
-inline void JSStack::setStackLimit(Register* newTopOfStack)
+inline void JSStack::setJSEmulatedStackLimit(Register* newTopOfStack)
 {
     Register* newEnd = newTopOfStack - 1;
     m_end = newEnd;
-    m_vm.setJSStackLimit(newTopOfStack);
+    m_vm.setJSEmulatedStackLimit(newTopOfStack);
 }
 
 #endif // !ENABLE(JIT)

Modified: trunk/Source/_javascript_Core/jit/JIT.cpp (202861 => 202862)


--- trunk/Source/_javascript_Core/jit/JIT.cpp	2016-07-06 17:04:28 UTC (rev 202861)
+++ trunk/Source/_javascript_Core/jit/JIT.cpp	2016-07-06 17:19:20 UTC (rev 202862)
@@ -599,7 +599,7 @@
     }
 
     addPtr(TrustedImm32(stackPointerOffsetFor(m_codeBlock) * sizeof(Register)), callFrameRegister, regT1);
-    Jump stackOverflow = branchPtr(Above, AbsoluteAddress(m_vm->addressOfStackLimit()), regT1);
+    Jump stackOverflow = branchPtr(Above, AbsoluteAddress(m_vm->addressOfJSCPUStackLimit()), regT1);
 
     move(regT1, stackPointerRegister);
     checkStackPointerAlignment();

Modified: trunk/Source/_javascript_Core/jit/SetupVarargsFrame.cpp (202861 => 202862)


--- trunk/Source/_javascript_Core/jit/SetupVarargsFrame.cpp	2016-07-06 17:04:28 UTC (rev 202861)
+++ trunk/Source/_javascript_Core/jit/SetupVarargsFrame.cpp	2016-07-06 17:19:20 UTC (rev 202862)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2015-2016 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -82,7 +82,7 @@
     
     emitSetVarargsFrame(jit, scratchGPR1, true, numUsedSlotsGPR, scratchGPR2);
 
-    slowCase.append(jit.branchPtr(CCallHelpers::Above, CCallHelpers::AbsoluteAddress(jit.vm()->addressOfStackLimit()), scratchGPR2));
+    slowCase.append(jit.branchPtr(CCallHelpers::Above, CCallHelpers::AbsoluteAddress(jit.vm()->addressOfJSCPUStackLimit()), scratchGPR2));
 
     // Initialize ArgumentCount.
     jit.store32(scratchGPR1, CCallHelpers::Address(scratchGPR2, JSStack::ArgumentCount * static_cast<int>(sizeof(Register)) + PayloadOffset));

Modified: trunk/Source/_javascript_Core/llint/LLIntSlowPaths.cpp (202861 => 202862)


--- trunk/Source/_javascript_Core/llint/LLIntSlowPaths.cpp	2016-07-06 17:04:28 UTC (rev 202861)
+++ trunk/Source/_javascript_Core/llint/LLIntSlowPaths.cpp	2016-07-06 17:19:20 UTC (rev 202862)
@@ -484,9 +484,9 @@
     dataLogF("Num vars = %u.\n", exec->codeBlock()->m_numVars);
 
 #if ENABLE(JIT)
-    dataLogF("Current end is at %p.\n", exec->vm().stackLimit());
+    dataLogF("Current end is at %p.\n", exec->vm().jsCPUStackLimit());
 #else
-    dataLogF("Current end is at %p.\n", exec->vm().jsStackLimit());
+    dataLogF("Current end is at %p.\n", exec->vm().jsEmulatedStackLimit());
 #endif
 
 #endif

Modified: trunk/Source/_javascript_Core/llint/LowLevelInterpreter.asm (202861 => 202862)


--- trunk/Source/_javascript_Core/llint/LowLevelInterpreter.asm	2016-07-06 17:04:28 UTC (rev 202861)
+++ trunk/Source/_javascript_Core/llint/LowLevelInterpreter.asm	2016-07-06 17:19:20 UTC (rev 202862)
@@ -951,7 +951,7 @@
     getFrameRegisterSizeForCodeBlock(t1, t0)
     subp cfr, t0, t0
     loadp CodeBlock::m_vm[t1], t2
-    bpbeq VM::m_jsStackLimit[t2], t0, .stackHeightOK
+    bpbeq VM::m_llintStackLimit[t2], t0, .stackHeightOK
 
     # Stack height check failed - need to call a slow_path.
     # Set up temporary stack pointer for call including callee saves

Modified: trunk/Source/_javascript_Core/llint/LowLevelInterpreter32_64.asm (202861 => 202862)


--- trunk/Source/_javascript_Core/llint/LowLevelInterpreter32_64.asm	2016-07-06 17:04:28 UTC (rev 202861)
+++ trunk/Source/_javascript_Core/llint/LowLevelInterpreter32_64.asm	2016-07-06 17:19:20 UTC (rev 202862)
@@ -152,7 +152,7 @@
     # Ensure that we have enough additional stack capacity for the incoming args,
     # and the frame for the JS code we're executing. We need to do this check
     # before we start copying the args from the protoCallFrame below.
-    bpaeq t3, VM::m_jsStackLimit[vm], .stackHeightOK
+    bpaeq t3, VM::m_llintStackLimit[vm], .stackHeightOK
 
     if C_LOOP
         move entry, t4

Modified: trunk/Source/_javascript_Core/llint/LowLevelInterpreter64.asm (202861 => 202862)


--- trunk/Source/_javascript_Core/llint/LowLevelInterpreter64.asm	2016-07-06 17:04:28 UTC (rev 202861)
+++ trunk/Source/_javascript_Core/llint/LowLevelInterpreter64.asm	2016-07-06 17:19:20 UTC (rev 202862)
@@ -140,7 +140,7 @@
     # Ensure that we have enough additional stack capacity for the incoming args,
     # and the frame for the JS code we're executing. We need to do this check
     # before we start copying the args from the protoCallFrame below.
-    bpaeq t3, VM::m_jsStackLimit[vm], .stackHeightOK
+    bpaeq t3, VM::m_llintStackLimit[vm], .stackHeightOK
 
     if C_LOOP
         move entry, t4

Modified: trunk/Source/_javascript_Core/runtime/RegExp.cpp (202861 => 202862)


--- trunk/Source/_javascript_Core/runtime/RegExp.cpp	2016-07-06 17:04:28 UTC (rev 202861)
+++ trunk/Source/_javascript_Core/runtime/RegExp.cpp	2016-07-06 17:19:20 UTC (rev 202862)
@@ -222,7 +222,7 @@
 void RegExp::finishCreation(VM& vm)
 {
     Base::finishCreation(vm);
-    Yarr::YarrPattern pattern(m_patternString, m_flags, &m_constructionError, vm.stackLimit());
+    Yarr::YarrPattern pattern(m_patternString, m_flags, &m_constructionError, vm.jsCPUStackLimit());
     if (m_constructionError)
         m_state = ParseError;
     else
@@ -264,7 +264,7 @@
 {
     ConcurrentJITLocker locker(m_lock);
     
-    Yarr::YarrPattern pattern(m_patternString, m_flags, &m_constructionError, vm->stackLimit());
+    Yarr::YarrPattern pattern(m_patternString, m_flags, &m_constructionError, vm->jsCPUStackLimit());
     if (m_constructionError) {
         RELEASE_ASSERT_NOT_REACHED();
 #if COMPILER_QUIRK(CONSIDERS_UNREACHABLE_CODE)
@@ -317,7 +317,7 @@
 {
     ConcurrentJITLocker locker(m_lock);
     
-    Yarr::YarrPattern pattern(m_patternString, m_flags, &m_constructionError, vm->stackLimit());
+    Yarr::YarrPattern pattern(m_patternString, m_flags, &m_constructionError, vm->jsCPUStackLimit());
     if (m_constructionError) {
         RELEASE_ASSERT_NOT_REACHED();
 #if COMPILER_QUIRK(CONSIDERS_UNREACHABLE_CODE)

Modified: trunk/Source/_javascript_Core/runtime/VM.cpp (202861 => 202862)


--- trunk/Source/_javascript_Core/runtime/VM.cpp	2016-07-06 17:04:28 UTC (rev 202861)
+++ trunk/Source/_javascript_Core/runtime/VM.cpp	2016-07-06 17:19:20 UTC (rev 202862)
@@ -185,10 +185,6 @@
     , m_initializingObjectClass(0)
 #endif
     , m_stackPointerAtVMEntry(0)
-    , m_stackLimit(0)
-#if !ENABLE(JIT)
-    , m_jsStackLimit(0)
-#endif
     , m_codeCache(std::make_unique<CodeCache>())
     , m_builtinExecutables(std::make_unique<BuiltinExecutables>(*this))
     , m_typeProfilerEnabledCount(0)
@@ -654,20 +650,20 @@
 inline void VM::updateStackLimit()
 {
 #if PLATFORM(WIN)
-    void* lastStackLimit = m_stackLimit;
+    void* lastJSCPUStackLimit = m_jsCPUStackLimit;
 #endif
 
     if (m_stackPointerAtVMEntry) {
         ASSERT(wtfThreadData().stack().isGrowingDownward());
         char* startOfStack = reinterpret_cast<char*>(m_stackPointerAtVMEntry);
-        m_stackLimit = wtfThreadData().stack().recursionLimit(startOfStack, Options::maxPerThreadStackUsage(), m_reservedZoneSize);
+        m_jsCPUStackLimit = wtfThreadData().stack().recursionLimit(startOfStack, Options::maxPerThreadStackUsage(), m_reservedZoneSize);
     } else {
-        m_stackLimit = wtfThreadData().stack().recursionLimit(m_reservedZoneSize);
+        m_jsCPUStackLimit = wtfThreadData().stack().recursionLimit(m_reservedZoneSize);
     }
 
 #if PLATFORM(WIN)
-    if (lastStackLimit != m_stackLimit)
-        preCommitStackMemory(m_stackLimit);
+    if (lastJSCPUStackLimit != m_jsCPUStackLimit)
+        preCommitStackMemory(m_jsCPUStackLimit);
 #endif
 }
 

Modified: trunk/Source/_javascript_Core/runtime/VM.h (202861 => 202862)


--- trunk/Source/_javascript_Core/runtime/VM.h	2016-07-06 17:04:28 UTC (rev 202861)
+++ trunk/Source/_javascript_Core/runtime/VM.h	2016-07-06 17:19:20 UTC (rev 202862)
@@ -461,18 +461,18 @@
     size_t reservedZoneSize() const { return m_reservedZoneSize; }
     size_t updateReservedZoneSize(size_t reservedZoneSize);
 
+    void* jsCPUStackLimit() { return m_jsCPUStackLimit; }
+    void** addressOfJSCPUStackLimit() { return &m_jsCPUStackLimit; }
 #if !ENABLE(JIT)
-    void* jsStackLimit() { return m_jsStackLimit; }
-    void setJSStackLimit(void* limit) { m_jsStackLimit = limit; }
+    void* jsEmulatedStackLimit() { return m_jsEmulatedStackLimit; }
+    void setJSEmulatedStackLimit(void* limit) { m_jsEmulatedStackLimit = limit; }
 #endif
-    void* stackLimit() { return m_stackLimit; }
-    void** addressOfStackLimit() { return &m_stackLimit; }
 
     bool isSafeToRecurse(size_t neededStackInBytes = 0) const
     {
         ASSERT(wtfThreadData().stack().isGrowingDownward());
         int8_t* curr = reinterpret_cast<int8_t*>(&curr);
-        int8_t* limit = reinterpret_cast<int8_t*>(m_stackLimit);
+        int8_t* limit = reinterpret_cast<int8_t*>(m_jsCPUStackLimit);
         return curr >= limit && static_cast<size_t>(curr - limit) >= neededStackInBytes;
     }
 
@@ -642,20 +642,23 @@
 #if ENABLE(GC_VALIDATION)
     const ClassInfo* m_initializingObjectClass;
 #endif
+
     void* m_stackPointerAtVMEntry;
     size_t m_reservedZoneSize;
-#if !ENABLE(JIT)
-    struct {
-        void* m_stackLimit;
-        void* m_jsStackLimit;
+#if ENABLE(JIT)
+    union {
+        void* m_jsCPUStackLimit { nullptr };
+        void* m_llintStackLimit;
     };
 #else
+    void* m_jsCPUStackLimit { nullptr };
     union {
-        void* m_stackLimit;
-        void* m_jsStackLimit;
+        void* m_jsEmulatedStackLimit { nullptr };
+        void* m_llintStackLimit;
     };
 #endif
     void* m_lastStackTop;
+
     Exception* m_exception { nullptr };
     Exception* m_lastException { nullptr };
     bool m_failNextNewCodeBlock { false };

Modified: trunk/Source/_javascript_Core/wasm/WASMFunctionCompiler.h (202861 => 202862)


--- trunk/Source/_javascript_Core/wasm/WASMFunctionCompiler.h	2016-07-06 17:04:28 UTC (rev 202861)
+++ trunk/Source/_javascript_Core/wasm/WASMFunctionCompiler.h	2016-07-06 17:19:20 UTC (rev 202862)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2015-2016 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -135,7 +135,7 @@
         m_beginLabel = label();
 
         addPtr(TrustedImm32(-m_calleeSaveSpace - WTF::roundUpToMultipleOf(stackAlignmentRegisters(), m_stackHeight) * sizeof(StackSlot) - maxFrameExtentForSlowPathCall), GPRInfo::callFrameRegister, GPRInfo::regT1);
-        m_stackOverflow = branchPtr(Above, AbsoluteAddress(m_vm->addressOfStackLimit()), GPRInfo::regT1);
+        m_stackOverflow = branchPtr(Above, AbsoluteAddress(m_vm->addressOfJSCPUStackLimit()), GPRInfo::regT1);
 
         move(GPRInfo::regT1, stackPointerRegister);
         checkStackPointerAlignment();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to