Title: [161174] branches/jsCStack/Source/_javascript_Core
Revision
161174
Author
[email protected]
Date
2013-12-30 23:22:21 -0800 (Mon, 30 Dec 2013)

Log Message

CStack: Introduce tracking of the top VMEntryScope.
https://bugs.webkit.org/show_bug.cgi?id=126334.

Not yet reviewed.

When we start measuring the stack usage of each VMEntryScope, we'll need
to know which VMEntryScope is the top (most recent) one, not just the
first one.

Also, for correctness, in JSStack::updateStackLimit(), when we set a new
jsStackLimit, we should set it on the top VMEntryScope, and not on the
first (oldest) one. This is because the 2 scopes may be on 2 different
thread stacks, and the most present stack limits only apply to the most
recent scope. That said, presently, VMEntryScope::updateStackLimits()
does not rely on any scope specific data yet. So, calling updateStackLimits()
on the oldest VMEntryScope hasn't manifested any issues yet. Regardless,
this is now fixed.

* interpreter/JSStack.cpp:
(JSC::JSStack::updateStackLimit):
* runtime/VM.cpp:
(JSC::VM::VM):
* runtime/VM.h:
* runtime/VMEntryScope.cpp:
(JSC::VMEntryScope::VMEntryScope):
(JSC::VMEntryScope::~VMEntryScope):
* runtime/VMEntryScope.h:

Modified Paths

Diff

Modified: branches/jsCStack/Source/_javascript_Core/ChangeLog (161173 => 161174)


--- branches/jsCStack/Source/_javascript_Core/ChangeLog	2013-12-31 06:54:20 UTC (rev 161173)
+++ branches/jsCStack/Source/_javascript_Core/ChangeLog	2013-12-31 07:22:21 UTC (rev 161174)
@@ -1,5 +1,35 @@
 2013-12-30  Mark Lam  <[email protected]>
 
+        CStack: Introduce tracking of the top VMEntryScope.
+        https://bugs.webkit.org/show_bug.cgi?id=126334.
+
+        Not yet reviewed.
+
+        When we start measuring the stack usage of each VMEntryScope, we'll need
+        to know which VMEntryScope is the top (most recent) one, not just the
+        first one.
+
+        Also, for correctness, in JSStack::updateStackLimit(), when we set a new
+        jsStackLimit, we should set it on the top VMEntryScope, and not on the
+        first (oldest) one. This is because the 2 scopes may be on 2 different
+        thread stacks, and the most present stack limits only apply to the most
+        recent scope. That said, presently, VMEntryScope::updateStackLimits()
+        does not rely on any scope specific data yet. So, calling updateStackLimits()
+        on the oldest VMEntryScope hasn't manifested any issues yet. Regardless,
+        this is now fixed.
+
+        * interpreter/JSStack.cpp:
+        (JSC::JSStack::updateStackLimit):
+        * runtime/VM.cpp:
+        (JSC::VM::VM):
+        * runtime/VM.h:
+        * runtime/VMEntryScope.cpp:
+        (JSC::VMEntryScope::VMEntryScope):
+        (JSC::VMEntryScope::~VMEntryScope):
+        * runtime/VMEntryScope.h:
+
+2013-12-30  Mark Lam  <[email protected]>
+
         CStack: Refactor to split the tracking of the jsStackLimit from the native stackLimit.
         https://bugs.webkit.org/show_bug.cgi?id=126331.
 

Modified: branches/jsCStack/Source/_javascript_Core/interpreter/JSStack.cpp (161173 => 161174)


--- branches/jsCStack/Source/_javascript_Core/interpreter/JSStack.cpp	2013-12-31 06:54:20 UTC (rev 161173)
+++ branches/jsCStack/Source/_javascript_Core/interpreter/JSStack.cpp	2013-12-31 07:22:21 UTC (rev 161174)
@@ -204,8 +204,8 @@
     else
         disableErrorStackReserve();
 #endif
