Title: [115388] trunk
Revision
115388
Author
[email protected]
Date
2012-04-26 17:07:11 -0700 (Thu, 26 Apr 2012)

Log Message

Remove RegisterFile::end()/m_end
https://bugs.webkit.org/show_bug.cgi?id=85011

Reviewed by Gavin Barraclough.

Source/_javascript_Core:

Get rid of end() and m_end from RegisterFile.  From now on
we only care about the end of the committed region when calling
code.  When re-entering the VM we now plant the new CallFrame
immediately after whatever the current topCallFrame is.  This
required adding a routine to CallFrame to determine exactly what
we should be doing (in the absence of an existing CallFrame, we
can't reason about the frameExtent() so we check for that).

This also now means that the GC only marks the portion of the
RegisterFile that is actually in use, and that VM re-entry doesn't
exhaust the RegisterFile as rapidly.

* dfg/DFGOperations.cpp:
* heap/Heap.cpp:
(JSC::Heap::getConservativeRegisterRoots):
(JSC::Heap::markRoots):
* interpreter/CallFrame.h:
(JSC::ExecState::init):
(JSC::ExecState::startOfReusableRegisterFile):
(ExecState):
* interpreter/Interpreter.cpp:
(JSC::Interpreter::execute):
(JSC::Interpreter::executeCall):
(JSC::Interpreter::executeConstruct):
(JSC::Interpreter::prepareForRepeatCall):
(JSC::Interpreter::privateExecute):
* interpreter/Interpreter.h:
(JSC::Interpreter::execute):
* interpreter/RegisterFile.cpp:
(JSC::RegisterFile::growSlowCase):
(JSC::RegisterFile::gatherConservativeRoots):
* interpreter/RegisterFile.h:
(JSC::RegisterFile::commitEnd):
(JSC::RegisterFile::addressOfEnd):
(RegisterFile):
(JSC::RegisterFile::RegisterFile):
(JSC::RegisterFile::shrink):
(JSC::RegisterFile::grow):
* jit/JITStubs.cpp:
(JSC::DEFINE_STUB_FUNCTION):
(JSC::jitCompileFor):
(JSC::lazyLinkFor):
* llint/LLIntSlowPaths.cpp:
(JSC::LLInt::LLINT_SLOW_PATH_DECL):
(JSC::LLInt::handleHostCall):
* llint/LowLevelInterpreter.asm:
* runtime/CommonSlowPaths.h:
(JSC::CommonSlowPaths::arityCheckFor):

LayoutTests:

Now that we recurse on the top of the used portion of the stack we
can provide an error message even when the stack is completely full.

Also made sure we were consistent in which callframe we used when
creating stack overflow errors.

* fast/js/global-recursion-on-full-stack-expected.txt:
* fast/js/stack-trace-expected.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (115387 => 115388)


--- trunk/LayoutTests/ChangeLog	2012-04-27 00:00:44 UTC (rev 115387)
+++ trunk/LayoutTests/ChangeLog	2012-04-27 00:07:11 UTC (rev 115388)
@@ -1,3 +1,19 @@
+2012-04-26  Oliver Hunt  <[email protected]>
+
+        Remove RegisterFile::end()/m_end
+        https://bugs.webkit.org/show_bug.cgi?id=85011
+
+        Reviewed by Gavin Barraclough.
+
+        Now that we recurse on the top of the used portion of the stack we
+        can provide an error message even when the stack is completely full.
+
+        Also made sure we were consistent in which callframe we used when
+        creating stack overflow errors.
+
+        * fast/js/global-recursion-on-full-stack-expected.txt:
+        * fast/js/stack-trace-expected.txt:
+
 2012-04-26  Tom Zakrajsek  <[email protected]>
 
         Unreviewed gardening

Modified: trunk/LayoutTests/fast/js/global-recursion-on-full-stack-expected.txt (115387 => 115388)


--- trunk/LayoutTests/fast/js/global-recursion-on-full-stack-expected.txt	2012-04-27 00:00:44 UTC (rev 115387)
+++ trunk/LayoutTests/fast/js/global-recursion-on-full-stack-expected.txt	2012-04-27 00:07:11 UTC (rev 115388)
@@ -1,3 +1,3 @@
-CONSOLE MESSAGE: 
+CONSOLE MESSAGE: RangeError: Maximum call stack size exceeded.
 This tests global code recursion when the JS stack is full.
 PASS: Entering global code with a full JS stack did not crash, and did not allow continued recursion.

Modified: trunk/LayoutTests/fast/js/stack-trace-expected.txt (115387 => 115388)


--- trunk/LayoutTests/fast/js/stack-trace-expected.txt	2012-04-27 00:00:44 UTC (rev 115387)
+++ trunk/LayoutTests/fast/js/stack-trace-expected.txt	2012-04-27 00:07:11 UTC (rev 115388)
@@ -151,7 +151,7 @@
     99   selfRecursive1 at stack-trace.js:52
 
 --> Stack Trace:
-    0   selfRecursive2 at stack-trace.js:58
+    0   selfRecursive2 at stack-trace.js:62
     1   selfRecursive2 at stack-trace.js:62
     2   selfRecursive2 at stack-trace.js:62
     3   selfRecursive2 at stack-trace.js:62

Modified: trunk/Source/_javascript_Core/ChangeLog (115387 => 115388)


--- trunk/Source/_javascript_Core/ChangeLog	2012-04-27 00:00:44 UTC (rev 115387)
+++ trunk/Source/_javascript_Core/ChangeLog	2012-04-27 00:07:11 UTC (rev 115388)
@@ -1,3 +1,59 @@
+2012-04-26  Oliver Hunt  <[email protected]>
+
+        Remove RegisterFile::end()/m_end
+        https://bugs.webkit.org/show_bug.cgi?id=85011
+
+        Reviewed by Gavin Barraclough.
+
+        Get rid of end() and m_end from RegisterFile.  From now on
+        we only care about the end of the committed region when calling
+        code.  When re-entering the VM we now plant the new CallFrame
+        immediately after whatever the current topCallFrame is.  This
+        required adding a routine to CallFrame to determine exactly what
+        we should be doing (in the absence of an existing CallFrame, we
+        can't reason about the frameExtent() so we check for that).
+
+        This also now means that the GC only marks the portion of the
+        RegisterFile that is actually in use, and that VM re-entry doesn't
+        exhaust the RegisterFile as rapidly.
+
+        * dfg/DFGOperations.cpp:
+        * heap/Heap.cpp:
+        (JSC::Heap::getConservativeRegisterRoots):
+        (JSC::Heap::markRoots):
+        * interpreter/CallFrame.h:
+        (JSC::ExecState::init):
+        (JSC::ExecState::startOfReusableRegisterFile):
+        (ExecState):
+        * interpreter/Interpreter.cpp:
+        (JSC::Interpreter::execute):
+        (JSC::Interpreter::executeCall):
+        (JSC::Interpreter::executeConstruct):
+        (JSC::Interpreter::prepareForRepeatCall):
+        (JSC::Interpreter::privateExecute):
+        * interpreter/Interpreter.h:
+        (JSC::Interpreter::execute):
+        * interpreter/RegisterFile.cpp:
+        (JSC::RegisterFile::growSlowCase):
+        (JSC::RegisterFile::gatherConservativeRoots):
+        * interpreter/RegisterFile.h:
+        (JSC::RegisterFile::commitEnd):
+        (JSC::RegisterFile::addressOfEnd):
+        (RegisterFile):
+        (JSC::RegisterFile::RegisterFile):
+        (JSC::RegisterFile::shrink):
+        (JSC::RegisterFile::grow):
+        * jit/JITStubs.cpp:
+        (JSC::DEFINE_STUB_FUNCTION):
+        (JSC::jitCompileFor):
+        (JSC::lazyLinkFor):
+        * llint/LLIntSlowPaths.cpp:
+        (JSC::LLInt::LLINT_SLOW_PATH_DECL):
+        (JSC::LLInt::handleHostCall):
+        * llint/LowLevelInterpreter.asm:
+        * runtime/CommonSlowPaths.h:
+        (JSC::CommonSlowPaths::arityCheckFor):
+
 2012-04-26  Filip Pizlo  <[email protected]>
 
         DFG ARMv7 backend should optimize Float32 arrays

Modified: trunk/Source/_javascript_Core/dfg/DFGOperations.cpp (115387 => 115388)


--- trunk/Source/_javascript_Core/dfg/DFGOperations.cpp	2012-04-27 00:00:44 UTC (rev 115387)
+++ trunk/Source/_javascript_Core/dfg/DFGOperations.cpp	2012-04-27 00:07:11 UTC (rev 115388)
@@ -783,6 +783,7 @@
         }
     
         ASSERT(callType == CallTypeNone);
+        NativeCallFrameTracer tracer(globalData, exec);
         exec->globalData().exception = createNotAFunctionError(exec, callee);
         return 0;
     }
