<!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>[189711] releases/WebKitGTK/webkit-2.10/Source/JavaScriptCore</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/189711">189711</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2015-09-14 05:00:47 -0700 (Mon, 14 Sep 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/188648">r188648</a> - Add ability to save and restore JSC options.
https://bugs.webkit.org/show_bug.cgi?id=148125

Reviewed by Saam Barati.

* API/tests/ExecutionTimeLimitTest.cpp:
(testExecutionTimeLimit):
- Employ the new options getter/setter to run watchdog tests for each of the
  execution engine tiers.
- Also altered the test scripts to be in a function instead of global code.
  This is one of 2 changes needed to give them an opportunity to be FTL compiled.
  The other is to add support for compiling CheckWatchdogTimer in the FTL (which
  will be addressed in a separate patch).

* jsc.cpp:
(CommandLine::parseArguments):
* runtime/Options.cpp:
(JSC::parse):
- Add the ability to clear a string option with a nullptr value.
  This is needed to restore a default string option value which may be null.

(JSC::OptionRange::init):
- Add the ability to clear a range option with a null value.
  This is needed to restore a default range option value which may be null.

(JSC::Options::initialize):
(JSC::Options::dumpOptionsIfNeeded):
- Factor code to dump options out to dumpOptionsIfNeeded() since we will need
  that logic elsewhere.

(JSC::Options::setOptions):
- Parse an options string and set each of the specified options.

(JSC::Options::dumpAllOptions):
(JSC::Options::dumpAllOptionsInALine):
(JSC::Options::dumpOption):
(JSC::Option::dump):
- Refactored so that the underlying dumper dumps to a StringBuilder instead of
  stderr.  This lets us reuse this code to serialize all the options into a
  single string for dumpAllOptionsInALine().

