<!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 "config.h"
</span><span class="cx"> #include "ExecutionTimeLimitTest.h"
</span><span class="cx">
</span><ins>+#include "InitializeThreading.h"
</ins><span class="cx"> #include "JSContextRefPrivate.h"
</span><span class="cx"> #include "JavaScriptCore.h"
</span><ins>+#include "Options.h"
</ins><span class="cx"> #include <chrono>
</span><span class="cx"> #include <wtf/CurrentTime.h>
</span><ins>+#include <wtf/text/StringBuilder.h>
</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[] = {
+ { "LLINT", 0, "--enableConcurrentJIT=false --useLLInt=true --useJIT=false" },
+ { "Baseline", 0, "--enableConcurrentJIT=false --useLLInt=true --useJIT=true --useDFGJIT=false" },
+ { "DFG", 0, "--enableConcurrentJIT=false --useLLInt=true --useJIT=true --useDFGJIT=true --useFTLJIT=false" },
+ { "FTL", 200, "--enableConcurrentJIT=false --useLLInt=true --useJIT=true --useDFGJIT=true --useFTLJIT=true" },
+ };
+
+ 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("currentCPUTime");
- 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 = "var startTime = currentCPUTime(); while (true) { if (currentCPUTime() - startTime > .150) break; } ";
- JSStringRef script = JSStringCreateWithUTF8CString(loopForeverScript);
- exception = nullptr;
- shouldTerminateCallbackWasCalled = false;
- auto startTime = currentCPUTime();
- v = JSEvaluateScript(context, script, nullptr, nullptr, 1, &exception);
- auto endTime = currentCPUTime();
</del><ins>+ Options::setOptions(tierOptions.optionsStr);
</ins><span class="cx">
</span><del>- if (((endTime - startTime) < milliseconds(150)) && shouldTerminateCallbackWasCalled)
- printf("PASS: script timed out as expected.\n");
- else {
- if (!((endTime - startTime) < milliseconds(150)))
- printf("FAIL: script did not time out as expected.\n");
- if (!shouldTerminateCallbackWasCalled)
- printf("FAIL: script timeout callback was not called.\n");
- 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("currentCPUTime");
+ JSObjectRef currentCPUTimeFunction = JSObjectMakeFunctionWithCallback(context, currentCPUTimeStr, currentCPUTimeAsJSFunctionCallback);
+ JSObjectSetProperty(context, globalObject, currentCPUTimeStr, currentCPUTimeFunction, kJSPropertyAttributeNone, nullptr);
+ JSStringRelease(currentCPUTimeStr);
</ins><span class="cx">
</span><del>- if (!exception) {
- printf("FAIL: TerminatedExecutionException was not thrown.\n");
- 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("function foo() { var startTime = currentCPUTime(); while (true) { for (var i = 0; i < 1000; i++); if (currentCPUTime() - startTime > ");
+ scriptBuilder.appendNumber(timeAfterWatchdogShouldHaveFired / 1000.0);
+ scriptBuilder.append(") break; } } foo();");
+
+ JSStringRef script = JSStringCreateWithUTF8CString(scriptBuilder.toString().utf8().data());
+ exception = nullptr;
+ shouldTerminateCallbackWasCalled = false;
+ auto startTime = currentCPUTime();
+ scriptResult = JSEvaluateScript(context, script, nullptr, nullptr, 1, &exception);
+ auto endTime = currentCPUTime();
+
+ if (((endTime - startTime) < milliseconds(timeAfterWatchdogShouldHaveFired)) && shouldTerminateCallbackWasCalled)
+ printf("PASS: %s script timed out as expected.\n", tierOptions.tier);
+ else {
+ if ((endTime - startTime) >= milliseconds(timeAfterWatchdogShouldHaveFired))
+ printf("FAIL: %s script did not time out as expected.\n", tierOptions.tier);
+ if (!shouldTerminateCallbackWasCalled)
+ printf("FAIL: %s script timeout callback was not called.\n", tierOptions.tier);
+ failed = true;
+ }
+
+ if (!exception) {
+ printf("FAIL: %s TerminatedExecutionException was not thrown.\n", 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 = "var startTime = currentCPUTime(); try { while (true) { if (currentCPUTime() - startTime > .150) break; } } catch(e) { }";
- JSStringRef script = JSStringCreateWithUTF8CString(loopForeverScript);
- exception = nullptr;
- shouldTerminateCallbackWasCalled = false;
- auto startTime = currentCPUTime();
- v = JSEvaluateScript(context, script, nullptr, nullptr, 1, &exception);
- auto endTime = currentCPUTime();
-
- if (((endTime - startTime) >= milliseconds(150)) || !shouldTerminateCallbackWasCalled) {
- if (!((endTime - startTime) < milliseconds(150)))
- printf("FAIL: script did not time out as expected.\n");
- if (!shouldTerminateCallbackWasCalled)
- printf("FAIL: script timeout callback was not called.\n");
- 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("function foo() { var startTime = currentCPUTime(); try { while (true) { for (var i = 0; i < 1000; i++); if (currentCPUTime() - startTime > ");
+ scriptBuilder.appendNumber(timeAfterWatchdogShouldHaveFired / 1000.0);
+ scriptBuilder.append(") break; } } catch(e) { } } foo();");
+
+ JSStringRef script = JSStringCreateWithUTF8CString(scriptBuilder.toString().utf8().data());
+ exception = nullptr;
+ shouldTerminateCallbackWasCalled = false;
+
+ auto startTime = currentCPUTime();
+ scriptResult = JSEvaluateScript(context, script, nullptr, nullptr, 1, &exception);
+ auto endTime = currentCPUTime();
+
+ if (((endTime - startTime) >= milliseconds(timeAfterWatchdogShouldHaveFired)) || !shouldTerminateCallbackWasCalled) {
+ if (!((endTime - startTime) < milliseconds(timeAfterWatchdogShouldHaveFired)))
+ printf("FAIL: %s script did not time out as expected.\n", tierOptions.tier);
+ if (!shouldTerminateCallbackWasCalled)
+ printf("FAIL: %s script timeout callback was not called.\n", tierOptions.tier);
+ failed = true;
+ }
+
+ if (exception)
+ printf("PASS: %s TerminatedExecutionException was not catchable as expected.\n", tierOptions.tier);
+ else {
+ printf("FAIL: %s TerminatedExecutionException was caught.\n", tierOptions.tier);
+ failed = true;
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- if (exception)
- printf("PASS: TerminatedExecutionException was not catchable as expected.\n");
- else {
- printf("FAIL: TerminatedExecutionException was caught.\n");
- 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("function foo() { var startTime = currentCPUTime(); while (true) { for (var i = 0; i < 1000; i++); if (currentCPUTime() - startTime > ");
+ scriptBuilder.appendNumber(timeAfterWatchdogShouldHaveFired / 1000.0);
+ scriptBuilder.append(") break; } } foo();");
+
+ JSStringRef script = JSStringCreateWithUTF8CString(scriptBuilder.toString().utf8().data());
+ exception = nullptr;
+ shouldTerminateCallbackWasCalled = false;
+
+ auto startTime = currentCPUTime();
+ scriptResult = JSEvaluateScript(context, script, nullptr, nullptr, 1, &exception);
+ auto endTime = currentCPUTime();
+
+ if (((endTime - startTime) < milliseconds(timeAfterWatchdogShouldHaveFired)) && !shouldTerminateCallbackWasCalled)
+ printf("PASS: %s script timed out as expected when no callback is specified.\n", tierOptions.tier);
+ else {
+ if ((endTime - startTime) >= milliseconds(timeAfterWatchdogShouldHaveFired))
+ printf("FAIL: %s script did not time out as expected when no callback is specified.\n", tierOptions.tier);
+ else
+ printf("FAIL: %s script called stale callback function.\n", tierOptions.tier);
+ failed = true;
+ }
+
+ if (!exception) {
+ printf("FAIL: %s TerminatedExecutionException was not thrown.\n", tierOptions.tier);
+ failed = true;
+ }
</ins><span class="cx"> }
</span><del>- }
-
- /* Test script timeout with no callback: */
- JSContextGroupSetExecutionTimeLimit(contextGroup, .10f, 0, 0);
- {
- const char* loopForeverScript = "var startTime = currentCPUTime(); while (true) { if (currentCPUTime() - startTime > .150) break; } ";
- JSStringRef script = JSStringCreateWithUTF8CString(loopForeverScript);
- exception = nullptr;
- auto startTime = currentCPUTime();
- v = JSEvaluateScript(context, script, nullptr, nullptr, 1, &exception);
- auto endTime = currentCPUTime();
</del><span class="cx">
</span><del>- if (((endTime - startTime) < milliseconds(150)) && shouldTerminateCallbackWasCalled)
- printf("PASS: script timed out as expected when no callback is specified.\n");
- else {
- if (!((endTime - startTime) < milliseconds(150)))
- printf("FAIL: script did not time out as expected when no callback is specified.\n");
- 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("function foo() { var startTime = currentCPUTime(); while (true) { for (var i = 0; i < 1000; i++); if (currentCPUTime() - startTime > ");
+ scriptBuilder.appendNumber(timeAfterWatchdogShouldHaveFired / 1000.0);
+ scriptBuilder.append(") break; } } foo();");
+
+ JSStringRef script = JSStringCreateWithUTF8CString(scriptBuilder.toString().utf8().data());
+ exception = nullptr;
+ cancelTerminateCallbackWasCalled = false;
+
+ auto startTime = currentCPUTime();
+ scriptResult = JSEvaluateScript(context, script, nullptr, nullptr, 1, &exception);
+ auto endTime = currentCPUTime();
+
+ if (((endTime - startTime) >= milliseconds(timeAfterWatchdogShouldHaveFired)) && cancelTerminateCallbackWasCalled && !exception)
+ printf("PASS: %s script timeout was cancelled as expected.\n", tierOptions.tier);
+ else {
+ if (((endTime - startTime) < milliseconds(timeAfterWatchdogShouldHaveFired)) || exception)
+ printf("FAIL: %s script timeout was not cancelled.\n", tierOptions.tier);
+ if (!cancelTerminateCallbackWasCalled)
+ printf("FAIL: %s script timeout callback was not called.\n", tierOptions.tier);
+ failed = true;
+ }
+
+ if (exception) {
+ printf("FAIL: %s Unexpected TerminatedExecutionException thrown.\n", tierOptions.tier);
+ failed = true;
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- if (!exception) {
- printf("FAIL: TerminatedExecutionException was not thrown.\n");
- 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("function foo() { var startTime = currentCPUTime(); while (true) { for (var i = 0; i < 1000; i++); if (currentCPUTime() - startTime > ");
+ scriptBuilder.appendNumber(maxBusyLoopTime / 1000.0); // in seconds.
+ scriptBuilder.append(") break; } } foo();");
+
+ JSStringRef script = JSStringCreateWithUTF8CString(scriptBuilder.toString().utf8().data());
+ exception = nullptr;
+ extendTerminateCallbackCalled = 0;
+
+ auto startTime = currentCPUTime();
+ scriptResult = JSEvaluateScript(context, script, nullptr, nullptr, 1, &exception);
+ auto endTime = currentCPUTime();
+ auto deltaTime = endTime - startTime;
+
+ if ((deltaTime >= milliseconds(timeBeforeExtendedDeadline)) && (deltaTime < milliseconds(timeAfterExtendedDeadline)) && (extendTerminateCallbackCalled == 2) && exception)
+ printf("PASS: %s script timeout was extended as expected.\n", tierOptions.tier);
+ else {
+ if (deltaTime < milliseconds(timeBeforeExtendedDeadline))
+ printf("FAIL: %s script timeout was not extended as expected.\n", tierOptions.tier);
+ else if (deltaTime >= milliseconds(timeAfterExtendedDeadline))
+ printf("FAIL: %s script did not timeout.\n", tierOptions.tier);
+
+ if (extendTerminateCallbackCalled < 1)
+ printf("FAIL: %s script timeout callback was not called.\n", tierOptions.tier);
+ if (extendTerminateCallbackCalled < 2)
+ printf("FAIL: %s script timeout callback was not called after timeout extension.\n", tierOptions.tier);
+
+ if (!exception)
+ printf("FAIL: %s TerminatedExecutionException was not thrown during timeout extension test.\n", 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 = "var startTime = currentCPUTime(); while (true) { if (currentCPUTime() - startTime > .150) break; } ";
- JSStringRef script = JSStringCreateWithUTF8CString(loopForeverScript);
- exception = nullptr;
- auto startTime = currentCPUTime();
- v = JSEvaluateScript(context, script, nullptr, nullptr, 1, &exception);
- auto endTime = currentCPUTime();
-
- if (((endTime - startTime) >= milliseconds(150)) && cancelTerminateCallbackWasCalled && !exception)
- printf("PASS: script timeout was cancelled as expected.\n");
- else {
- if (((endTime - startTime) < milliseconds(150)) || exception)
- printf("FAIL: script timeout was not cancelled.\n");
- if (!cancelTerminateCallbackWasCalled)
- printf("FAIL: script timeout callback was not called.\n");
- failed = true;
- }
-
- if (exception) {
- printf("FAIL: Unexpected TerminatedExecutionException thrown.\n");
- failed = true;
- }
- }
-
- /* Test script timeout extension: */
- JSContextGroupSetExecutionTimeLimit(contextGroup, 0.100f, extendTerminateCallback, 0);
- {
- const char* loopForeverScript = "var startTime = currentCPUTime(); while (true) { if (currentCPUTime() - startTime > .500) break; } ";
- JSStringRef script = JSStringCreateWithUTF8CString(loopForeverScript);
- exception = nullptr;
- auto startTime = currentCPUTime();
- v = JSEvaluateScript(context, script, nullptr, nullptr, 1, &exception);
- auto endTime = currentCPUTime();
- auto deltaTime = endTime - startTime;
-
- if ((deltaTime >= milliseconds(300)) && (deltaTime < milliseconds(500)) && (extendTerminateCallbackCalled == 2) && exception)
- printf("PASS: script timeout was extended as expected.\n");
- else {
- if (deltaTime < milliseconds(200))
- printf("FAIL: script timeout was not extended as expected.\n");
- else if (deltaTime >= milliseconds(500))
- printf("FAIL: script did not timeout.\n");
-
- if (extendTerminateCallbackCalled < 1)
- printf("FAIL: script timeout callback was not called.\n");
- if (extendTerminateCallbackCalled < 2)
- printf("FAIL: script timeout callback was not called after timeout extension.\n");
-
- if (!exception)
- printf("FAIL: TerminatedExecutionException was not thrown during timeout extension test.\n");
-
- 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 <mark.lam@apple.com>
+
+ 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 <mark.lam@apple.com>
+
+ 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 <mark.lam@apple.com>
+
+ 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 <akling@apple.com>
</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, "All JSC runtime options:", stderr);
</del><ins>+ JSC::Options::dumpAllOptions(stderr, JSC::Options::DumpLevel::Verbose, "All JSC runtime options:");
</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 <wtf/PageBlock.h>
</span><span class="cx"> #include <wtf/StdLibExtras.h>
</span><span class="cx"> #include <wtf/StringExtras.h>
</span><ins>+#include <wtf/text/StringBuilder.h>
</ins><span class="cx">
</span><span class="cx"> #if OS(DARWIN) && ENABLE(PARALLEL_GC)
</span><span class="cx"> #include <sys/sysctl.h>
</span><span class="lines">@@ -84,6 +85,8 @@
</span><span class="cx">
</span><span class="cx"> static bool parse(const char* string, const char*& 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 = "<null>";
+
</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 [!]<low>[:<high>]
</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 > 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() >= Options::thresholdForOptimizeSoon());
</span><span class="cx"> ASSERT(Options::thresholdForOptimizeAfterWarmUp() >= 0);
</span><span class="cx">
</span><del>- if (Options::showOptions()) {
- DumpLevel level = static_cast<DumpLevel>(Options::showOptions());
- if (level > 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 = "Overridden JSC options:";
- break;
- case DumpLevel::All:
- title = "All JSC options:";
- break;
- case DumpLevel::Verbose:
- title = "All JSC options with descriptions:";
- break;
- }
- dumpAllOptions(level, title);
</del><ins>+void Options::dumpOptionsIfNeeded()
+{
+ if (Options::showOptions()) {
+ DumpLevel level = static_cast<DumpLevel>(Options::showOptions());
+ if (level > DumpLevel::Verbose)
+ level = DumpLevel::Verbose;
+
+ const char* title = nullptr;
+ switch (level) {
+ case DumpLevel::None:
+ break;
+ case DumpLevel::Overridden:
+ title = "Overridden JSC options:";
+ break;
+ case DumpLevel::All:
+ title = "All JSC options:";
+ break;
+ case DumpLevel::Verbose:
+ title = "All JSC options with descriptions:";
+ break;
+ }
+
+ StringBuilder builder;
+ dumpAllOptions(builder, level, title, nullptr, " ", "\n", ShowDefaults);
+ dataLog(builder.toString());
+ }
+}
+
+bool Options::setOptions(const char* optionsStr)
+{
+ Vector<char*> options;
+
+ size_t length = strlen(optionsStr);
+ char* optionsStrCopy = WTF::fastStrDup(optionsStr);
+ char* end = optionsStrCopy + length;
+ char* p = optionsStrCopy;
+
+ while (p < end) {
+ char* optionStart = p;
+ p = strstr(p, "=");
+ if (!p) {
+ dataLogF("'=' not found in option string: %p\n", 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 < end) && (*p == '"')) {
+ p = strstr(p + 1, "\"");
+ if (!p) {
+ dataLogF("Missing trailing '\"' in option string: %p\n", 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, " ");
+ if (!p)
+ p = end; // No more " " 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 == '"') && ((valueEnd - valueBegin) >= minStringLength) && (valueEnd[-1] == '"'));
+ memmove(valueBegin, valueBegin + 1, valueEnd - valueBegin - minStringLength);
+ valueEnd[-minStringLength] = '\0';
+ }
+
+ // Strip leading -- if present.
+ if ((p - optionStart > 2) && optionStart[0] == '-' && optionStart[1] == '-')
+ optionStart += 2;
+
+ *p++ = '\0';
+ options.append(optionStart);
+ }
+
+ bool success = true;
+ for (auto& option : options) {
+ bool optionSuccess = setOption(option);
+ if (!optionSuccess) {
+ dataLogF("Failed to set option : %s\n", 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 "<optionName>=<value>"
</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& 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, "%s\n", title);
- for (int id = 0; id < numberOfOptions; id++)
- dumpOption(level, static_cast<OptionID>(id), stream, " ", "\n");
</del><ins>+ if (title) {
+ builder.append(title);
+ builder.append('\n');
+ }
+
+ for (int id = 0; id < numberOfOptions; id++) {
+ if (separator && id)
+ builder.append(separator);
+ dumpOption(builder, level, static_cast<OptionID>(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& builder)
</ins><span class="cx"> {
</span><ins>+ dumpAllOptions(builder, DumpLevel::All, nullptr, " ", nullptr, nullptr, DontShowDefaults);
+}
+
+void Options::dumpAllOptions(FILE* stream, DumpLevel level, const char* title)
+{
+ StringBuilder builder;
+ dumpAllOptions(builder, level, title, nullptr, " ", "\n", ShowDefaults);
+ fprintf(stream, "%s", builder.toString().ascii().data());
+}
+
+void Options::dumpOption(StringBuilder& builder, DumpLevel level, OptionID id,
+ const char* header, const char* footer, ShowDefaultsOption showDefaultsOption)
+{
</ins><span class="cx"> if (id >= 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 && !wasOverridden)
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- fprintf(stream, "%s%s: ", 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, " (default: ");
- option.defaultOption().dump(stream);
- fprintf(stream, ")");
</del><ins>+ if (wasOverridden && (showDefaultsOption == ShowDefaults)) {
+ builder.append(" (default: ");
+ option.defaultOption().dump(builder);
+ builder.append(")");
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- if (needsDescription)
- fprintf(stream, " ... %s", option.description());
</del><ins>+ if (needsDescription) {
+ builder.append(" ... ");
+ builder.append(option.description());
+ }
</ins><span class="cx">
</span><del>- fprintf(stream, "%s", 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& builder) const
</ins><span class="cx"> {
</span><span class="cx"> switch (type()) {
</span><span class="cx"> case Options::Type::boolType:
</span><del>- fprintf(stream, "%s", m_entry.boolVal ? "true" : "false");
</del><ins>+ builder.append(m_entry.boolVal ? "true" : "false");
</ins><span class="cx"> break;
</span><span class="cx"> case Options::Type::unsignedType:
</span><del>- fprintf(stream, "%u", 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, "%lf", 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, "%d", 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, "%s", 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 = "";
</span><del>- fprintf(stream, "%s", option);
</del><ins>+ builder.append('"');
+ builder.append(option);
+ builder.append('"');
</ins><span class="cx"> break;
</span><span class="cx"> }
</span><span class="cx"> case Options::Type::gcLogLevelType: {
</span><del>- fprintf(stream, "%s", 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 <wtf/PrintStream.h>
</span><span class="cx"> #include <wtf/StdLibExtras.h>
</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 > InitError) ? m_rangeString : "<null>"; }
</del><ins>+ const char* rangeString() const { return (m_state > InitError) ? m_rangeString : s_nullRangeStr; }
</ins><span class="cx">
</span><span class="cx"> void dump(PrintStream& 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 "--<optionName>=<value>"
+ // and are separated by a space. The leading "--" 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 "<optionName>=<value>"
</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 = "", const char* footer = "");
</del><ins>+
+ JS_EXPORT_PRIVATE static void dumpAllOptions(FILE*, DumpLevel, const char* title = nullptr);
+ JS_EXPORT_PRIVATE static void dumpAllOptionsInALine(StringBuilder&);
+
</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&, DumpLevel, const char* title,
+ const char* separator, const char* optionHeader, const char* optionFooter, ShowDefaultsOption);
+ static void dumpOption(StringBuilder&, 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&) const;
+
</ins><span class="cx"> bool operator==(const Option& other) const;
</span><span class="cx"> bool operator!=(const Option& other) const { return !(*this == other); }
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>