@@ -805,6 +806,7 @@
     }
     
     ASSERT(constructType == ConstructTypeNone);
+    NativeCallFrameTracer tracer(globalData, exec);
     exec->globalData().exception = createNotAConstructorError(exec, callee);
     return 0;
 }
@@ -813,13 +815,14 @@
 {
     ExecState* exec = execCallee->callerFrame();
     JSGlobalData* globalData = &exec->globalData();
-    NativeCallFrameTracer tracer(globalData, exec);
+    TopCallFrameSetter tracer(*globalData, exec);
     
     JSValue calleeAsValue = execCallee->calleeAsValue();
     JSCell* calleeAsFunctionCell = getJSFunction(calleeAsValue);
     if (!calleeAsFunctionCell)
         return handleHostCall(execCallee, calleeAsValue, kind);
-
+    
+    TopCallFrameSetter calleeTracer(*globalData, execCallee);
     JSFunction* callee = jsCast<JSFunction*>(calleeAsFunctionCell);
     execCallee->setScopeChain(callee->scopeUnchecked());
     ExecutableBase* executable = callee->executable();
@@ -832,6 +835,7 @@
         FunctionExecutable* functionExecutable = static_cast<FunctionExecutable*>(executable);
         JSObject* error = functionExecutable->compileFor(execCallee, callee->scope(), kind);
         if (error) {
+            TopCallFrameSetter tracer(*globalData, exec);
             globalData->exception = createStackOverflowError(exec);
             return 0;
         }

Modified: trunk/Source/_javascript_Core/heap/Heap.cpp (115387 => 115388)


--- trunk/Source/_javascript_Core/heap/Heap.cpp	2012-04-27 00:00:44 UTC (rev 115387)
+++ trunk/Source/_javascript_Core/heap/Heap.cpp	2012-04-27 00:07:11 UTC (rev 115388)
@@ -567,7 +567,7 @@
         CRASH();
     m_operationInProgress = Collection;
     ConservativeRoots registerFileRoots(&m_objectSpace.blocks(), &m_storageSpace);
-    registerFile().gatherConservativeRoots(registerFileRoots);
+    registerFile().gatherConservativeRoots(*m_globalData, registerFileRoots);
     size_t registerFileRootCount = registerFileRoots.size();
     JSCell** registerRoots = registerFileRoots.roots();
     for (size_t i = 0; i < registerFileRootCount; i++) {
@@ -602,7 +602,7 @@
     m_dfgCodeBlocks.clearMarks();
     {
         GCPHASE(GatherRegisterFileRoots);
-        registerFile().gatherConservativeRoots(registerFileRoots, m_dfgCodeBlocks);
+        registerFile().gatherConservativeRoots(*m_globalData, registerFileRoots, m_dfgCodeBlocks);
     }
 #if ENABLE(GGC)
     MarkedBlock::DirtyCellVector dirtyCells;

Modified: trunk/Source/_javascript_Core/interpreter/CallFrame.cpp (115387 => 115388)


--- trunk/Source/_javascript_Core/interpreter/CallFrame.cpp	2012-04-27 00:00:44 UTC (rev 115387)
+++ trunk/Source/_javascript_Core/interpreter/CallFrame.cpp	2012-04-27 00:07:11 UTC (rev 115388)
@@ -42,14 +42,13 @@
     interpreter()->retrieveLastCaller(this, signedLineNumber, sourceID, urlString, function);
     dataLog("Callpoint => %s:%d\n", urlString.utf8().data(), signedLineNumber);
 }
+#endif
 
 RegisterFile* CallFrame::registerFile()
 {
     return &interpreter()->registerFile();
 }
 
-#endif
-
 #if USE(JSVALUE32_64)
 unsigned CallFrame::bytecodeOffsetForNonDFGCode() const
 {

Modified: trunk/Source/_javascript_Core/interpreter/CallFrame.h (115387 => 115388)


--- trunk/Source/_javascript_Core/interpreter/CallFrame.h	2012-04-27 00:00:44 UTC (rev 115387)
+++ trunk/Source/_javascript_Core/interpreter/CallFrame.h	2012-04-27 00:07:11 UTC (rev 115388)
@@ -171,7 +171,7 @@
             CallFrame* callerFrame, int argc, JSObject* callee)
         {
             ASSERT(callerFrame); // Use noCaller() rather than 0 for the outer host call frame caller.
-            ASSERT(callerFrame == noCaller() || callerFrame->removeHostCallFrameFlag()->registerFile()->end() >= this);
+            ASSERT(callerFrame == noCaller() || callerFrame->removeHostCallFrameFlag()->registerFile()->commitEnd() >= this);
 
             setCodeBlock(codeBlock);
             setScopeChain(scopeChain);
@@ -254,14 +254,21 @@
         // happening.
         CallFrame* trueCallFrameFromVMCode() { return trueCallFrame(AbstractPC()); }
 
+        Register* startOfReusableRegisterFile()
+        {
+            CallFrame* result = globalData().topCallFrame;
+            if (result == noCaller() || result == registerFile()->begin())
+                return registerFile()->begin();
+            return result->frameExtent();
+        }
+        
     private:
         static const intptr_t HostCallFrameFlag = 1;
         static const int s_thisArgumentOffset = -1 - RegisterFile::CallFrameHeaderSize;
         static const int s_firstArgumentOffset = s_thisArgumentOffset - 1;
 
-#ifndef NDEBUG
         RegisterFile* registerFile();
-#endif
+
 #if ENABLE(DFG_JIT)
         bool isInlineCallFrameSlow();
 #endif

Modified: trunk/Source/_javascript_Core/interpreter/Interpreter.cpp (115387 => 115388)


--- trunk/Source/_javascript_Core/interpreter/Interpreter.cpp	2012-04-27 00:00:44 UTC (rev 115387)
+++ trunk/Source/_javascript_Core/interpreter/Interpreter.cpp	2012-04-27 00:07:11 UTC (rev 115388)
@@ -1201,7 +1201,7 @@
         return checkedReturn(throwError(callFrame, error));
     CodeBlock* codeBlock = &program->generatedBytecode();
 
-    Register* oldEnd = m_registerFile.end();
+    Register* oldEnd = callFrame->startOfReusableRegisterFile();
     Register* newEnd = oldEnd + codeBlock->numParameters() + RegisterFile::CallFrameHeaderSize + codeBlock->m_numCalleeRegisters;
     if (!m_registerFile.grow(newEnd))
         return checkedReturn(throwStackOverflowError(callFrame));
@@ -1250,7 +1250,7 @@
     if (m_reentryDepth >= MaxSmallThreadReentryDepth && m_reentryDepth >= callFrame->globalData().maxReentryDepth)
         return checkedReturn(throwStackOverflowError(callFrame));
 
-    Register* oldEnd = m_registerFile.end();
+    Register* oldEnd = callFrame->startOfReusableRegisterFile();
     ASSERT(callFrame->frameExtent() <= oldEnd || callFrame == callFrame->scopeChain()->globalObject->globalExec());
     int argCount = 1 + args.size(); // implicit "this" parameter
     size_t registerOffset = argCount + RegisterFile::CallFrameHeaderSize;
@@ -1347,7 +1347,7 @@
     if (m_reentryDepth >= MaxSmallThreadReentryDepth && m_reentryDepth >= callFrame->globalData().maxReentryDepth)
         return checkedReturn(throwStackOverflowError(callFrame));
 
-    Register* oldEnd = m_registerFile.end();
+    Register* oldEnd = callFrame->startOfReusableRegisterFile();
     int argCount = 1 + args.size(); // implicit "this" parameter
     size_t registerOffset = argCount + RegisterFile::CallFrameHeaderSize;
 
@@ -1449,7 +1449,7 @@
         return CallFrameClosure();
     }
 
-    Register* oldEnd = m_registerFile.end();
+    Register* oldEnd = callFrame->startOfReusableRegisterFile();
     size_t registerOffset = argumentCountIncludingThis + RegisterFile::CallFrameHeaderSize;
 
     CallFrame* newCallFrame = CallFrame::create(oldEnd + registerOffset);
@@ -1575,7 +1575,6 @@
         }
     }
 
