<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[164018] trunk/Source</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/164018">164018</a></dd>
<dt>Author</dt> <dd>mark.lam@apple.com</dd>
<dt>Date</dt> <dd>2014-02-12 22:50:09 -0800 (Wed, 12 Feb 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>No need to save reservedZoneSize when dropping the JSLock.
&lt;https://webkit.org/b/128719&gt;

Reviewed by Geoffrey Garen.

Source/JavaScriptCore: 

The reservedZoneSize does not change due to the VM being run on a different
thread. Hence, there is no need to save and restore its value. Instead of
calling updateReservedZoneSize() to update the stack limit, we now call
setStackPointerAtVMEntry() to do the job. setStackPointerAtVMEntry()
will update the stackPointerAtVMEntry and delegate to updateStackLimit() to
update the stack limit based on the new stackPointerAtVMEntry.

* runtime/ErrorHandlingScope.cpp:
(JSC::ErrorHandlingScope::ErrorHandlingScope):
(JSC::ErrorHandlingScope::~ErrorHandlingScope):
- Previously, we initialize stackPointerAtVMEntry in VMEntryScope. This
  means that the stackPointerAtVMEntry may not be initialize when we
  instantiate the ErrorHandlingScope. And so, we needed to initialize the
  stackPointerAtVMEntry in the ErrorHandlingScope constructor if it's not
  already initialized.

  Now that we initialize the stackPointerAtVMEntry when we lock the VM JSLock,
  we are guaranteed that it will be initialized by the time we instantiate
  the ErrorHandlingScope. Hence, we can change the ErrorHandlingScope code
  to just assert that the stackPointerAtVMEntry is initialized instead.

* runtime/InitializeThreading.cpp:
(JSC::initializeThreading):
- We no longer need to save the reservedZoneSize. Remove the related code.

* runtime/JSLock.cpp:
(JSC::JSLock::lock):
- When we grab the JSLock mutex for the first time, there is no reason why
  the stackPointerAtVMEntry should be initialized. By definition, grabbing
  the lock for the first time equates to entering the VM for the first time.
  Hence, we can just assert that stackPointerAtVMEntry is uninitialized,
  and initialize it unconditionally.

  The only exception to this is if we're locking to regrab the JSLock in
  grabAllLocks(), but grabAllLocks() will take care of restoring the
  stackPointerAtVMEntry in that case after lock() returns. stackPointerAtVMEntry
  should still be 0 when we've just locked the JSLock. So, the above assertion
  always holds true.

  Note: VM::setStackPointerAtVMEntry() will take care of calling
  VM::updateStackLimit() based on the new stackPointerAtVMEntry.

- There is no need to save the reservedZoneSize. The reservedZoneSize is
  set to Options::reservedZoneSize() when the VM is initialized. Thereafter,
  the ErrorHandlingScope will change it to Options::errorModeReservedZoneSize()
  when we're handling an error, and it will restore it afterwards. There is
  no other reason we should be changing the reservedZoneSize. Hence, we can
  remove the unnecessary code to save it here.

(JSC::JSLock::unlock):
- Similarly, when the lockCount reaches 0 in unlock(), it is synonymous with
  exiting the VM. Hence, we should just clear the stackPointerAtVMEntry and
  update the stackLimit. Exiting the VM should have no effect on the VM
  reservedZoneSize. Hence, we can remove the unnecessary code to &quot;restore&quot; it.

(JSC::JSLock::dropAllLocks):
- When dropping locks, we do not need to save the reservedZoneSize because
  the reservedZoneSize should remain the same regardless of which thread
  we are executing JS on. Hence, we can remove the unnecessary code to save
  the reservedZoneSize here.

(JSC::JSLock::grabAllLocks):
- When re-grabbing locks, restoring the stackPointerAtVMEntry via
  VM::setStackPointerAtVMEntry() will take care of updating the stack limit.
  As explained above, there's no need to save the reservedZoneSize. Hence,
  there's no need to &quot;restore&quot; it here.

* runtime/VM.cpp:
(JSC::VM::VM):
(JSC::VM::setStackPointerAtVMEntry):
- Sets the stackPointerAtVMEntry and delegates to updateStackLimit() to update
  the stack limit based on the new stackPointerAtVMEntry.
(JSC::VM::updateStackLimit):
* runtime/VM.h:
(JSC::VM::stackPointerAtVMEntry):
- Renamed stackPointerAtVMEntry to m_stackPointerAtVMEntry and made it private.
  Added a stackPointerAtVMEntry() function to read the value.

Source/WTF: 

* wtf/WTFThreadData.cpp:
(WTF::WTFThreadData::WTFThreadData):
* wtf/WTFThreadData.h:
- removed unnneeded m_savedReservedZoneSize.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeErrorHandlingScopecpp">trunk/Source/JavaScriptCore/runtime/ErrorHandlingScope.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeInitializeThreadingcpp">trunk/Source/JavaScriptCore/runtime/InitializeThreading.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSLockcpp">trunk/Source/JavaScriptCore/runtime/JSLock.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeVMcpp">trunk/Source/JavaScriptCore/runtime/VM.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeVMh">trunk/Source/JavaScriptCore/runtime/VM.h</a></li>
<li><a href="#trunkSourceWTFChangeLog">trunk/Source/WTF/ChangeLog</a></li>
<li><a href="#trunkSourceWTFwtfWTFThreadDatacpp">trunk/Source/WTF/wtf/WTFThreadData.cpp</a></li>
<li><a href="#trunkSourceWTFwtfWTFThreadDatah">trunk/Source/WTF/wtf/WTFThreadData.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (164017 => 164018)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2014-02-13 06:40:35 UTC (rev 164017)
+++ trunk/Source/JavaScriptCore/ChangeLog        2014-02-13 06:50:09 UTC (rev 164018)
</span><span class="lines">@@ -1,3 +1,88 @@
</span><ins>+2014-02-12  Mark Lam  &lt;mark.lam@apple.com&gt;
+
+        No need to save reservedZoneSize when dropping the JSLock.
+        &lt;https://webkit.org/b/128719&gt;
+
+        Reviewed by Geoffrey Garen.
+
+        The reservedZoneSize does not change due to the VM being run on a different
+        thread. Hence, there is no need to save and restore its value. Instead of
+        calling updateReservedZoneSize() to update the stack limit, we now call
+        setStackPointerAtVMEntry() to do the job. setStackPointerAtVMEntry()
+        will update the stackPointerAtVMEntry and delegate to updateStackLimit() to
+        update the stack limit based on the new stackPointerAtVMEntry.
+
+        * runtime/ErrorHandlingScope.cpp:
+        (JSC::ErrorHandlingScope::ErrorHandlingScope):
+        (JSC::ErrorHandlingScope::~ErrorHandlingScope):
+        - Previously, we initialize stackPointerAtVMEntry in VMEntryScope. This
+          means that the stackPointerAtVMEntry may not be initialize when we
+          instantiate the ErrorHandlingScope. And so, we needed to initialize the
+          stackPointerAtVMEntry in the ErrorHandlingScope constructor if it's not
+          already initialized.
+
+          Now that we initialize the stackPointerAtVMEntry when we lock the VM JSLock,
+          we are guaranteed that it will be initialized by the time we instantiate
+          the ErrorHandlingScope. Hence, we can change the ErrorHandlingScope code
+          to just assert that the stackPointerAtVMEntry is initialized instead.
+
+        * runtime/InitializeThreading.cpp:
+        (JSC::initializeThreading):
+        - We no longer need to save the reservedZoneSize. Remove the related code.
+
+        * runtime/JSLock.cpp:
+        (JSC::JSLock::lock):
+        - When we grab the JSLock mutex for the first time, there is no reason why
+          the stackPointerAtVMEntry should be initialized. By definition, grabbing
+          the lock for the first time equates to entering the VM for the first time.
+          Hence, we can just assert that stackPointerAtVMEntry is uninitialized,
+          and initialize it unconditionally.
+
+          The only exception to this is if we're locking to regrab the JSLock in
+          grabAllLocks(), but grabAllLocks() will take care of restoring the
+          stackPointerAtVMEntry in that case after lock() returns. stackPointerAtVMEntry
+          should still be 0 when we've just locked the JSLock. So, the above assertion
+          always holds true.
+
+          Note: VM::setStackPointerAtVMEntry() will take care of calling
+          VM::updateStackLimit() based on the new stackPointerAtVMEntry.
+
+        - There is no need to save the reservedZoneSize. The reservedZoneSize is
+          set to Options::reservedZoneSize() when the VM is initialized. Thereafter,
+          the ErrorHandlingScope will change it to Options::errorModeReservedZoneSize()
+          when we're handling an error, and it will restore it afterwards. There is
+          no other reason we should be changing the reservedZoneSize. Hence, we can
+          remove the unnecessary code to save it here.
+
+        (JSC::JSLock::unlock):
+        - Similarly, when the lockCount reaches 0 in unlock(), it is synonymous with
+          exiting the VM. Hence, we should just clear the stackPointerAtVMEntry and
+          update the stackLimit. Exiting the VM should have no effect on the VM
+          reservedZoneSize. Hence, we can remove the unnecessary code to &quot;restore&quot; it.
+
+        (JSC::JSLock::dropAllLocks):
+        - When dropping locks, we do not need to save the reservedZoneSize because
+          the reservedZoneSize should remain the same regardless of which thread
+          we are executing JS on. Hence, we can remove the unnecessary code to save
+          the reservedZoneSize here.
+
+        (JSC::JSLock::grabAllLocks):
+        - When re-grabbing locks, restoring the stackPointerAtVMEntry via
+          VM::setStackPointerAtVMEntry() will take care of updating the stack limit.
+          As explained above, there's no need to save the reservedZoneSize. Hence,
+          there's no need to &quot;restore&quot; it here.
+
+        * runtime/VM.cpp:
+        (JSC::VM::VM):
+        (JSC::VM::setStackPointerAtVMEntry):
+        - Sets the stackPointerAtVMEntry and delegates to updateStackLimit() to update
+          the stack limit based on the new stackPointerAtVMEntry.
+        (JSC::VM::updateStackLimit):
+        * runtime/VM.h:
+        (JSC::VM::stackPointerAtVMEntry):
+        - Renamed stackPointerAtVMEntry to m_stackPointerAtVMEntry and made it private.
+          Added a stackPointerAtVMEntry() function to read the value.
+
</ins><span class="cx"> 2014-02-12  Mark Hahnenberg  &lt;mhahnenberg@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         DelayedReleaseScope in MarkedAllocator::tryAllocateHelper is wrong
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeErrorHandlingScopecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/ErrorHandlingScope.cpp (164017 => 164018)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/ErrorHandlingScope.cpp        2014-02-13 06:40:35 UTC (rev 164017)
+++ trunk/Source/JavaScriptCore/runtime/ErrorHandlingScope.cpp        2014-02-13 06:50:09 UTC (rev 164018)
</span><span class="lines">@@ -35,8 +35,7 @@
</span><span class="cx"> ErrorHandlingScope::ErrorHandlingScope(VM&amp; vm)
</span><span class="cx">     : m_vm(vm)
</span><span class="cx"> {
</span><del>-    if (!m_vm.stackPointerAtVMEntry)
-        m_vm.stackPointerAtVMEntry = this;
</del><ins>+    RELEASE_ASSERT(m_vm.stackPointerAtVMEntry());
</ins><span class="cx">     size_t newReservedZoneSize = Options::errorModeReservedZoneSize();
</span><span class="cx">     m_savedReservedZoneSize = m_vm.updateReservedZoneSize(newReservedZoneSize);
</span><span class="cx"> #if ENABLE(LLINT_C_LOOP)
</span><span class="lines">@@ -46,8 +45,7 @@
</span><span class="cx"> 
</span><span class="cx"> ErrorHandlingScope::~ErrorHandlingScope()
</span><span class="cx"> {
</span><del>-    if (m_vm.stackPointerAtVMEntry == this)
-        m_vm.stackPointerAtVMEntry = nullptr;
</del><ins>+    RELEASE_ASSERT(m_vm.stackPointerAtVMEntry());
</ins><span class="cx">     m_vm.updateReservedZoneSize(m_savedReservedZoneSize);
</span><span class="cx"> #if ENABLE(LLINT_C_LOOP)
</span><span class="cx">     m_vm.interpreter-&gt;stack().setReservedZoneSize(m_savedReservedZoneSize);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeInitializeThreadingcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/InitializeThreading.cpp (164017 => 164018)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/InitializeThreading.cpp        2014-02-13 06:40:35 UTC (rev 164017)
+++ trunk/Source/JavaScriptCore/runtime/InitializeThreading.cpp        2014-02-13 06:50:09 UTC (rev 164018)
</span><span class="lines">@@ -73,9 +73,7 @@
</span><span class="cx">         DisallowGC::initialize();
</span><span class="cx"> #endif
</span><span class="cx">         WTFThreadData&amp; threadData = wtfThreadData();
</span><del>-        
</del><span class="cx">         threadData.setSavedLastStackTop(threadData.stack().origin());
</span><del>-        threadData.setSavedReservedZoneSize(Options::reservedZoneSize());
</del><span class="cx">     });
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSLockcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSLock.cpp (164017 => 164018)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSLock.cpp        2014-02-13 06:40:35 UTC (rev 164017)
+++ trunk/Source/JavaScriptCore/runtime/JSLock.cpp        2014-02-13 06:50:09 UTC (rev 164018)
</span><span class="lines">@@ -123,11 +123,9 @@
</span><span class="cx"> 
</span><span class="cx">     WTFThreadData&amp; threadData = wtfThreadData();
</span><span class="cx"> 
</span><del>-    if (!m_vm-&gt;stackPointerAtVMEntry) {
-        void* p = &amp;p;
-        m_vm-&gt;stackPointerAtVMEntry = p; // A proxy for the current stack pointer.
-        threadData.setSavedReservedZoneSize(m_vm-&gt;updateReservedZoneSize(Options::reservedZoneSize()));
-    }
</del><ins>+    RELEASE_ASSERT(!m_vm-&gt;stackPointerAtVMEntry());
+    void* p = &amp;p; // A proxy for the current stack pointer.
+    m_vm-&gt;setStackPointerAtVMEntry(p);
</ins><span class="cx"> 
</span><span class="cx">     m_vm-&gt;setLastStackTop(threadData.savedLastStackTop());
</span><span class="cx"> }
</span><span class="lines">@@ -145,10 +143,8 @@
</span><span class="cx">     m_lockCount -= unlockCount;
</span><span class="cx"> 
</span><span class="cx">     if (!m_lockCount) {
</span><del>-        if (m_vm) {
-            m_vm-&gt;stackPointerAtVMEntry = nullptr;
-            m_vm-&gt;updateReservedZoneSize(wtfThreadData().savedReservedZoneSize());
-        }
</del><ins>+        if (m_vm)
+            m_vm-&gt;setStackPointerAtVMEntry(nullptr);
</ins><span class="cx">         setOwnerThread(0);
</span><span class="cx">         m_lock.unlock();
</span><span class="cx">     }
</span><span class="lines">@@ -185,9 +181,8 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     WTFThreadData&amp; threadData = wtfThreadData();
</span><del>-    threadData.setSavedStackPointerAtVMEntry(m_vm-&gt;stackPointerAtVMEntry);
</del><ins>+    threadData.setSavedStackPointerAtVMEntry(m_vm-&gt;stackPointerAtVMEntry());
</ins><span class="cx">     threadData.setSavedLastStackTop(m_vm-&gt;lastStackTop());
</span><del>-    threadData.setSavedReservedZoneSize(m_vm-&gt;reservedZoneSize());
</del><span class="cx"> 
</span><span class="cx">     unsigned droppedLockCount = m_lockCount;
</span><span class="cx">     unlock(droppedLockCount);
</span><span class="lines">@@ -216,9 +211,8 @@
</span><span class="cx">     --m_lockDropDepth;
</span><span class="cx"> 
</span><span class="cx">     WTFThreadData&amp; threadData = wtfThreadData();
</span><del>-    m_vm-&gt;stackPointerAtVMEntry = threadData.savedStackPointerAtVMEntry();
</del><ins>+    m_vm-&gt;setStackPointerAtVMEntry(threadData.savedStackPointerAtVMEntry());
</ins><span class="cx">     m_vm-&gt;setLastStackTop(threadData.savedLastStackTop());
</span><del>-    m_vm-&gt;updateReservedZoneSize(threadData.savedReservedZoneSize());
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> JSLock::DropAllLocks::DropAllLocks(ExecState* exec)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeVMcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/VM.cpp (164017 => 164018)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/VM.cpp        2014-02-13 06:40:35 UTC (rev 164017)
+++ trunk/Source/JavaScriptCore/runtime/VM.cpp        2014-02-13 06:50:09 UTC (rev 164018)
</span><span class="lines">@@ -173,7 +173,6 @@
</span><span class="cx">     , vmType(vmType)
</span><span class="cx">     , clientData(0)
</span><span class="cx">     , topCallFrame(CallFrame::noCaller())
</span><del>-    , stackPointerAtVMEntry(0)
</del><span class="cx">     , arrayConstructorTable(adoptPtr(new HashTable(JSC::arrayConstructorTable)))
</span><span class="cx">     , arrayPrototypeTable(adoptPtr(new HashTable(JSC::arrayPrototypeTable)))
</span><span class="cx">     , booleanPrototypeTable(adoptPtr(new HashTable(JSC::booleanPrototypeTable)))
</span><span class="lines">@@ -223,6 +222,7 @@
</span><span class="cx"> #if ENABLE(GC_VALIDATION)
</span><span class="cx">     , m_initializingObjectClass(0)
</span><span class="cx"> #endif
</span><ins>+    , m_stackPointerAtVMEntry(0)
</ins><span class="cx">     , m_stackLimit(0)
</span><span class="cx"> #if ENABLE(LLINT_C_LOOP)
</span><span class="cx">     , m_jsStackLimit(0)
</span><span class="lines">@@ -732,6 +732,12 @@
</span><span class="cx">     m_exceptionStack = RefCountedArray&lt;StackFrame&gt;();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void VM::setStackPointerAtVMEntry(void* sp)
+{
+    m_stackPointerAtVMEntry = sp;
+    updateStackLimit();
+}
+
</ins><span class="cx"> size_t VM::updateReservedZoneSize(size_t reservedZoneSize)
</span><span class="cx"> {
</span><span class="cx">     size_t oldReservedZoneSize = m_reservedZoneSize;
</span><span class="lines">@@ -744,9 +750,9 @@
</span><span class="cx"> 
</span><span class="cx"> inline void VM::updateStackLimit()
</span><span class="cx"> {
</span><del>-    if (stackPointerAtVMEntry) {
</del><ins>+    if (m_stackPointerAtVMEntry) {
</ins><span class="cx">         ASSERT(wtfThreadData().stack().isGrowingDownward());
</span><del>-        char* startOfStack = reinterpret_cast&lt;char*&gt;(stackPointerAtVMEntry);
</del><ins>+        char* startOfStack = reinterpret_cast&lt;char*&gt;(m_stackPointerAtVMEntry);
</ins><span class="cx"> #if ENABLE(FTL_JIT)
</span><span class="cx">         m_stackLimit = wtfThreadData().stack().recursionLimit(startOfStack, Options::maxPerThreadStackUsage(), m_reservedZoneSize + m_largestFTLStackSize);
</span><span class="cx">         m_ftlStackLimit = wtfThreadData().stack().recursionLimit(startOfStack, Options::maxPerThreadStackUsage(), m_reservedZoneSize + 2 * m_largestFTLStackSize);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeVMh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/VM.h (164017 => 164018)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/VM.h        2014-02-13 06:40:35 UTC (rev 164017)
+++ trunk/Source/JavaScriptCore/runtime/VM.h        2014-02-13 06:50:09 UTC (rev 164018)
</span><span class="lines">@@ -230,7 +230,6 @@
</span><span class="cx">         VMType vmType;
</span><span class="cx">         ClientData* clientData;
</span><span class="cx">         ExecState* topCallFrame;
</span><del>-        void* stackPointerAtVMEntry;
</del><span class="cx">         Watchdog watchdog;
</span><span class="cx"> 
</span><span class="cx">         const OwnPtr&lt;const HashTable&gt; arrayConstructorTable;
</span><span class="lines">@@ -379,6 +378,9 @@
</span><span class="cx">         JS_EXPORT_PRIVATE JSValue throwException(ExecState*, JSValue);
</span><span class="cx">         JS_EXPORT_PRIVATE JSObject* throwException(ExecState*, JSObject*);
</span><span class="cx">         
</span><ins>+        void* stackPointerAtVMEntry() const { return m_stackPointerAtVMEntry; }
+        void setStackPointerAtVMEntry(void*);
+
</ins><span class="cx">         size_t reservedZoneSize() const { return m_reservedZoneSize; }
</span><span class="cx">         size_t updateReservedZoneSize(size_t reservedZoneSize);
</span><span class="cx"> 
</span><span class="lines">@@ -529,6 +531,7 @@
</span><span class="cx"> #if ENABLE(GC_VALIDATION)
</span><span class="cx">         const ClassInfo* m_initializingObjectClass;
</span><span class="cx"> #endif
</span><ins>+        void* m_stackPointerAtVMEntry;
</ins><span class="cx">         size_t m_reservedZoneSize;
</span><span class="cx"> #if ENABLE(LLINT_C_LOOP)
</span><span class="cx">         struct {
</span></span></pre></div>
<a id="trunkSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/ChangeLog (164017 => 164018)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/ChangeLog        2014-02-13 06:40:35 UTC (rev 164017)
+++ trunk/Source/WTF/ChangeLog        2014-02-13 06:50:09 UTC (rev 164018)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2014-02-12  Mark Lam  &lt;mark.lam@apple.com&gt;
+
+        No need to save reservedZoneSize when dropping the JSLock.
+        &lt;https://webkit.org/b/128719&gt;
+
+        Reviewed by Geoffrey Garen.
+
+        * wtf/WTFThreadData.cpp:
+        (WTF::WTFThreadData::WTFThreadData):
+        * wtf/WTFThreadData.h:
+        - removed unnneeded m_savedReservedZoneSize.
+
</ins><span class="cx"> 2014-02-11  Mark Hahnenberg  &lt;mhahnenberg@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         32-bit LLInt writeBarrierOnGlobalObject is wrong
</span></span></pre></div>
<a id="trunkSourceWTFwtfWTFThreadDatacpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/WTFThreadData.cpp (164017 => 164018)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/WTFThreadData.cpp        2014-02-13 06:40:35 UTC (rev 164017)
+++ trunk/Source/WTF/wtf/WTFThreadData.cpp        2014-02-13 06:50:09 UTC (rev 164018)
</span><span class="lines">@@ -51,7 +51,6 @@
</span><span class="cx"> #endif
</span><span class="cx">     , m_savedStackPointerAtVMEntry(0)
</span><span class="cx">     , m_savedLastStackTop(stack().origin())
</span><del>-    , m_savedReservedZoneSize(0)
</del><span class="cx"> {
</span><span class="cx"> #if USE(WEB_THREAD)
</span><span class="cx">     static JSC::IdentifierTable* sharedIdentifierTable = new JSC::IdentifierTable();
</span></span></pre></div>
<a id="trunkSourceWTFwtfWTFThreadDatah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/WTFThreadData.h (164017 => 164018)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/WTFThreadData.h        2014-02-13 06:40:35 UTC (rev 164017)
+++ trunk/Source/WTF/wtf/WTFThreadData.h        2014-02-13 06:50:09 UTC (rev 164018)
</span><span class="lines">@@ -126,16 +126,6 @@
</span><span class="cx">         m_savedLastStackTop = lastStackTop;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    size_t savedReservedZoneSize()
-    {
-        return m_savedReservedZoneSize;
-    }
-
-    void setSavedReservedZoneSize(size_t reservedZoneSize)
-    {
-        m_savedReservedZoneSize = reservedZoneSize;
-    }
-
</del><span class="cx">     void* m_apiData;
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="lines">@@ -150,7 +140,6 @@
</span><span class="cx"> #endif
</span><span class="cx">     void* m_savedStackPointerAtVMEntry;
</span><span class="cx">     void* m_savedLastStackTop;
</span><del>-    size_t m_savedReservedZoneSize;
</del><span class="cx"> 
</span><span class="cx">     static WTF_EXPORTDATA ThreadSpecific&lt;WTFThreadData&gt;* staticData;
</span><span class="cx">     friend WTFThreadData&amp; wtfThreadData();
</span></span></pre>
</div>
</div>

</body>
</html>