<!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>[151869] trunk</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/151869">151869</a></dd>
<dt>Author</dt> <dd>mark.lam@apple.com</dd>
<dt>Date</dt> <dd>2013-06-21 16:58:52 -0700 (Fri, 21 Jun 2013)</dd>
</dl>

<h3>Log Message</h3>
<pre>Source/JavaScriptCore: Introducing the VMStackBounds class.
https://bugs.webkit.org/show_bug.cgi?id=117862.

Reviewed by Geoffrey Garen.

- Removed Interpreter::StackPolicy.
- The new VMStackBounds will take over choosing the appropriate stack
  size requirements, and invoking the underlying WTF::StackBounds to
  to the real bounds check.
- VMStackBounds will now be used universally throughout JSC instead of
  WTF::StackBounds.

* JavaScriptCore.xcodeproj/project.pbxproj:
* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::BytecodeGenerator):
* bytecompiler/BytecodeGenerator.h:
* interpreter/Interpreter.cpp:
(JSC::Interpreter::execute):
(JSC::Interpreter::executeCall):
(JSC::Interpreter::executeConstruct):
(JSC::Interpreter::prepareForRepeatCall):
* interpreter/Interpreter.h:
(JSC::Interpreter::isInErrorHandlingMode):
* parser/Parser.cpp:
(JSC::::Parser):
* parser/Parser.h:
* runtime/StringRecursionChecker.h:
(JSC::StringRecursionChecker::performCheck):
* runtime/VMStackBounds.h: Added.
(JSC::VMStackBounds::VMStackBounds):
(JSC::VMStackBounds::isSafeToRecurse):
(JSC::VMStackBounds::requiredCapacity):

LayoutTests: Reverting failure expectation for fast/xmlhttprequest/xmlhttprequest-recursive-sync-event.html.
https://bugs.webkit.org/show_bug.cgi?id=117862.

Reviewed by Geoffrey Garen.