-    Register* oldEnd = m_registerFile.end();
     Register* newEnd = m_registerFile.begin() + globalRegisterOffset + codeBlock->m_numCalleeRegisters;
     if (!m_registerFile.grow(newEnd)) {
         if (pushedScope)
@@ -1619,7 +1618,6 @@
     if (*profiler)
         (*profiler)->didExecute(callFrame, eval->sourceURL(), eval->lineNo());
 
-    m_registerFile.shrink(oldEnd);
     if (pushedScope)
         scopeChain->pop();
     return checkedReturn(result);
@@ -4510,6 +4508,7 @@
             callFrame = slideRegisterWindowForCall(newCodeBlock, registerFile, callFrame, registerOffset, argCount);
             if (UNLIKELY(!callFrame)) {
                 callFrame = previousCallFrame;
+                *topCallFrameSlot = callFrame;
                 exceptionValue = createStackOverflowError(callFrame);
                 goto vm_throw;
             }
@@ -4588,6 +4587,7 @@
             CodeBlock* newCodeBlock = &callData.js.functionExecutable->generatedBytecodeForCall();
             newCallFrame = slideRegisterWindowForCall(newCodeBlock, registerFile, newCallFrame, 0, argCount);
             if (UNLIKELY(!newCallFrame)) {
+                *topCallFrameSlot = callFrame;
                 exceptionValue = createStackOverflowError(callFrame);
                 goto vm_throw;
             }
@@ -4909,6 +4909,7 @@
             callFrame = slideRegisterWindowForCall(newCodeBlock, registerFile, callFrame, registerOffset, argCount);
             if (UNLIKELY(!callFrame)) {
                 callFrame = previousCallFrame;
+                *topCallFrameSlot = callFrame;
                 exceptionValue = createStackOverflowError(callFrame);
                 goto vm_throw;
             }

Modified: trunk/Source/_javascript_Core/interpreter/Interpreter.h (115387 => 115388)


--- trunk/Source/_javascript_Core/interpreter/Interpreter.h	2012-04-27 00:00:44 UTC (rev 115387)
+++ trunk/Source/_javascript_Core/interpreter/Interpreter.h	2012-04-27 00:07:11 UTC (rev 115388)
@@ -294,7 +294,7 @@
 
     inline JSValue Interpreter::execute(EvalExecutable* eval, CallFrame* callFrame, JSValue thisValue, ScopeChainNode* scopeChain)
     {
-        return execute(eval, callFrame, thisValue, scopeChain, m_registerFile.size() + 1 + RegisterFile::CallFrameHeaderSize);
+        return execute(eval, callFrame, thisValue, scopeChain, (callFrame->startOfReusableRegisterFile() - m_registerFile.begin()) + 1 + RegisterFile::CallFrameHeaderSize);
     }
 
     JSValue eval(CallFrame*);

Modified: trunk/Source/_javascript_Core/interpreter/RegisterFile.cpp (115387 => 115388)


--- trunk/Source/_javascript_Core/interpreter/RegisterFile.cpp	2012-04-27 00:00:44 UTC (rev 115387)
+++ trunk/Source/_javascript_Core/interpreter/RegisterFile.cpp	2012-04-27 00:07:11 UTC (rev 115388)
@@ -52,10 +52,7 @@
 
 bool RegisterFile::growSlowCase(Register* newEnd)
 {
-    if (newEnd <= m_commitEnd) {
-        m_end = newEnd;
-        return true;
-    }
+    ASSERT(newEnd > m_commitEnd);
 
     long delta = roundUpAllocationSize(reinterpret_cast<char*>(newEnd) - reinterpret_cast<char*>(m_commitEnd), commitSize);
     if (reinterpret_cast<char*>(m_commitEnd) + delta > static_cast<char*>(m_reservation.base()) + m_reservation.size())
@@ -64,18 +61,21 @@
     m_reservation.commit(m_commitEnd, delta);
     addToCommittedByteCount(delta);
     m_commitEnd = reinterpret_cast_ptr<Register*>(reinterpret_cast<char*>(m_commitEnd) + delta);
-    m_end = newEnd;
     return true;
 }
 
-void RegisterFile::gatherConservativeRoots(ConservativeRoots& conservativeRoots)
+void RegisterFile::gatherConservativeRoots(JSGlobalData& globalData, ConservativeRoots& conservativeRoots)
 {
-    conservativeRoots.add(begin(), end());
+    if (globalData.topCallFrame == CallFrame::noCaller())
+        return;
+    conservativeRoots.add(begin(), globalData.topCallFrame->frameExtent());
 }
 
-void RegisterFile::gatherConservativeRoots(ConservativeRoots& conservativeRoots, DFGCodeBlocks& dfgCodeBlocks)
+void RegisterFile::gatherConservativeRoots(JSGlobalData& globalData, ConservativeRoots& conservativeRoots, DFGCodeBlocks& dfgCodeBlocks)
 {
-    conservativeRoots.add(begin(), end(), dfgCodeBlocks);
+    if (globalData.topCallFrame == CallFrame::noCaller())
+        return;
+    conservativeRoots.add(begin(), globalData.topCallFrame->frameExtent(), dfgCodeBlocks);
 }
 
 void RegisterFile::releaseExcessCapacity()

Modified: trunk/Source/_javascript_Core/interpreter/RegisterFile.h (115387 => 115388)


--- trunk/Source/_javascript_Core/interpreter/RegisterFile.h	2012-04-27 00:00:44 UTC (rev 115387)
+++ trunk/Source/_javascript_Core/interpreter/RegisterFile.h	2012-04-27 00:07:11 UTC (rev 115388)
@@ -63,12 +63,11 @@
         RegisterFile(size_t capacity = defaultCapacity);
         ~RegisterFile();
         
-        void gatherConservativeRoots(ConservativeRoots&);
-        void gatherConservativeRoots(ConservativeRoots&, DFGCodeBlocks&);
+        void gatherConservativeRoots(JSGlobalData&, ConservativeRoots&);
+        void gatherConservativeRoots(JSGlobalData&, ConservativeRoots&, DFGCodeBlocks&);
 
         Register* begin() const { return static_cast<Register*>(m_reservation.base()); }
-        Register* end() const { return m_end; }
-        size_t size() const { return end() - begin(); }
+        Register* commitEnd() const { return m_commitEnd; }
 
         bool grow(Register*);
         void shrink(Register*);
@@ -78,7 +77,7 @@
 
         Register* const * addressOfEnd() const
         {
-            return &m_end;
+            return &m_commitEnd;
         }
 
     private:
@@ -87,33 +86,28 @@
         bool growSlowCase(Register*);
         void releaseExcessCapacity();
         void addToCommittedByteCount(long);
-        Register* m_end;
         Register* m_commitEnd;
         PageReservation m_reservation;
     };
 
     inline RegisterFile::RegisterFile(size_t capacity)