* runtime/Options.h:
(JSC::OptionRange::rangeString):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#releasesWebKitGTKwebkit210SourceJavaScriptCoreAPItestsExecutionTimeLimitTestcpp">releases/WebKitGTK/webkit-2.10/Source/JavaScriptCore/API/tests/ExecutionTimeLimitTest.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit210SourceJavaScriptCoreChangeLog">releases/WebKitGTK/webkit-2.10/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#releasesWebKitGTKwebkit210SourceJavaScriptCorejsccpp">releases/WebKitGTK/webkit-2.10/Source/JavaScriptCore/jsc.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit210SourceJavaScriptCoreruntimeOptionscpp">releases/WebKitGTK/webkit-2.10/Source/JavaScriptCore/runtime/Options.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit210SourceJavaScriptCoreruntimeOptionsh">releases/WebKitGTK/webkit-2.10/Source/JavaScriptCore/runtime/Options.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="releasesWebKitGTKwebkit210SourceJavaScriptCoreAPItestsExecutionTimeLimitTestcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.10/Source/JavaScriptCore/API/tests/ExecutionTimeLimitTest.cpp (189710 => 189711)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.10/Source/JavaScriptCore/API/tests/ExecutionTimeLimitTest.cpp        2015-09-14 11:11:43 UTC (rev 189710)
+++ releases/WebKitGTK/webkit-2.10/Source/JavaScriptCore/API/tests/ExecutionTimeLimitTest.cpp        2015-09-14 12:00:47 UTC (rev 189711)
</span><span class="lines">@@ -26,12 +26,16 @@
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;ExecutionTimeLimitTest.h&quot;
</span><span class="cx"> 
</span><ins>+#include &quot;InitializeThreading.h&quot;
</ins><span class="cx"> #include &quot;JSContextRefPrivate.h&quot;
</span><span class="cx"> #include &quot;JavaScriptCore.h&quot;
</span><ins>+#include &quot;Options.h&quot;
</ins><span class="cx"> #include &lt;chrono&gt;
</span><span class="cx"> #include &lt;wtf/CurrentTime.h&gt;
</span><ins>+#include &lt;wtf/text/StringBuilder.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> using namespace std::chrono;
</span><ins>+using JSC::Options;
</ins><span class="cx"> 
</span><span class="cx"> static JSGlobalContextRef context = nullptr;
</span><span class="cx"> 
</span><span class="lines">@@ -48,27 +52,22 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool shouldTerminateCallbackWasCalled = false;
</span><del>-static bool shouldTerminateCallback(JSContextRef ctx, void* context)
</del><ins>+static bool shouldTerminateCallback(JSContextRef, void*)
</ins><span class="cx"> {
</span><del>-    UNUSED_PARAM(ctx);
-    UNUSED_PARAM(context);
</del><span class="cx">     shouldTerminateCallbackWasCalled = true;
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool cancelTerminateCallbackWasCalled = false;
</span><del>-static bool cancelTerminateCallback(JSContextRef ctx, void* context)
</del><ins>+static bool cancelTerminateCallback(JSContextRef, void*)
</ins><span class="cx"> {
</span><del>-    UNUSED_PARAM(ctx);
-    UNUSED_PARAM(context);
</del><span class="cx">     cancelTerminateCallbackWasCalled = true;
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> int extendTerminateCallbackCalled = 0;
</span><del>-static bool extendTerminateCallback(JSContextRef ctx, void* context)
</del><ins>+static bool extendTerminateCallback(JSContextRef ctx, void*)
</ins><span class="cx"> {
</span><del>-    UNUSED_PARAM(context);
</del><span class="cx">     extendTerminateCallbackCalled++;
</span><span class="cx">     if (extendTerminateCallbackCalled == 1) {
</span><span class="cx">         JSContextGroupRef contextGroup = JSContextGetGroup(ctx);
</span><span class="lines">@@ -78,159 +77,234 @@
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+struct TierOptions {
+    const char* tier;
+    unsigned timeLimitAdjustmentMillis;
+    const char* optionsStr;
+};
</ins><span class="cx"> 
</span><span class="cx"> int testExecutionTimeLimit()
</span><span class="cx"> {
</span><del>-    context = JSGlobalContextCreateInGroup(nullptr, nullptr);
</del><ins>+    static const TierOptions tierOptionsList[] = {
+        { &quot;LLINT&quot;,    0,   &quot;--enableConcurrentJIT=false --useLLInt=true --useJIT=false&quot; },
+        { &quot;Baseline&quot;, 0,   &quot;--enableConcurrentJIT=false --useLLInt=true --useJIT=true --useDFGJIT=false&quot; },
+        { &quot;DFG&quot;,      0,   &quot;--enableConcurrentJIT=false --useLLInt=true --useJIT=true --useDFGJIT=true --useFTLJIT=false&quot; },
+        { &quot;FTL&quot;,      200, &quot;--enableConcurrentJIT=false --useLLInt=true --useJIT=true --useDFGJIT=true --useFTLJIT=true&quot; },
+    };
+    
+    bool failed = false;
</ins><span class="cx"> 
</span><del>-    JSContextGroupRef contextGroup = JSContextGetGroup(context);
-    JSObjectRef globalObject = JSContextGetGlobalObject(context);
-    ASSERT(JSValueIsObject(context, globalObject));
</del><ins>+    JSC::initializeThreading();
+    Options::initialize(); // Ensure options is initialized first.
</ins><span class="cx"> 
</span><del>-    JSValueRef v = nullptr;
-    JSValueRef exception = nullptr;
-    bool failed = false;
</del><ins>+    for (auto tierOptions : tierOptionsList) {
+        StringBuilder savedOptionsBuilder;
+        Options::dumpAllOptionsInALine(savedOptionsBuilder);
</ins><span class="cx"> 
</span><del>-    JSStringRef currentCPUTimeStr = JSStringCreateWithUTF8CString(&quot;currentCPUTime&quot;);
-    JSObjectRef currentCPUTimeFunction = JSObjectMakeFunctionWithCallback(context, currentCPUTimeStr, currentCPUTimeAsJSFunctionCallback);
-    JSObjectSetProperty(context, globalObject, currentCPUTimeStr, currentCPUTimeFunction, kJSPropertyAttributeNone, nullptr);
-    JSStringRelease(currentCPUTimeStr);
-    
-    /* Test script timeout: */
-    JSContextGroupSetExecutionTimeLimit(contextGroup, .10f, shouldTerminateCallback, 0);
-    {
-        const char* loopForeverScript = &quot;var startTime = currentCPUTime(); while (true) { if (currentCPUTime() - startTime &gt; .150) break; } &quot;;
-        JSStringRef script = JSStringCreateWithUTF8CString(loopForeverScript);
-        exception = nullptr;
-        shouldTerminateCallbackWasCalled = false;
-        auto startTime = currentCPUTime();
-        v = JSEvaluateScript(context, script, nullptr, nullptr, 1, &amp;exception);
-        auto endTime = currentCPUTime();
</del><ins>+        Options::setOptions(tierOptions.optionsStr);
</ins><span class="cx">         
</span><del>-        if (((endTime - startTime) &lt; milliseconds(150)) &amp;&amp; shouldTerminateCallbackWasCalled)
-            printf(&quot;PASS: script timed out as expected.\n&quot;);
-        else {
-            if (!((endTime - startTime) &lt; milliseconds(150)))
-                printf(&quot;FAIL: script did not time out as expected.\n&quot;);
-            if (!shouldTerminateCallbackWasCalled)
-                printf(&quot;FAIL: script timeout callback was not called.\n&quot;);
-            failed = true;
-        }
</del><ins>+        unsigned tierAdjustmentMillis = tierOptions.timeLimitAdjustmentMillis;
+        double timeLimit;
+
+        context = JSGlobalContextCreateInGroup(nullptr, nullptr);
+
+        JSContextGroupRef contextGroup = JSContextGetGroup(context);
+        JSObjectRef globalObject = JSContextGetGlobalObject(context);
+        ASSERT(JSValueIsObject(context, globalObject));
+
+        JSValueRef scriptResult = nullptr;
+        JSValueRef exception = nullptr;
+
+        JSStringRef currentCPUTimeStr = JSStringCreateWithUTF8CString(&quot;currentCPUTime&quot;);
+        JSObjectRef currentCPUTimeFunction = JSObjectMakeFunctionWithCallback(context, currentCPUTimeStr, currentCPUTimeAsJSFunctionCallback);
+        JSObjectSetProperty(context, globalObject, currentCPUTimeStr, currentCPUTimeFunction, kJSPropertyAttributeNone, nullptr);
+        JSStringRelease(currentCPUTimeStr);
</ins><span class="cx">         
</span><del>-        if (!exception) {
-            printf(&quot;FAIL: TerminatedExecutionException was not thrown.\n&quot;);
-            failed = true;
</del><ins>+        /* Test script timeout: */
+        timeLimit = (100 + tierAdjustmentMillis) / 1000.0;
+        JSContextGroupSetExecutionTimeLimit(contextGroup, timeLimit, shouldTerminateCallback, 0);
+        {
+            unsigned timeAfterWatchdogShouldHaveFired = 150 + tierAdjustmentMillis;
+
+            StringBuilder scriptBuilder;
+            scriptBuilder.append(&quot;function foo() { var startTime = currentCPUTime(); while (true) { for (var i = 0; i &lt; 1000; i++); if (currentCPUTime() - startTime &gt; &quot;);
+            scriptBuilder.appendNumber(timeAfterWatchdogShouldHaveFired / 1000.0);
+            scriptBuilder.append(&quot;) break; } } foo();&quot;);
+
+            JSStringRef script = JSStringCreateWithUTF8CString(scriptBuilder.toString().utf8().data());
+            exception = nullptr;
+            shouldTerminateCallbackWasCalled = false;
+            auto startTime = currentCPUTime();
+            scriptResult = JSEvaluateScript(context, script, nullptr, nullptr, 1, &amp;exception);
+            auto endTime = currentCPUTime();
+
+            if (((endTime - startTime) &lt; milliseconds(timeAfterWatchdogShouldHaveFired)) &amp;&amp; shouldTerminateCallbackWasCalled)
+                printf(&quot;PASS: %s script timed out as expected.\n&quot;, tierOptions.tier);
+            else {
+                if ((endTime - startTime) &gt;= milliseconds(timeAfterWatchdogShouldHaveFired))
+                    printf(&quot;FAIL: %s script did not time out as expected.\n&quot;, tierOptions.tier);
+                if (!shouldTerminateCallbackWasCalled)
+                    printf(&quot;FAIL: %s script timeout callback was not called.\n&quot;, tierOptions.tier);
+                failed = true;
+            }
+            
+            if (!exception) {
+                printf(&quot;FAIL: %s TerminatedExecutionException was not thrown.\n&quot;, tierOptions.tier);
+                failed = true;
+            }
</ins><span class="cx">         }
</span><del>-    }
-    
-    /* Test the script timeout's TerminatedExecutionException should NOT be catchable: */
-    JSContextGroupSetExecutionTimeLimit(contextGroup, 0.10f, shouldTerminateCallback, 0);
-    {
-        const char* loopForeverScript = &quot;var startTime = currentCPUTime(); try { while (true) { if (currentCPUTime() - startTime &gt; .150) break; } } catch(e) { }&quot;;
-        JSStringRef script = JSStringCreateWithUTF8CString(loopForeverScript);
-        exception = nullptr;
-        shouldTerminateCallbackWasCalled = false;
-        auto startTime = currentCPUTime();
-        v = JSEvaluateScript(context, script, nullptr, nullptr, 1, &amp;exception);
-        auto endTime = currentCPUTime();
-        
-        if (((endTime - startTime) &gt;= milliseconds(150)) || !shouldTerminateCallbackWasCalled) {
-            if (!((endTime - startTime) &lt; milliseconds(150)))
-                printf(&quot;FAIL: script did not time out as expected.\n&quot;);
-            if (!shouldTerminateCallbackWasCalled)
-                printf(&quot;FAIL: script timeout callback was not called.\n&quot;);
-            failed = true;
</del><ins>+
+        /* Test the script timeout's TerminatedExecutionException should NOT be catchable: */
+        timeLimit = (100 + tierAdjustmentMillis) / 1000.0;
+        JSContextGroupSetExecutionTimeLimit(contextGroup, timeLimit, shouldTerminateCallback, 0);
+        {
+            unsigned timeAfterWatchdogShouldHaveFired = 150 + tierAdjustmentMillis;
+            
+            StringBuilder scriptBuilder;
+            scriptBuilder.append(&quot;function foo() { var startTime = currentCPUTime(); try { while (true) { for (var i = 0; i &lt; 1000; i++); if (currentCPUTime() - startTime &gt; &quot;);
+            scriptBuilder.appendNumber(timeAfterWatchdogShouldHaveFired / 1000.0);
+            scriptBuilder.append(&quot;) break; } } catch(e) { } } foo();&quot;);
+
+            JSStringRef script = JSStringCreateWithUTF8CString(scriptBuilder.toString().utf8().data());
+            exception = nullptr;
+            shouldTerminateCallbackWasCalled = false;
+
+            auto startTime = currentCPUTime();
+            scriptResult = JSEvaluateScript(context, script, nullptr, nullptr, 1, &amp;exception);
+            auto endTime = currentCPUTime();
+            
+            if (((endTime - startTime) &gt;= milliseconds(timeAfterWatchdogShouldHaveFired)) || !shouldTerminateCallbackWasCalled) {
+                if (!((endTime - startTime) &lt; milliseconds(timeAfterWatchdogShouldHaveFired)))
+                    printf(&quot;FAIL: %s script did not time out as expected.\n&quot;, tierOptions.tier);
+                if (!shouldTerminateCallbackWasCalled)
+                    printf(&quot;FAIL: %s script timeout callback was not called.\n&quot;, tierOptions.tier);
+                failed = true;
+            }
+            
+            if (exception)
+                printf(&quot;PASS: %s TerminatedExecutionException was not catchable as expected.\n&quot;, tierOptions.tier);
+            else {
+                printf(&quot;FAIL: %s TerminatedExecutionException was caught.\n&quot;, tierOptions.tier);
+                failed = true;
+            }
</ins><span class="cx">         }
</span><span class="cx">         
</span><del>-        if (exception)
-            printf(&quot;PASS: TerminatedExecutionException was not catchable as expected.\n&quot;);
-        else {
-            printf(&quot;FAIL: TerminatedExecutionException was caught.\n&quot;);
-            failed = true;
</del><ins>+        /* Test script timeout with no callback: */
+        timeLimit = (100 + tierAdjustmentMillis) / 1000.0;
+        JSContextGroupSetExecutionTimeLimit(contextGroup, timeLimit, 0, 0);
+        {
+            unsigned timeAfterWatchdogShouldHaveFired = 150 + tierAdjustmentMillis;
+            
+            StringBuilder scriptBuilder;
+            scriptBuilder.append(&quot;function foo() { var startTime = currentCPUTime(); while (true) { for (var i = 0; i &lt; 1000; i++); if (currentCPUTime() - startTime &gt; &quot;);
+            scriptBuilder.appendNumber(timeAfterWatchdogShouldHaveFired / 1000.0);
+            scriptBuilder.append(&quot;) break; } } foo();&quot;);
+            
+            JSStringRef script = JSStringCreateWithUTF8CString(scriptBuilder.toString().utf8().data());
+            exception = nullptr;
+            shouldTerminateCallbackWasCalled = false;
+
+            auto startTime = currentCPUTime();
+            scriptResult = JSEvaluateScript(context, script, nullptr, nullptr, 1, &amp;exception);
+            auto endTime = currentCPUTime();
+            
+            if (((endTime - startTime) &lt; milliseconds(timeAfterWatchdogShouldHaveFired)) &amp;&amp; !shouldTerminateCallbackWasCalled)
+                printf(&quot;PASS: %s script timed out as expected when no callback is specified.\n&quot;, tierOptions.tier);
+            else {
+                if ((endTime - startTime) &gt;= milliseconds(timeAfterWatchdogShouldHaveFired))
+                    printf(&quot;FAIL: %s script did not time out as expected when no callback is specified.\n&quot;, tierOptions.tier);
+                else
+                    printf(&quot;FAIL: %s script called stale callback function.\n&quot;, tierOptions.tier);
+                failed = true;
+            }
+            
+            if (!exception) {
+                printf(&quot;FAIL: %s TerminatedExecutionException was not thrown.\n&quot;, tierOptions.tier);
+                failed = true;
+            }
</ins><span class="cx">         }
</span><del>-    }
-    
-    /* Test script timeout with no callback: */
-    JSContextGroupSetExecutionTimeLimit(contextGroup, .10f, 0, 0);
-    {
-        const char* loopForeverScript = &quot;var startTime = currentCPUTime(); while (true) { if (currentCPUTime() - startTime &gt; .150) break; } &quot;;
-        JSStringRef script = JSStringCreateWithUTF8CString(loopForeverScript);
-        exception = nullptr;
-        auto startTime = currentCPUTime();
-        v = JSEvaluateScript(context, script, nullptr, nullptr, 1, &amp;exception);
-        auto endTime = currentCPUTime();
</del><span class="cx">         
</span><del>-        if (((endTime - startTime) &lt; milliseconds(150)) &amp;&amp; shouldTerminateCallbackWasCalled)
-            printf(&quot;PASS: script timed out as expected when no callback is specified.\n&quot;);
-        else {
-            if (!((endTime - startTime) &lt; milliseconds(150)))
-                printf(&quot;FAIL: script did not time out as expected when no callback is specified.\n&quot;);
-            failed = true;
</del><ins>+        /* Test script timeout cancellation: */
+        timeLimit = (100 + tierAdjustmentMillis) / 1000.0;
+        JSContextGroupSetExecutionTimeLimit(contextGroup, timeLimit, cancelTerminateCallback, 0);
+        {
+            unsigned timeAfterWatchdogShouldHaveFired = 150 + tierAdjustmentMillis;
+            
+            StringBuilder scriptBuilder;
+            scriptBuilder.append(&quot;function foo() { var startTime = currentCPUTime(); while (true) { for (var i = 0; i &lt; 1000; i++); if (currentCPUTime() - startTime &gt; &quot;);
+            scriptBuilder.appendNumber(timeAfterWatchdogShouldHaveFired / 1000.0);
+            scriptBuilder.append(&quot;) break; } } foo();&quot;);
+
+            JSStringRef script = JSStringCreateWithUTF8CString(scriptBuilder.toString().utf8().data());
+            exception = nullptr;
+            cancelTerminateCallbackWasCalled = false;
+
+            auto startTime = currentCPUTime();
+            scriptResult = JSEvaluateScript(context, script, nullptr, nullptr, 1, &amp;exception);
+            auto endTime = currentCPUTime();
+            
+            if (((endTime - startTime) &gt;= milliseconds(timeAfterWatchdogShouldHaveFired)) &amp;&amp; cancelTerminateCallbackWasCalled &amp;&amp; !exception)
+                printf(&quot;PASS: %s script timeout was cancelled as expected.\n&quot;, tierOptions.tier);
+            else {
+                if (((endTime - startTime) &lt; milliseconds(timeAfterWatchdogShouldHaveFired)) || exception)
+                    printf(&quot;FAIL: %s script timeout was not cancelled.\n&quot;, tierOptions.tier);
+                if (!cancelTerminateCallbackWasCalled)
+                    printf(&quot;FAIL: %s script timeout callback was not called.\n&quot;, tierOptions.tier);
+                failed = true;
+            }
+            
+            if (exception) {
+                printf(&quot;FAIL: %s Unexpected TerminatedExecutionException thrown.\n&quot;, tierOptions.tier);
+                failed = true;
+            }
</ins><span class="cx">         }
</span><span class="cx">         
</span><del>-        if (!exception) {
-            printf(&quot;FAIL: TerminatedExecutionException was not thrown.\n&quot;);
-            failed = true;
</del><ins>+        /* Test script timeout extension: */
+        timeLimit = (100 + tierAdjustmentMillis) / 1000.0;
+        JSContextGroupSetExecutionTimeLimit(contextGroup, timeLimit, extendTerminateCallback, 0);
+        {
+            unsigned timeBeforeExtendedDeadline = 200 + tierAdjustmentMillis;
+            unsigned timeAfterExtendedDeadline = 400 + tierAdjustmentMillis;
+            unsigned maxBusyLoopTime = 600 + tierAdjustmentMillis;
+
+            StringBuilder scriptBuilder;
+            scriptBuilder.append(&quot;function foo() { var startTime = currentCPUTime(); while (true) { for (var i = 0; i &lt; 1000; i++); if (currentCPUTime() - startTime &gt; &quot;);
+            scriptBuilder.appendNumber(maxBusyLoopTime / 1000.0); // in seconds.
+            scriptBuilder.append(&quot;) break; } } foo();&quot;);
+
+            JSStringRef script = JSStringCreateWithUTF8CString(scriptBuilder.toString().utf8().data());
+            exception = nullptr;
+            extendTerminateCallbackCalled = 0;
+
+            auto startTime = currentCPUTime();
+            scriptResult = JSEvaluateScript(context, script, nullptr, nullptr, 1, &amp;exception);
+            auto endTime = currentCPUTime();
+            auto deltaTime = endTime - startTime;
+            
+            if ((deltaTime &gt;= milliseconds(timeBeforeExtendedDeadline)) &amp;&amp; (deltaTime &lt; milliseconds(timeAfterExtendedDeadline)) &amp;&amp; (extendTerminateCallbackCalled == 2) &amp;&amp; exception)
+                printf(&quot;PASS: %s script timeout was extended as expected.\n&quot;, tierOptions.tier);
+            else {
+                if (deltaTime &lt; milliseconds(timeBeforeExtendedDeadline))
+                    printf(&quot;FAIL: %s script timeout was not extended as expected.\n&quot;, tierOptions.tier);
+                else if (deltaTime &gt;= milliseconds(timeAfterExtendedDeadline))
+                    printf(&quot;FAIL: %s script did not timeout.\n&quot;, tierOptions.tier);
+                
+                if (extendTerminateCallbackCalled &lt; 1)
+                    printf(&quot;FAIL: %s script timeout callback was not called.\n&quot;, tierOptions.tier);
+                if (extendTerminateCallbackCalled &lt; 2)
+                    printf(&quot;FAIL: %s script timeout callback was not called after timeout extension.\n&quot;, tierOptions.tier);
+                
+                if (!exception)
+                    printf(&quot;FAIL: %s TerminatedExecutionException was not thrown during timeout extension test.\n&quot;, tierOptions.tier);
+                
+                failed = true;
+            }
</ins><span class="cx">         }
</span><ins>+
+        JSGlobalContextRelease(context);
+
+        Options::setOptions(savedOptionsBuilder.toString().ascii().data());
</ins><span class="cx">     }
</span><span class="cx">     
</span><del>-    /* Test script timeout cancellation: */
-    JSContextGroupSetExecutionTimeLimit(contextGroup, 0.10f, cancelTerminateCallback, 0);
-    {
-        const char* loopForeverScript = &quot;var startTime = currentCPUTime(); while (true) { if (currentCPUTime() - startTime &gt; .150) break; } &quot;;
-        JSStringRef script = JSStringCreateWithUTF8CString(loopForeverScript);
-        exception = nullptr;
-        auto startTime = currentCPUTime();
-        v = JSEvaluateScript(context, script, nullptr, nullptr, 1, &amp;exception);
-        auto endTime = currentCPUTime();
-        
-        if (((endTime - startTime) &gt;= milliseconds(150)) &amp;&amp; cancelTerminateCallbackWasCalled &amp;&amp; !exception)
-            printf(&quot;PASS: script timeout was cancelled as expected.\n&quot;);
-        else {
-            if (((endTime - startTime) &lt; milliseconds(150)) || exception)
-                printf(&quot;FAIL: script timeout was not cancelled.\n&quot;);
-            if (!cancelTerminateCallbackWasCalled)
-                printf(&quot;FAIL: script timeout callback was not called.\n&quot;);
-            failed = true;
-        }
-        
-        if (exception) {
-            printf(&quot;FAIL: Unexpected TerminatedExecutionException thrown.\n&quot;);
-            failed = true;
-        }
-    }
-    
-    /* Test script timeout extension: */
-    JSContextGroupSetExecutionTimeLimit(contextGroup, 0.100f, extendTerminateCallback, 0);
-    {
-        const char* loopForeverScript = &quot;var startTime = currentCPUTime(); while (true) { if (currentCPUTime() - startTime &gt; .500) break; } &quot;;
-        JSStringRef script = JSStringCreateWithUTF8CString(loopForeverScript);
-        exception = nullptr;
-        auto startTime = currentCPUTime();
-        v = JSEvaluateScript(context, script, nullptr, nullptr, 1, &amp;exception);
-        auto endTime = currentCPUTime();
-        auto deltaTime = endTime - startTime;
-        
-        if ((deltaTime &gt;= milliseconds(300)) &amp;&amp; (deltaTime &lt; milliseconds(500)) &amp;&amp; (extendTerminateCallbackCalled == 2) &amp;&amp; exception)
-            printf(&quot;PASS: script timeout was extended as expected.\n&quot;);
-        else {
-            if (deltaTime &lt; milliseconds(200))
-                printf(&quot;FAIL: script timeout was not extended as expected.\n&quot;);
-            else if (deltaTime &gt;= milliseconds(500))
-                printf(&quot;FAIL: script did not timeout.\n&quot;);
-            
-            if (extendTerminateCallbackCalled &lt; 1)
-                printf(&quot;FAIL: script timeout callback was not called.\n&quot;);
-            if (extendTerminateCallbackCalled &lt; 2)
-                printf(&quot;FAIL: script timeout callback was not called after timeout extension.\n&quot;);
-            
-            if (!exception)
-                printf(&quot;FAIL: TerminatedExecutionException was not thrown during timeout extension test.\n&quot;);
-            
-            failed = true;
-        }
-    }
-
-    JSGlobalContextRelease(context);
</del><span class="cx">     return failed;
</span><span class="cx"> }
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit210SourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.10/Source/JavaScriptCore/ChangeLog (189710 => 189711)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.10/Source/JavaScriptCore/ChangeLog        2015-09-14 11:11:43 UTC (rev 189710)
+++ releases/WebKitGTK/webkit-2.10/Source/JavaScriptCore/ChangeLog        2015-09-14 12:00:47 UTC (rev 189711)
</span><span class="lines">@@ -1,3 +1,78 @@
</span><ins>+2015-08-20  Mark Lam  &lt;mark.lam@apple.com&gt;
+
+        A watchdog tests is failing on Windows.
+        https://bugs.webkit.org/show_bug.cgi?id=148228
+
+        Reviewed by Brent Fulgham.
+
+        The test just needed a little more time because Windows' timer resolution is low.
+        After increasing the test deadlines, the test started passing.
+
+        * API/tests/ExecutionTimeLimitTest.cpp:
+        (testExecutionTimeLimit):
+
+2015-08-20  Mark Lam  &lt;mark.lam@apple.com&gt;
+
+        Fixed some warnings on Windows.
+        https://bugs.webkit.org/show_bug.cgi?id=148224
+
+        Reviewed by Brent Fulgham.
+
+        The Windows build was complaining that function params were hiding a global variable.
+        Since the function params were unused, I resolved this by removing the param names.
+
+        * API/tests/ExecutionTimeLimitTest.cpp:
+        (currentCPUTimeAsJSFunctionCallback):
+        (shouldTerminateCallback):
+        (cancelTerminateCallback):
+        (extendTerminateCallback):
+
+2015-08-19  Mark Lam  &lt;mark.lam@apple.com&gt;
+
+        Add ability to save and restore JSC options.
+        https://bugs.webkit.org/show_bug.cgi?id=148125
+
+        Reviewed by Saam Barati.
+
+        * API/tests/ExecutionTimeLimitTest.cpp:
+        (testExecutionTimeLimit):
+        - Employ the new options getter/setter to run watchdog tests for each of the
+          execution engine tiers.
+        - Also altered the test scripts to be in a function instead of global code.
+          This is one of 2 changes needed to give them an opportunity to be FTL compiled.
+          The other is to add support for compiling CheckWatchdogTimer in the FTL (which
+          will be addressed in a separate patch).
+
+        * jsc.cpp:
+        (CommandLine::parseArguments):
+        * runtime/Options.cpp:
+        (JSC::parse):
+        - Add the ability to clear a string option with a nullptr value.
+          This is needed to restore a default string option value which may be null.
+
+        (JSC::OptionRange::init):
+        - Add the ability to clear a range option with a null value.
+          This is needed to restore a default range option value which may be null.
+
+        (JSC::Options::initialize):
+        (JSC::Options::dumpOptionsIfNeeded):
+        - Factor code to dump options out to dumpOptionsIfNeeded() since we will need
+          that logic elsewhere.
+
+        (JSC::Options::setOptions):
+        - Parse an options string and set each of the specified options.
+
+        (JSC::Options::dumpAllOptions):
+        (JSC::Options::dumpAllOptionsInALine):
+        (JSC::Options::dumpOption):
+        (JSC::Option::dump):
+        - Refactored so that the underlying dumper dumps to a StringBuilder instead of
+          stderr.  This lets us reuse this code to serialize all the options into a
+          single string for dumpAllOptionsInALine().
+
+        * runtime/Options.h:
+        (JSC::OptionRange::rangeString):
+
</ins><span class="cx"> 2015-08-26  Andreas Kling  &lt;akling@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [JSC] StructureTransitionTable should eagerly deallocate single-transition WeakImpls.
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit210SourceJavaScriptCorejsccpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.10/Source/JavaScriptCore/jsc.cpp (189710 => 189711)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.10/Source/JavaScriptCore/jsc.cpp        2015-09-14 11:11:43 UTC (rev 189710)
+++ releases/WebKitGTK/webkit-2.10/Source/JavaScriptCore/jsc.cpp        2015-09-14 12:00:47 UTC (rev 189711)
</span><span class="lines">@@ -1545,7 +1545,7 @@
</span><span class="cx">         m_arguments.append(argv[i]);
</span><span class="cx"> 
</span><span class="cx">     if (needToDumpOptions)
</span><del>-        JSC::Options::dumpAllOptions(JSC::Options::DumpLevel::Verbose, &quot;All JSC runtime options:&quot;, stderr);
</del><ins>+        JSC::Options::dumpAllOptions(stderr, JSC::Options::DumpLevel::Verbose, &quot;All JSC runtime options:&quot;);
</ins><span class="cx">     JSC::Options::ensureOptionsAreCoherent();
</span><span class="cx">     if (needToExit)
</span><span class="cx">         jscExit(EXIT_SUCCESS);
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit210SourceJavaScriptCoreruntimeOptionscpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.10/Source/JavaScriptCore/runtime/Options.cpp (189710 => 189711)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.10/Source/JavaScriptCore/runtime/Options.cpp        2015-09-14 11:11:43 UTC (rev 189710)
+++ releases/WebKitGTK/webkit-2.10/Source/JavaScriptCore/runtime/Options.cpp        2015-09-14 12:00:47 UTC (rev 189711)
</span><span class="lines">@@ -38,6 +38,7 @@
</span><span class="cx"> #include &lt;wtf/PageBlock.h&gt;
</span><span class="cx"> #include &lt;wtf/StdLibExtras.h&gt;
</span><span class="cx"> #include &lt;wtf/StringExtras.h&gt;
</span><ins>+#include &lt;wtf/text/StringBuilder.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> #if OS(DARWIN) &amp;&amp; ENABLE(PARALLEL_GC)
</span><span class="cx"> #include &lt;sys/sysctl.h&gt;
</span><span class="lines">@@ -84,6 +85,8 @@
</span><span class="cx"> 
</span><span class="cx"> static bool parse(const char* string, const char*&amp; value)
</span><span class="cx"> {
</span><ins>+    if (!strlen(string))
+        string = nullptr;
</ins><span class="cx">     value = string;
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="lines">@@ -149,6 +152,8 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+const char* const OptionRange::s_nullRangeStr = &quot;&lt;null&gt;&quot;;
+
</ins><span class="cx"> bool OptionRange::init(const char* rangeString)
</span><span class="cx"> {
</span><span class="cx">     // rangeString should be in the form of [!]&lt;low&gt;[:&lt;high&gt;]
</span><span class="lines">@@ -156,14 +161,16 @@
</span><span class="cx"> 
</span><span class="cx">     bool invert = false;
</span><span class="cx"> 
</span><del>-    if (m_state &gt; Uninitialized)
-        return true;
-
</del><span class="cx">     if (!rangeString) {
</span><span class="cx">         m_state = InitError;
</span><span class="cx">         return false;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    if (!strcmp(rangeString, s_nullRangeStr)) {
+        m_state = Uninitialized;
+        return true;
+    }
+    
</ins><span class="cx">     m_rangeString = rangeString;
</span><span class="cx"> 
</span><span class="cx">     if (*rangeString == '!') {
</span><span class="lines">@@ -360,30 +367,100 @@
</span><span class="cx">             ASSERT(Options::thresholdForOptimizeAfterWarmUp() &gt;= Options::thresholdForOptimizeSoon());
</span><span class="cx">             ASSERT(Options::thresholdForOptimizeAfterWarmUp() &gt;= 0);
</span><span class="cx"> 
</span><del>-            if (Options::showOptions()) {
-                DumpLevel level = static_cast&lt;DumpLevel&gt;(Options::showOptions());
-                if (level &gt; DumpLevel::Verbose)
-                    level = DumpLevel::Verbose;
</del><ins>+            dumpOptionsIfNeeded();
+            ensureOptionsAreCoherent();
+        });
+}
</ins><span class="cx"> 
</span><del>-                const char* title = nullptr;
-                switch (level) {
-                case DumpLevel::None:
-                    break;
-                case DumpLevel::Overridden:
-                    title = &quot;Overridden JSC options:&quot;;
-                    break;
-                case DumpLevel::All:
-                    title = &quot;All JSC options:&quot;;
-                    break;
-                case DumpLevel::Verbose:
-                    title = &quot;All JSC options with descriptions:&quot;;
-                    break;
-                }
-                dumpAllOptions(level, title);
</del><ins>+void Options::dumpOptionsIfNeeded()
+{
+    if (Options::showOptions()) {
+        DumpLevel level = static_cast&lt;DumpLevel&gt;(Options::showOptions());
+        if (level &gt; DumpLevel::Verbose)
+            level = DumpLevel::Verbose;
+            
+        const char* title = nullptr;
+        switch (level) {
+        case DumpLevel::None:
+            break;
+        case DumpLevel::Overridden:
+            title = &quot;Overridden JSC options:&quot;;
+            break;
+        case DumpLevel::All:
+            title = &quot;All JSC options:&quot;;
+            break;
+        case DumpLevel::Verbose:
+            title = &quot;All JSC options with descriptions:&quot;;
+            break;
+        }
+
+        StringBuilder builder;
+        dumpAllOptions(builder, level, title, nullptr, &quot;   &quot;, &quot;\n&quot;, ShowDefaults);
+        dataLog(builder.toString());
+    }
+}
+
+bool Options::setOptions(const char* optionsStr)
+{
+    Vector&lt;char*&gt; options;
+
+    size_t length = strlen(optionsStr);
+    char* optionsStrCopy = WTF::fastStrDup(optionsStr);
+    char* end = optionsStrCopy + length;
+    char* p = optionsStrCopy;
+
+    while (p &lt; end) {
+        char* optionStart = p;
+        p = strstr(p, &quot;=&quot;);
+        if (!p) {
+            dataLogF(&quot;'=' not found in option string: %p\n&quot;, optionStart);
+            return false;
+        }
+        p++;
+
+        char* valueBegin = p;
+        bool hasStringValue = false;
+        const int minStringLength = 2; // The min is an empty string i.e. 2 double quotes.
+        if ((p + minStringLength &lt; end) &amp;&amp; (*p == '&quot;')) {
+            p = strstr(p + 1, &quot;\&quot;&quot;);
+            if (!p) {
+                dataLogF(&quot;Missing trailing '\&quot;' in option string: %p\n&quot;, optionStart);
+                return false; // End of string not found.
</ins><span class="cx">             }
</span><ins>+            hasStringValue = true;
+        }
</ins><span class="cx"> 
</span><del>-            ensureOptionsAreCoherent();
-        });
</del><ins>+        p = strstr(p, &quot; &quot;);
+        if (!p)
+            p = end; // No more &quot; &quot; separator. Hence, this is the last arg.
+
+        // If we have a well-formed string value, strip the quotes.
+        if (hasStringValue) {
+            char* valueEnd = p;
+            ASSERT((*valueBegin == '&quot;') &amp;&amp; ((valueEnd - valueBegin) &gt;= minStringLength) &amp;&amp; (valueEnd[-1] == '&quot;'));
+            memmove(valueBegin, valueBegin + 1, valueEnd - valueBegin - minStringLength);
+            valueEnd[-minStringLength] = '\0';
+        }
+
+        // Strip leading -- if present.
+        if ((p -  optionStart &gt; 2) &amp;&amp; optionStart[0] == '-' &amp;&amp; optionStart[1] == '-')
+            optionStart += 2;
+
+        *p++ = '\0';
+        options.append(optionStart);
+    }
+
+    bool success = true;
+    for (auto&amp; option : options) {
+        bool optionSuccess = setOption(option);
+        if (!optionSuccess) {
+            dataLogF(&quot;Failed to set option : %s\n&quot;, option);
+            success = false;
+        }
+    }
+
+    dumpOptionsIfNeeded();
+    return success;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> // Parses a single command line option in the format &quot;&lt;optionName&gt;=&lt;value&gt;&quot;
</span><span class="lines">@@ -420,16 +497,36 @@
</span><span class="cx">     return false; // No option matched.
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void Options::dumpAllOptions(DumpLevel level, const char* title, FILE* stream)
</del><ins>+void Options::dumpAllOptions(StringBuilder&amp; builder, DumpLevel level, const char* title,
+    const char* separator, const char* optionHeader, const char* optionFooter, ShowDefaultsOption showDefaultsOption)
</ins><span class="cx"> {
</span><del>-    if (title)
-        fprintf(stream, &quot;%s\n&quot;, title);
-    for (int id = 0; id &lt; numberOfOptions; id++)
-        dumpOption(level, static_cast&lt;OptionID&gt;(id), stream, &quot;   &quot;, &quot;\n&quot;);
</del><ins>+    if (title) {
+        builder.append(title);
+        builder.append('\n');
+    }
+
+    for (int id = 0; id &lt; numberOfOptions; id++) {
+        if (separator &amp;&amp; id)
+            builder.append(separator);
+        dumpOption(builder, level, static_cast&lt;OptionID&gt;(id), optionHeader, optionFooter, showDefaultsOption);
+    }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void Options::dumpOption(DumpLevel level, OptionID id, FILE* stream, const char* header, const char* footer)
</del><ins>+void Options::dumpAllOptionsInALine(StringBuilder&amp; builder)
</ins><span class="cx"> {
</span><ins>+    dumpAllOptions(builder, DumpLevel::All, nullptr, &quot; &quot;, nullptr, nullptr, DontShowDefaults);
+}
+
+void Options::dumpAllOptions(FILE* stream, DumpLevel level, const char* title)
+{
+    StringBuilder builder;
+    dumpAllOptions(builder, level, title, nullptr, &quot;   &quot;, &quot;\n&quot;, ShowDefaults);
+    fprintf(stream, &quot;%s&quot;, builder.toString().ascii().data());
+}
+
+void Options::dumpOption(StringBuilder&amp; builder, DumpLevel level, OptionID id,
+    const char* header, const char* footer, ShowDefaultsOption showDefaultsOption)
+{
</ins><span class="cx">     if (id &gt;= numberOfOptions)
</span><span class="cx">         return; // Illegal option.
</span><span class="cx"> 
</span><span class="lines">@@ -440,19 +537,24 @@
</span><span class="cx">     if (level == DumpLevel::Overridden &amp;&amp; !wasOverridden)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    fprintf(stream, &quot;%s%s: &quot;, header, option.name());
-    option.dump(stream);
</del><ins>+    if (header)
+        builder.append(header);
+    builder.append(option.name());
+    builder.append('=');
+    option.dump(builder);
</ins><span class="cx"> 
</span><del>-    if (wasOverridden) {
-        fprintf(stream, &quot; (default: &quot;);
-        option.defaultOption().dump(stream);
-        fprintf(stream, &quot;)&quot;);
</del><ins>+    if (wasOverridden &amp;&amp; (showDefaultsOption == ShowDefaults)) {
+        builder.append(&quot; (default: &quot;);
+        option.defaultOption().dump(builder);
+        builder.append(&quot;)&quot;);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (needsDescription)
-        fprintf(stream, &quot;   ... %s&quot;, option.description());
</del><ins>+    if (needsDescription) {
+        builder.append(&quot;   ... &quot;);
+        builder.append(option.description());
+    }
</ins><span class="cx"> 
</span><del>-    fprintf(stream, &quot;%s&quot;, footer);
</del><ins>+    builder.append(footer);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void Options::ensureOptionsAreCoherent()
</span><span class="lines">@@ -466,33 +568,35 @@
</span><span class="cx">         CRASH();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void Option::dump(FILE* stream) const
</del><ins>+void Option::dump(StringBuilder&amp; builder) const
</ins><span class="cx"> {
</span><span class="cx">     switch (type()) {
</span><span class="cx">     case Options::Type::boolType:
</span><del>-        fprintf(stream, &quot;%s&quot;, m_entry.boolVal ? &quot;true&quot; : &quot;false&quot;);
</del><ins>+        builder.append(m_entry.boolVal ? &quot;true&quot; : &quot;false&quot;);
</ins><span class="cx">         break;
</span><span class="cx">     case Options::Type::unsignedType:
</span><del>-        fprintf(stream, &quot;%u&quot;, m_entry.unsignedVal);
</del><ins>+        builder.appendNumber(m_entry.unsignedVal);
</ins><span class="cx">         break;
</span><span class="cx">     case Options::Type::doubleType:
</span><del>-        fprintf(stream, &quot;%lf&quot;, m_entry.doubleVal);
</del><ins>+        builder.appendNumber(m_entry.doubleVal);
</ins><span class="cx">         break;
</span><span class="cx">     case Options::Type::int32Type:
</span><del>-        fprintf(stream, &quot;%d&quot;, m_entry.int32Val);
</del><ins>+        builder.appendNumber(m_entry.int32Val);
</ins><span class="cx">         break;
</span><span class="cx">     case Options::Type::optionRangeType:
</span><del>-        fprintf(stream, &quot;%s&quot;, m_entry.optionRangeVal.rangeString());
</del><ins>+        builder.append(m_entry.optionRangeVal.rangeString());
</ins><span class="cx">         break;
</span><span class="cx">     case Options::Type::optionStringType: {
</span><span class="cx">         const char* option = m_entry.optionStringVal;
</span><span class="cx">         if (!option)
</span><span class="cx">             option = &quot;&quot;;
</span><del>-        fprintf(stream, &quot;%s&quot;, option);
</del><ins>+        builder.append('&quot;');
+        builder.append(option);
+        builder.append('&quot;');
</ins><span class="cx">         break;
</span><span class="cx">     }
</span><span class="cx">     case Options::Type::gcLogLevelType: {
</span><del>-        fprintf(stream, &quot;%s&quot;, GCLogging::levelAsString(m_entry.gcLogLevelVal));
</del><ins>+        builder.append(GCLogging::levelAsString(m_entry.gcLogLevelVal));
</ins><span class="cx">         break;
</span><span class="cx">     }
</span><span class="cx">     }
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit210SourceJavaScriptCoreruntimeOptionsh"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.10/Source/JavaScriptCore/runtime/Options.h (189710 => 189711)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.10/Source/JavaScriptCore/runtime/Options.h        2015-09-14 11:11:43 UTC (rev 189710)
+++ releases/WebKitGTK/webkit-2.10/Source/JavaScriptCore/runtime/Options.h        2015-09-14 12:00:47 UTC (rev 189711)
</span><span class="lines">@@ -33,6 +33,11 @@
</span><span class="cx"> #include &lt;wtf/PrintStream.h&gt;
</span><span class="cx"> #include &lt;wtf/StdLibExtras.h&gt;
</span><span class="cx"> 
</span><ins>+namespace WTF {
+class StringBuilder;
+}
+using WTF::StringBuilder;
+
</ins><span class="cx"> namespace JSC {
</span><span class="cx"> 
</span><span class="cx"> // How do JSC VM options work?
</span><span class="lines">@@ -80,11 +85,13 @@
</span><span class="cx"> 
</span><span class="cx">     bool init(const char*);
</span><span class="cx">     bool isInRange(unsigned);
</span><del>-    const char* rangeString() const { return (m_state &gt; InitError) ? m_rangeString : &quot;&lt;null&gt;&quot;; }
</del><ins>+    const char* rangeString() const { return (m_state &gt; InitError) ? m_rangeString : s_nullRangeStr; }
</ins><span class="cx">     
</span><span class="cx">     void dump(PrintStream&amp; out) const;
</span><span class="cx"> 
</span><span class="cx"> private:
</span><ins>+    static const char* const s_nullRangeStr;
+
</ins><span class="cx">     RangeState m_state;
</span><span class="cx">     const char* m_rangeString;
</span><span class="cx">     unsigned m_lowLimit;
</span><span class="lines">@@ -359,11 +366,17 @@
</span><span class="cx"> 
</span><span class="cx">     JS_EXPORT_PRIVATE static void initialize();
</span><span class="cx"> 
</span><ins>+    // Parses a string of options where each option is of the format &quot;--&lt;optionName&gt;=&lt;value&gt;&quot;
+    // and are separated by a space. The leading &quot;--&quot; is optional and will be ignored.
+    JS_EXPORT_PRIVATE static bool setOptions(const char* optionsList);
+
</ins><span class="cx">     // Parses a single command line option in the format &quot;&lt;optionName&gt;=&lt;value&gt;&quot;
</span><span class="cx">     // (no spaces allowed) and set the specified option if appropriate.
</span><span class="cx">     JS_EXPORT_PRIVATE static bool setOption(const char* arg);
</span><del>-    JS_EXPORT_PRIVATE static void dumpAllOptions(DumpLevel, const char* title = nullptr, FILE* stream = stdout);
-    static void dumpOption(DumpLevel, OptionID, FILE* stream = stdout, const char* header = &quot;&quot;, const char* footer = &quot;&quot;);
</del><ins>+
+    JS_EXPORT_PRIVATE static void dumpAllOptions(FILE*, DumpLevel, const char* title = nullptr);
+    JS_EXPORT_PRIVATE static void dumpAllOptionsInALine(StringBuilder&amp;);
+
</ins><span class="cx">     JS_EXPORT_PRIVATE static void ensureOptionsAreCoherent();
</span><span class="cx"> 
</span><span class="cx">     // Declare accessors for each option:
</span><span class="lines">@@ -395,6 +408,16 @@
</span><span class="cx"> 
</span><span class="cx">     Options();
</span><span class="cx"> 
</span><ins>+    enum ShowDefaultsOption {
+        DontShowDefaults,
+        ShowDefaults
+    };
+    static void dumpOptionsIfNeeded();
+    static void dumpAllOptions(StringBuilder&amp;, DumpLevel, const char* title,
+        const char* separator, const char* optionHeader, const char* optionFooter, ShowDefaultsOption);
+    static void dumpOption(StringBuilder&amp;, DumpLevel, OptionID,
+        const char* optionHeader, const char* optionFooter, ShowDefaultsOption);
+
</ins><span class="cx">     // Declare the singleton instance of the options store:
</span><span class="cx">     JS_EXPORTDATA static Entry s_options[numberOfOptions];
</span><span class="cx">     static Entry s_defaultOptions[numberOfOptions];
</span><span class="lines">@@ -411,7 +434,8 @@
</span><span class="cx">     {
</span><span class="cx">     }
</span><span class="cx">     
</span><del>-    void dump(FILE*) const;
</del><ins>+    void dump(StringBuilder&amp;) const;
+
</ins><span class="cx">     bool operator==(const Option&amp; other) const;
</span><span class="cx">     bool operator!=(const Option&amp; other) const { return !(*this == other); }
</span><span class="cx">     
</span></span></pre>
</div>
</div>

</body>
</html>