* platform/mac/TestExpectations:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformmacTestExpectations">trunk/LayoutTests/platform/mac/TestExpectations</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreJavaScriptCorexcodeprojprojectpbxproj">trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecompilerBytecodeGeneratorcpp">trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecompilerBytecodeGeneratorh">trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreinterpreterInterpretercpp">trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreinterpreterInterpreterh">trunk/Source/JavaScriptCore/interpreter/Interpreter.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreparserParsercpp">trunk/Source/JavaScriptCore/parser/Parser.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreparserParserh">trunk/Source/JavaScriptCore/parser/Parser.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeStringRecursionCheckerh">trunk/Source/JavaScriptCore/runtime/StringRecursionChecker.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreruntimeVMStackBoundsh">trunk/Source/JavaScriptCore/runtime/VMStackBounds.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (151868 => 151869)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2013-06-21 23:39:41 UTC (rev 151868)
+++ trunk/LayoutTests/ChangeLog        2013-06-21 23:58:52 UTC (rev 151869)
</span><span class="lines">@@ -1,3 +1,12 @@
</span><ins>+2013-06-21  Mark Lam  &lt;mark.lam@apple.com&gt;
+
+        Reverting failure expectation for fast/xmlhttprequest/xmlhttprequest-recursive-sync-event.html.
+        https://bugs.webkit.org/show_bug.cgi?id=117862.
+
+        Reviewed by Geoffrey Garen.
+
+        * platform/mac/TestExpectations:
+
</ins><span class="cx"> 2013-06-21  Brent Fulgham  &lt;bfulgham@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         AX: Title for ListItemRole should consist of concatenated child text elements.
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac/TestExpectations (151868 => 151869)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/TestExpectations        2013-06-21 23:39:41 UTC (rev 151868)
+++ trunk/LayoutTests/platform/mac/TestExpectations        2013-06-21 23:58:52 UTC (rev 151869)
</span><span class="lines">@@ -1336,5 +1336,3 @@
</span><span class="cx"> webkit.org/b/116582 [ Debug ] inspector/styles/import-pseudoclass-crash.html [ Pass Crash ]
</span><span class="cx"> 
</span><span class="cx"> webkit.org/b/116592 inspector/geolocation-error.html [ Pass Failure ]
</span><del>-
-webkit.org/b/117862 fast/xmlhttprequest/xmlhttprequest-recursive-sync-event.html [ Failure ]
</del></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (151868 => 151869)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2013-06-21 23:39:41 UTC (rev 151868)
+++ trunk/Source/JavaScriptCore/ChangeLog        2013-06-21 23:58:52 UTC (rev 151869)
</span><span class="lines">@@ -1,3 +1,38 @@
</span><ins>+2013-06-21  Mark Lam  &lt;mark.lam@apple.com&gt;
+
+        Introducing the VMStackBounds class.
+        https://bugs.webkit.org/show_bug.cgi?id=117862.
+
+        Reviewed by Geoffrey Garen.
+
+        - Removed Interpreter::StackPolicy.
+        - The new VMStackBounds will take over choosing the appropriate stack
+          size requirements, and invoking the underlying WTF::StackBounds to
+          to the real bounds check.
+        - VMStackBounds will now be used universally throughout JSC instead of
+          WTF::StackBounds.
+
+        * JavaScriptCore.xcodeproj/project.pbxproj:
+        * bytecompiler/BytecodeGenerator.cpp:
+        (JSC::BytecodeGenerator::BytecodeGenerator):
+        * bytecompiler/BytecodeGenerator.h:
+        * interpreter/Interpreter.cpp:
+        (JSC::Interpreter::execute):
+        (JSC::Interpreter::executeCall):
+        (JSC::Interpreter::executeConstruct):
+        (JSC::Interpreter::prepareForRepeatCall):
+        * interpreter/Interpreter.h:
+        (JSC::Interpreter::isInErrorHandlingMode):
+        * parser/Parser.cpp:
+        (JSC::::Parser):
+        * parser/Parser.h:
+        * runtime/StringRecursionChecker.h:
+        (JSC::StringRecursionChecker::performCheck):
+        * runtime/VMStackBounds.h: Added.
+        (JSC::VMStackBounds::VMStackBounds):
+        (JSC::VMStackBounds::isSafeToRecurse):
+        (JSC::VMStackBounds::requiredCapacity):
+
</ins><span class="cx"> 2013-06-20  Mark Lam  &lt;mark.lam@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Change stack capacity requirement to be more reasonable.
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreJavaScriptCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj (151868 => 151869)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj        2013-06-21 23:39:41 UTC (rev 151868)
+++ trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj        2013-06-21 23:58:52 UTC (rev 151869)
</span><span class="lines">@@ -871,6 +871,7 @@
</span><span class="cx">                 FE20CE9E15F04A9500DF3430 /* LLIntCLoop.h in Headers */ = {isa = PBXBuildFile; fileRef = FE20CE9C15F04A9500DF3430 /* LLIntCLoop.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 FE4A331F15BD2E07006F54F3 /* VMInspector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE4A331D15BD2E07006F54F3 /* VMInspector.cpp */; };
</span><span class="cx">                 FE4A332015BD2E07006F54F3 /* VMInspector.h in Headers */ = {isa = PBXBuildFile; fileRef = FE4A331E15BD2E07006F54F3 /* VMInspector.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><ins>+                FE6617281774E03500495B00 /* VMStackBounds.h in Headers */ = {isa = PBXBuildFile; fileRef = FE6617271774E03500495B00 /* VMStackBounds.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 FED287B215EC9A5700DA8161 /* LLIntOpcode.h in Headers */ = {isa = PBXBuildFile; fileRef = FED287B115EC9A5700DA8161 /* LLIntOpcode.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 FED94F2E171E3E2300BE77A4 /* Watchdog.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FED94F2B171E3E2300BE77A4 /* Watchdog.cpp */; };
</span><span class="cx">                 FED94F2F171E3E2300BE77A4 /* Watchdog.h in Headers */ = {isa = PBXBuildFile; fileRef = FED94F2C171E3E2300BE77A4 /* Watchdog.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="lines">@@ -1817,6 +1818,7 @@
</span><span class="cx">                 FE20CE9C15F04A9500DF3430 /* LLIntCLoop.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LLIntCLoop.h; path = llint/LLIntCLoop.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 FE4A331D15BD2E07006F54F3 /* VMInspector.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VMInspector.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 FE4A331E15BD2E07006F54F3 /* VMInspector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VMInspector.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                FE6617271774E03500495B00 /* VMStackBounds.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VMStackBounds.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 FED287B115EC9A5700DA8161 /* LLIntOpcode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LLIntOpcode.h; path = llint/LLIntOpcode.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 FED94F2B171E3E2300BE77A4 /* Watchdog.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Watchdog.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 FED94F2C171E3E2300BE77A4 /* Watchdog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Watchdog.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -2618,6 +2620,7 @@
</span><span class="cx">                                 5D53726E0E1C54880021E549 /* Tracing.h */,
</span><span class="cx">                                 0FEB3ECB16237F4700AB67AD /* TypedArrayDescriptor.h */,
</span><span class="cx">                                 866739D113BFDE710023D87C /* Uint16WithFraction.h */,
</span><ins>+                                FE6617271774E03500495B00 /* VMStackBounds.h */,
</ins><span class="cx">                                 FED94F2B171E3E2300BE77A4 /* Watchdog.cpp */,
</span><span class="cx">                                 FED94F2C171E3E2300BE77A4 /* Watchdog.h */,
</span><span class="cx">                                 FED94F2D171E3E2300BE77A4 /* WatchdogMac.cpp */,
</span><span class="lines">@@ -2994,6 +2997,7 @@
</span><span class="cx">                                 BC18C3E70E16F5CD00B34460 /* ArrayPrototype.h in Headers */,
</span><span class="cx">                                 C2DF44301707AC0100A5CA96 /* SuperRegion.h in Headers */,
</span><span class="cx">                                 C20B25991706536200C21F4E /* Region.h in Headers */,
</span><ins>+                                FE6617281774E03500495B00 /* VMStackBounds.h in Headers */,
</ins><span class="cx">                                 C283190016FE4B7D00157BFD /* HandleBlock.h in Headers */,
</span><span class="cx">                                 BC18C41D0E16F5CD00B34460 /* JSClassRef.h in Headers */,
</span><span class="cx">                                 86E3C61D167BABEE006D760A /* JSVirtualMachineInternal.h in Headers */,
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecompilerBytecodeGeneratorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp (151868 => 151869)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp        2013-06-21 23:39:41 UTC (rev 151868)
+++ trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp        2013-06-21 23:58:52 UTC (rev 151869)
</span><span class="lines">@@ -179,7 +179,7 @@
</span><span class="cx"> #ifndef NDEBUG
</span><span class="cx">     , m_lastOpcodePosition(0)
</span><span class="cx"> #endif
</span><del>-    , m_stack(wtfThreadData().stack())
</del><ins>+    , m_stack(vm, wtfThreadData().stack())
</ins><span class="cx">     , m_usesExceptions(false)
</span><span class="cx">     , m_expressionTooDeep(false)
</span><span class="cx"> {
</span><span class="lines">@@ -228,7 +228,7 @@
</span><span class="cx"> #ifndef NDEBUG
</span><span class="cx">     , m_lastOpcodePosition(0)
</span><span class="cx"> #endif
</span><del>-    , m_stack(wtfThreadData().stack())
</del><ins>+    , m_stack(vm, wtfThreadData().stack())
</ins><span class="cx">     , m_usesExceptions(false)
</span><span class="cx">     , m_expressionTooDeep(false)
</span><span class="cx"> {
</span><span class="lines">@@ -425,7 +425,7 @@
</span><span class="cx"> #ifndef NDEBUG
</span><span class="cx">     , m_lastOpcodePosition(0)
</span><span class="cx"> #endif
</span><del>-    , m_stack(wtfThreadData().stack())
</del><ins>+    , m_stack(vm, wtfThreadData().stack())
</ins><span class="cx">     , m_usesExceptions(false)
</span><span class="cx">     , m_expressionTooDeep(false)
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecompilerBytecodeGeneratorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h (151868 => 151869)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h        2013-06-21 23:39:41 UTC (rev 151868)
+++ trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h        2013-06-21 23:58:52 UTC (rev 151869)
</span><span class="lines">@@ -44,6 +44,7 @@
</span><span class="cx"> #include &quot;Nodes.h&quot;
</span><span class="cx"> #include &quot;StaticPropertyAnalyzer.h&quot;
</span><span class="cx"> #include &quot;UnlinkedCodeBlock.h&quot;
</span><ins>+#include &quot;VMStackBounds.h&quot;
</ins><span class="cx"> #include &lt;wtf/PassRefPtr.h&gt;
</span><span class="cx"> #include &lt;wtf/SegmentedVector.h&gt;
</span><span class="cx"> #include &lt;wtf/Vector.h&gt;
</span><span class="lines">@@ -825,7 +826,7 @@
</span><span class="cx">         size_t m_lastOpcodePosition;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-        StackBounds m_stack;
</del><ins>+        VMStackBounds m_stack;
</ins><span class="cx"> 
</span><span class="cx">         bool m_usesExceptions;
</span><span class="cx">         bool m_expressionTooDeep;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinterpreterInterpretercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp (151868 => 151869)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp        2013-06-21 23:39:41 UTC (rev 151868)
+++ trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp        2013-06-21 23:58:52 UTC (rev 151869)
</span><span class="lines">@@ -64,6 +64,7 @@
</span><span class="cx"> #include &quot;SamplingTool.h&quot;
</span><span class="cx"> #include &quot;StrictEvalActivation.h&quot;
</span><span class="cx"> #include &quot;StrongInlines.h&quot;
</span><ins>+#include &quot;VMStackBounds.h&quot;
</ins><span class="cx"> #include &lt;limits.h&gt;
</span><span class="cx"> #include &lt;stdio.h&gt;
</span><span class="cx"> #include &lt;wtf/StackStats.h&gt;
</span><span class="lines">@@ -98,45 +99,6 @@
</span><span class="cx">         m_interpreter.stack().disableErrorStackReserve();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-
-// The Interpreter::StackPolicy class is used to compute a stack capacity
-// requirement to ensure that we have enough room on the native stack for:
-// 1. the max cumulative stack used by the interpreter and all code
-//    paths sub of it up till leaf functions.
-// 2. the max cumulative stack used by the interpreter before it reaches
-//    the next checkpoint (execute...() function) in the interpreter.
-// 
-// The interpreter can be run on different threads and hence, different
-// native stacks (with different sizes) before exiting out of the first
-// frame. Hence, the required capacity needs to be re-computed on every
-// entry into the interpreter.
-//
-// Currently the requiredStack is computed based on a policy. See comments
-// in StackPolicy::StackPolicy() for details.
-
-Interpreter::StackPolicy::StackPolicy(Interpreter&amp; interpreter, const StackBounds&amp; stack)
-    : m_interpreter(interpreter)
-{
-    const size_t size = stack.size();
-
-    // We have two separate stack limits, one for regular JS execution, and one
-    // for when we're handling errors. We need the error stack to be smaller
-    // otherwise there would obviously not be any stack left to execute JS in when
-    // there's a stack overflow.
-    //
-    // These sizes were derived from the stack usage of a number of sites when
-    // layout occurs when we've already consumed most of the C stack.
-    const size_t requiredStack = 32 * KB;
-    const size_t errorModeRequiredStack = 16 * KB;
-
-    size_t requiredCapacity = m_interpreter.m_errorHandlingModeReentry ? errorModeRequiredStack : requiredStack;
-
-    RELEASE_ASSERT(size &gt;= requiredCapacity);
-    
-    m_requiredCapacity = requiredCapacity;    
-}
-
-
</del><span class="cx"> static CallFrame* getCallerInfo(VM*, CallFrame*, unsigned&amp; bytecodeOffset, CodeBlock*&amp; callerOut);
</span><span class="cx"> 
</span><span class="cx"> // Returns the depth of the scope chain within a given call frame.
</span><span class="lines">@@ -829,9 +791,8 @@
</span><span class="cx">         return jsNull();
</span><span class="cx"> 
</span><span class="cx">     StackStats::CheckPoint stackCheckPoint;
</span><del>-    const StackBounds&amp; nativeStack = wtfThreadData().stack();
-    StackPolicy policy(*this, nativeStack);
-    if (!nativeStack.isSafeToRecurse(policy.requiredCapacity()))
</del><ins>+    const VMStackBounds vmStackBounds(vm, wtfThreadData().stack());
+    if (!vmStackBounds.isSafeToRecurse())
</ins><span class="cx">         return checkedReturn(throwStackOverflowError(callFrame));
</span><span class="cx"> 
</span><span class="cx">     // First check if the &quot;program&quot; is actually just a JSON object. If so,
</span><span class="lines">@@ -995,9 +956,8 @@
</span><span class="cx">         return jsNull();
</span><span class="cx"> 
</span><span class="cx">     StackStats::CheckPoint stackCheckPoint;
</span><del>-    const StackBounds&amp; nativeStack = wtfThreadData().stack();
-    StackPolicy policy(*this, nativeStack);
-    if (!nativeStack.isSafeToRecurse(policy.requiredCapacity()))
</del><ins>+    const VMStackBounds vmStackBounds(vm, wtfThreadData().stack());
+    if (!vmStackBounds.isSafeToRecurse())
</ins><span class="cx">         return checkedReturn(throwStackOverflowError(callFrame));
</span><span class="cx"> 
</span><span class="cx">     bool isJSCall = (callType == CallTypeJS);
</span><span class="lines">@@ -1073,9 +1033,8 @@
</span><span class="cx">         return checkedReturn(throwStackOverflowError(callFrame));
</span><span class="cx"> 
</span><span class="cx">     StackStats::CheckPoint stackCheckPoint;
</span><del>-    const StackBounds&amp; nativeStack = wtfThreadData().stack();
-    StackPolicy policy(*this, nativeStack);
-    if (!nativeStack.isSafeToRecurse(policy.requiredCapacity()))
</del><ins>+    const VMStackBounds vmStackBounds(vm, wtfThreadData().stack());
+    if (!vmStackBounds.isSafeToRecurse())
</ins><span class="cx">         return checkedReturn(throwStackOverflowError(callFrame));
</span><span class="cx"> 
</span><span class="cx">     bool isJSConstruct = (constructType == ConstructTypeJS);
</span><span class="lines">@@ -1154,9 +1113,8 @@
</span><span class="cx">         return CallFrameClosure();
</span><span class="cx"> 
</span><span class="cx">     StackStats::CheckPoint stackCheckPoint;
</span><del>-    const StackBounds&amp; nativeStack = wtfThreadData().stack();
-    StackPolicy policy(*this, nativeStack);
-    if (!nativeStack.isSafeToRecurse(policy.requiredCapacity())) {
</del><ins>+    const VMStackBounds vmStackBounds(vm, wtfThreadData().stack());
+    if (!vmStackBounds.isSafeToRecurse()) {
</ins><span class="cx">         throwStackOverflowError(callFrame);
</span><span class="cx">         return CallFrameClosure();
</span><span class="cx">     }
</span><span class="lines">@@ -1257,9 +1215,8 @@
</span><span class="cx">     DynamicGlobalObjectScope globalObjectScope(vm, scope-&gt;globalObject());
</span><span class="cx"> 
</span><span class="cx">     StackStats::CheckPoint stackCheckPoint;
</span><del>-    const StackBounds&amp; nativeStack = wtfThreadData().stack();
-    StackPolicy policy(*this, nativeStack);
-    if (!nativeStack.isSafeToRecurse(policy.requiredCapacity()))
</del><ins>+    const VMStackBounds vmStackBounds(vm, wtfThreadData().stack());
+    if (!vmStackBounds.isSafeToRecurse())
</ins><span class="cx">         return checkedReturn(throwStackOverflowError(callFrame));
</span><span class="cx"> 
</span><span class="cx">     // Compile the callee:
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinterpreterInterpreterh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/interpreter/Interpreter.h (151868 => 151869)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/interpreter/Interpreter.h        2013-06-21 23:39:41 UTC (rev 151868)
+++ trunk/Source/JavaScriptCore/interpreter/Interpreter.h        2013-06-21 23:58:52 UTC (rev 151869)
</span><span class="lines">@@ -216,6 +216,8 @@
</span><span class="cx">         
</span><span class="cx">         SamplingTool* sampler() { return m_sampler.get(); }
</span><span class="cx"> 
</span><ins>+        bool isInErrorHandlingMode() { return m_errorHandlingModeReentry; }
+
</ins><span class="cx">         NEVER_INLINE HandlerInfo* throwException(CallFrame*&amp;, JSValue&amp;, unsigned bytecodeOffset);
</span><span class="cx">         NEVER_INLINE void debug(CallFrame*, DebugHookID, int firstLine, int lastLine, int column);
</span><span class="cx">         static const String getTraceLine(CallFrame*, StackFrameCodeType, const String&amp;, int);
</span><span class="lines">@@ -229,16 +231,6 @@
</span><span class="cx">         JS_EXPORT_PRIVATE void dumpCallFrame(CallFrame*);
</span><span class="cx"> 
</span><span class="cx">     private:
</span><del>-        class StackPolicy {
-        public:
-            StackPolicy(Interpreter&amp;, const StackBounds&amp;);
-            inline size_t requiredCapacity() { return m_requiredCapacity; }
-
-        private:
-            Interpreter&amp; m_interpreter;
-            size_t m_requiredCapacity;
-        };
-
</del><span class="cx">         enum ExecutionFlag { Normal, InitializeAndReturn };
</span><span class="cx"> 
</span><span class="cx">         CallFrameClosure prepareForRepeatCall(FunctionExecutable*, CallFrame*, JSFunction*, int argumentCountIncludingThis, JSScope*);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreparserParsercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/parser/Parser.cpp (151868 => 151869)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/parser/Parser.cpp        2013-06-21 23:39:41 UTC (rev 151868)
+++ trunk/Source/JavaScriptCore/parser/Parser.cpp        2013-06-21 23:58:52 UTC (rev 151869)
</span><span class="lines">@@ -66,7 +66,7 @@
</span><span class="cx"> Parser&lt;LexerType&gt;::Parser(VM* vm, const SourceCode&amp; source, FunctionParameters* parameters, const Identifier&amp; name, JSParserStrictness strictness, JSParserMode parserMode)
</span><span class="cx">     : m_vm(vm)
</span><span class="cx">     , m_source(&amp;source)
</span><del>-    , m_stack(wtfThreadData().stack())
</del><ins>+    , m_stack(*vm, wtfThreadData().stack())
</ins><span class="cx">     , m_hasStackOverflow(false)
</span><span class="cx">     , m_allowsIn(true)
</span><span class="cx">     , m_lastLine(0)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreparserParserh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/parser/Parser.h (151868 => 151869)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/parser/Parser.h        2013-06-21 23:39:41 UTC (rev 151868)
+++ trunk/Source/JavaScriptCore/parser/Parser.h        2013-06-21 23:58:52 UTC (rev 151869)
</span><span class="lines">@@ -35,6 +35,7 @@
</span><span class="cx"> #include &quot;SourceProvider.h&quot;
</span><span class="cx"> #include &quot;SourceProviderCache.h&quot;
</span><span class="cx"> #include &quot;SourceProviderCacheItem.h&quot;
</span><ins>+#include &quot;VMStackBounds.h&quot;
</ins><span class="cx"> #include &lt;wtf/Forward.h&gt;
</span><span class="cx"> #include &lt;wtf/Noncopyable.h&gt;
</span><span class="cx"> #include &lt;wtf/OwnPtr.h&gt;
</span><span class="lines">@@ -938,7 +939,7 @@
</span><span class="cx">     ParserArena* m_arena;
</span><span class="cx">     OwnPtr&lt;LexerType&gt; m_lexer;
</span><span class="cx">     
</span><del>-    StackBounds m_stack;
</del><ins>+    VMStackBounds m_stack;
</ins><span class="cx">     bool m_hasStackOverflow;
</span><span class="cx">     String m_errorMessage;
</span><span class="cx">     JSToken m_token;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeStringRecursionCheckerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/StringRecursionChecker.h (151868 => 151869)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/StringRecursionChecker.h        2013-06-21 23:39:41 UTC (rev 151868)
+++ trunk/Source/JavaScriptCore/runtime/StringRecursionChecker.h        2013-06-21 23:58:52 UTC (rev 151869)
</span><span class="lines">@@ -21,6 +21,7 @@
</span><span class="cx"> #define StringRecursionChecker_h
</span><span class="cx"> 
</span><span class="cx"> #include &quot;Interpreter.h&quot;
</span><ins>+#include &quot;VMStackBounds.h&quot;
</ins><span class="cx"> #include &lt;wtf/StackStats.h&gt;
</span><span class="cx"> #include &lt;wtf/WTFThreadData.h&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -49,10 +50,11 @@
</span><span class="cx"> 
</span><span class="cx"> inline JSValue StringRecursionChecker::performCheck()
</span><span class="cx"> {
</span><del>-    const StackBounds&amp; nativeStack = wtfThreadData().stack();
</del><ins>+    VM&amp; vm = m_exec-&gt;vm();
+    const VMStackBounds nativeStack(vm, wtfThreadData().stack());
</ins><span class="cx">     if (!nativeStack.isSafeToRecurse())
</span><span class="cx">         return throwStackOverflowError();
</span><del>-    bool alreadyVisited = !m_exec-&gt;vm().stringRecursionCheckVisitedObjects.add(m_thisObject).isNewEntry;
</del><ins>+    bool alreadyVisited = !vm.stringRecursionCheckVisitedObjects.add(m_thisObject).isNewEntry;
</ins><span class="cx">     if (alreadyVisited)
</span><span class="cx">         return emptyString(); // Return empty string to avoid infinite recursion.
</span><span class="cx">     return JSValue(); // Indicate success.
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeVMStackBoundsh"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/runtime/VMStackBounds.h (0 => 151869)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/VMStackBounds.h                                (rev 0)
+++ trunk/Source/JavaScriptCore/runtime/VMStackBounds.h        2013-06-21 23:58:52 UTC (rev 151869)
</span><span class="lines">@@ -0,0 +1,71 @@
</span><ins>+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#ifndef VMStackBounds_h
+#define VMStackBounds_h
+
+#include &quot;VM.h&quot;
+#include &lt;wtf/StackBounds.h&gt;
+
+namespace JSC {
+
+class VMStackBounds {
+public:
+    VMStackBounds(VM&amp; vm, const StackBounds&amp; bounds)
+        : m_vm(vm)
+        , m_bounds(bounds)
+    {
+    }
+
+    bool isSafeToRecurse() const { return m_bounds.isSafeToRecurse(requiredCapacity()); }
+
+private:
+    inline size_t requiredCapacity() const
+    {
+        Interpreter* interpreter = m_vm.interpreter;
+
+        // We have two separate stack limits, one for regular JS execution, and one
+        // for when we're handling errors. We need the error stack to be smaller
+        // otherwise there would obviously not be any stack left to execute JS in when
+        // there's a stack overflow.
+        //
+        // These sizes were derived from the stack usage of a number of sites when
+        // layout occurs when we've already consumed most of the C stack.
+        const size_t requiredStack = 128 * KB;
+        const size_t errorModeRequiredStack = 64 * KB;
+
+        size_t requiredCapacity = interpreter-&gt;isInErrorHandlingMode() ? errorModeRequiredStack : requiredStack;
+        RELEASE_ASSERT(m_bounds.size() &gt;= requiredCapacity);
+        return requiredCapacity; 
+    }
+
+    VM&amp; m_vm;
+    const StackBounds&amp; m_bounds;
+};
+
+} // namespace JSC
+
+#endif // VMStackBounds_h
+
</ins></span></pre>
</div>
</div>

</body>
</html>