-        : m_end(0)
     {
         ASSERT(capacity && isPageAligned(capacity));
 
         m_reservation = PageReservation::reserve(roundUpAllocationSize(capacity * sizeof(Register), commitSize), OSAllocator::JSVMStackPages);
-        m_end = static_cast<Register*>(m_reservation.base());
         m_commitEnd = static_cast<Register*>(m_reservation.base());
     }
 
     inline void RegisterFile::shrink(Register* newEnd)
     {
-        if (newEnd >= m_end)
-            return;
-        m_end = newEnd;
-        if (m_end == m_reservation.base() && (m_commitEnd - begin()) >= maxExcessCapacity)
+        ASSERT(newEnd <= m_commitEnd);
+        if (newEnd == m_reservation.base() && (m_commitEnd - begin()) >= maxExcessCapacity)
             releaseExcessCapacity();
     }
 
     inline bool RegisterFile::grow(Register* newEnd)
     {
-        if (newEnd <= m_end)
+        if (newEnd <= m_commitEnd)
             return true;
         return growSlowCase(newEnd);
     }

Modified: trunk/Source/_javascript_Core/jit/JITStubs.cpp (115387 => 115388)


--- trunk/Source/_javascript_Core/jit/JITStubs.cpp	2012-04-27 00:00:44 UTC (rev 115387)
+++ trunk/Source/_javascript_Core/jit/JITStubs.cpp	2012-04-27 00:07:11 UTC (rev 115388)
@@ -1369,8 +1369,14 @@
     STUB_INIT_STACK_FRAME(stackFrame);
     CallFrame* callFrame = stackFrame.callFrame;
 