-    if (m_vm.firstEntryScope)
-        m_vm.firstEntryScope->updateStackLimits();
+    if (m_vm.topEntryScope)
+        m_vm.topEntryScope->updateStackLimits();
 }
 
 } // namespace JSC

Modified: branches/jsCStack/Source/_javascript_Core/runtime/VM.cpp (161173 => 161174)


--- branches/jsCStack/Source/_javascript_Core/runtime/VM.cpp	2013-12-31 06:54:20 UTC (rev 161173)
+++ branches/jsCStack/Source/_javascript_Core/runtime/VM.cpp	2013-12-31 07:22:21 UTC (rev 161174)
@@ -199,6 +199,7 @@
     , jsFinalObjectClassInfo(JSFinalObject::info())
     , sizeOfLastScratchBuffer(0)
     , firstEntryScope(0)
+    , topEntryScope(0)
     , m_enabledProfiler(0)
     , m_regExpCache(new RegExpCache(this))
 #if ENABLE(REGEXP_TRACING)

Modified: branches/jsCStack/Source/_javascript_Core/runtime/VM.h (161173 => 161174)


--- branches/jsCStack/Source/_javascript_Core/runtime/VM.h	2013-12-31 06:54:20 UTC (rev 161173)
+++ branches/jsCStack/Source/_javascript_Core/runtime/VM.h	2013-12-31 07:22:21 UTC (rev 161174)
@@ -427,6 +427,7 @@
         void gatherConservativeRoots(ConservativeRoots&);
 
         VMEntryScope* firstEntryScope;
+        VMEntryScope* topEntryScope;
 
         HashSet<JSObject*> stringRecursionCheckVisitedObjects;
 

Modified: branches/jsCStack/Source/_javascript_Core/runtime/VMEntryScope.cpp (161173 => 161174)


--- branches/jsCStack/Source/_javascript_Core/runtime/VMEntryScope.cpp	2013-12-31 06:54:20 UTC (rev 161173)
+++ branches/jsCStack/Source/_javascript_Core/runtime/VMEntryScope.cpp	2013-12-31 07:22:21 UTC (rev 161174)
@@ -36,6 +36,7 @@
     , m_stack(wtfThreadData().stack())
     , m_globalObject(globalObject)
     , m_prevFirstEntryScope(vm.firstEntryScope)
+    , m_prevTopEntryScope(vm.topEntryScope)
     , m_prevStackLimit(vm.stackLimit())
 #if !ENABLE(LLINT_C_LOOP)
     , m_prevJSStackLimit(vm.jsStackLimit())
@@ -53,7 +54,9 @@
         // observe time xone changes.
         vm.resetDateCache();
     }
-    // Clear the exception stack between entries
+    vm.topEntryScope = this;
+
+    // Clear the captured exception stack between entries
     vm.clearExceptionStack();
 
     updateStackLimits();
@@ -63,6 +66,7 @@
 VMEntryScope::~VMEntryScope()
 {
     m_vm.firstEntryScope = m_prevFirstEntryScope;
+    m_vm.topEntryScope = m_prevTopEntryScope;
     m_vm.setStackLimit(m_prevStackLimit);
 #if !ENABLE(LLINT_C_LOOP)
     m_vm.setJSStackLimit(m_prevJSStackLimit);

Modified: branches/jsCStack/Source/_javascript_Core/runtime/VMEntryScope.h (161173 => 161174)


--- branches/jsCStack/Source/_javascript_Core/runtime/VMEntryScope.h	2013-12-31 06:54:20 UTC (rev 161173)
+++ branches/jsCStack/Source/_javascript_Core/runtime/VMEntryScope.h	2013-12-31 07:22:21 UTC (rev 161174)
@@ -57,6 +57,7 @@
 
     // The following pointers may point to a different thread's stack.
     VMEntryScope* m_prevFirstEntryScope;
+    VMEntryScope* m_prevTopEntryScope;
     void* m_prevStackLimit;
 #if !ENABLE(LLINT_C_LOOP)
     void* m_prevJSStackLimit;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to