-    if (UNLIKELY(!stackFrame.registerFile->grow(&callFrame->registers()[callFrame->codeBlock()->m_numCalleeRegisters])))
-        return throwExceptionFromOpCall<void*>(stackFrame, callFrame, STUB_RETURN_ADDRESS, createStackOverflowError(callFrame->callerFrame()));
+    if (UNLIKELY(!stackFrame.registerFile->grow(&callFrame->registers()[callFrame->codeBlock()->m_numCalleeRegisters]))) {
+        JSValue value;
+        {
+            TopCallFrameSetter tracer(callFrame->globalData(), callFrame->callerFrame());
+            value = createStackOverflowError(callFrame->callerFrame());
+        }
+        return throwExceptionFromOpCall<void*>(stackFrame, callFrame, STUB_RETURN_ADDRESS, value);
+    }
 
     return callFrame;
 }
@@ -2153,6 +2159,7 @@
 inline void* jitCompileFor(CallFrame* callFrame, CodeSpecializationKind kind)
 {
     JSFunction* function = jsCast<JSFunction*>(callFrame->callee());
+    callFrame->setCodeBlock(0);
     ASSERT(!function->isHostFunction());
     FunctionExecutable* executable = function->jsExecutable();
     ScopeChainNode* callDataScopeChain = function->scope();
@@ -2204,8 +2211,14 @@
     CallFrame* callFrame = stackFrame.callFrame;
 
     CallFrame* newCallFrame = CommonSlowPaths::arityCheckFor(callFrame, stackFrame.registerFile, CodeForCall);
-    if (!newCallFrame)
-        return throwExceptionFromOpCall<void*>(stackFrame, callFrame, STUB_RETURN_ADDRESS, createStackOverflowError(callFrame->callerFrame()));
+    if (!newCallFrame) {
+        JSValue value;
+        {
+            TopCallFrameSetter tracer(callFrame->globalData(), callFrame->callerFrame());
+            value = createStackOverflowError(callFrame->callerFrame());
+        }
+        return throwExceptionFromOpCall<void*>(stackFrame, callFrame, STUB_RETURN_ADDRESS, value);
+    }
 
     return newCallFrame;
 }
@@ -2217,8 +2230,14 @@
     CallFrame* callFrame = stackFrame.callFrame;
 
     CallFrame* newCallFrame = CommonSlowPaths::arityCheckFor(callFrame, stackFrame.registerFile, CodeForConstruct);
-    if (!newCallFrame)
-        return throwExceptionFromOpCall<void*>(stackFrame, callFrame, STUB_RETURN_ADDRESS, createStackOverflowError(callFrame->callerFrame()));
+    if (!newCallFrame) {
+        JSValue value;
+        {
+            TopCallFrameSetter tracer(callFrame->globalData(), callFrame->callerFrame());
+            value = createStackOverflowError(callFrame->callerFrame());
+        }
+        return throwExceptionFromOpCall<void*>(stackFrame, callFrame, STUB_RETURN_ADDRESS, value);
+    }
 
     return newCallFrame;
 }
@@ -2227,6 +2246,7 @@
 {
     JSFunction* callee = jsCast<JSFunction*>(callFrame->callee());
     ExecutableBase* executable = callee->executable();
+    callFrame->setCodeBlock(0);
 
     MacroAssemblerCodePtr codePtr;
     CodeBlock* codeBlock = 0;
@@ -2302,7 +2322,12 @@
     ASSERT(callType != CallTypeJS);
     if (callType != CallTypeHost) {
         ASSERT(callType == CallTypeNone);
-        return throwExceptionFromOpCall<EncodedJSValue>(stackFrame, callFrame, STUB_RETURN_ADDRESS, createNotAFunctionError(callFrame->callerFrame(), callee));
+        JSValue value;
+        {
+            NativeCallFrameTracer tracer(&callFrame->globalData(), callFrame->callerFrame());
+            value = createNotAFunctionError(callFrame->callerFrame(), callee);
+        }
+        return throwExceptionFromOpCall<EncodedJSValue>(stackFrame, callFrame, STUB_RETURN_ADDRESS, value);
     }
 
     EncodedJSValue returnValue;
@@ -2408,7 +2433,12 @@
     ASSERT(constructType != ConstructTypeJS);
     if (constructType != ConstructTypeHost) {
         ASSERT(constructType == ConstructTypeNone);
-        return throwExceptionFromOpCall<EncodedJSValue>(stackFrame, callFrame, STUB_RETURN_ADDRESS, createNotAConstructorError(callFrame->callerFrame(), callee));
+        JSValue value;
+        {
+            NativeCallFrameTracer tracer(&callFrame->globalData(), callFrame->callerFrame());
+            value = createNotAConstructorError(callFrame->callerFrame(), callee);
+        }
+        return throwExceptionFromOpCall<EncodedJSValue>(stackFrame, callFrame, STUB_RETURN_ADDRESS, value);
     }
 
     EncodedJSValue returnValue;

Modified: trunk/Source/_javascript_Core/llint/LLIntSlowPaths.cpp (115387 => 115388)


--- trunk/Source/_javascript_Core/llint/LLIntSlowPaths.cpp	2012-04-27 00:00:44 UTC (rev 115387)
+++ trunk/Source/_javascript_Core/llint/LLIntSlowPaths.cpp	2012-04-27 00:07:11 UTC (rev 115388)
@@ -388,10 +388,11 @@
     dataLog("Num vars = %u.\n", exec->codeBlock()->m_numVars);
     dataLog("Current end is at %p.\n", exec->globalData().interpreter->registerFile().end());
 #endif
-    ASSERT(&exec->registers()[exec->codeBlock()->m_numCalleeRegisters] > exec->globalData().interpreter->registerFile().end());
+    ASSERT(&exec->registers()[exec->codeBlock()->m_numCalleeRegisters] > exec->globalData().interpreter->registerFile().commitEnd());
     if (UNLIKELY(!globalData.interpreter->registerFile().grow(&exec->registers()[exec->codeBlock()->m_numCalleeRegisters]))) {
         ReturnAddressPtr returnPC = exec->returnPC();
         exec = exec->callerFrame();
+        exec->globalData().topCallFrame = exec;
         globalData.exception = createStackOverflowError(exec);
         interpreterThrowInCaller(exec, returnPC);
         pc = returnToThrowForThrownException(exec);
@@ -406,6 +407,7 @@
     if (!newExec) {
         ReturnAddressPtr returnPC = exec->returnPC();
         exec = exec->callerFrame();
+        exec->globalData().topCallFrame = exec;
         globalData.exception = createStackOverflowError(exec);
         interpreterThrowInCaller(exec, returnPC);
         LLINT_RETURN_TWO(bitwise_cast<void*>(static_cast<uintptr_t>(1)), exec);
@@ -420,6 +422,7 @@
     if (!newExec) {
         ReturnAddressPtr returnPC = exec->returnPC();
         exec = exec->callerFrame();
+        exec->globalData().topCallFrame = exec;
         globalData.exception = createStackOverflowError(exec);
         interpreterThrowInCaller(exec, returnPC);
         LLINT_RETURN_TWO(bitwise_cast<void*>(static_cast<uintptr_t>(1)), exec);
@@ -1237,6 +1240,7 @@
 #endif
 
         ASSERT(callType == CallTypeNone);
+        NativeCallFrameTracer tracer(&globalData, exec);
         LLINT_CALL_THROW(exec, pc, createNotAFunctionError(exec, callee));
     }
 
@@ -1260,6 +1264,7 @@
 #endif
 
     ASSERT(constructType == ConstructTypeNone);
+    NativeCallFrameTracer tracer(&globalData, exec);
     LLINT_CALL_THROW(exec, pc, createNotAConstructorError(exec, callee));
 }
 

Modified: trunk/Source/_javascript_Core/llint/LowLevelInterpreter.asm (115387 => 115388)


--- trunk/Source/_javascript_Core/llint/LowLevelInterpreter.asm	2012-04-27 00:00:44 UTC (rev 115387)
+++ trunk/Source/_javascript_Core/llint/LowLevelInterpreter.asm	2012-04-27 00:07:11 UTC (rev 115388)
@@ -273,7 +273,7 @@
     loadp JSGlobalData::interpreter[t2], t2   # FIXME: Can get to the RegisterFile from the JITStackFrame
     lshifti 3, t0
     addp t0, cfr, t0
-    bpaeq Interpreter::m_registerFile + RegisterFile::m_end[t2], t0, .stackHeightOK
+    bpaeq Interpreter::m_registerFile + RegisterFile::m_commitEnd[t2], t0, .stackHeightOK
 
     # Stack height check failed - need to call a slow_path.
     callSlowPath(_llint_register_file_check)

Modified: trunk/Source/_javascript_Core/runtime/CommonSlowPaths.h (115387 => 115388)


--- trunk/Source/_javascript_Core/runtime/CommonSlowPaths.h	2012-04-27 00:00:44 UTC (rev 115387)
+++ trunk/Source/_javascript_Core/runtime/CommonSlowPaths.h	2012-04-27 00:07:11 UTC (rev 115388)
@@ -70,7 +70,7 @@
         dst[i] = jsUndefined();
 
     ExecState* newExec = ExecState::create(dst);
-    ASSERT((void*)newExec <= registerFile->end());
+    ASSERT((void*)newExec <= registerFile->commitEnd());
     return newExec;
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to