<!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>[163418] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/163418">163418</a></dd>
<dt>Author</dt> <dd>fpizlo@apple.com</dd>
<dt>Date</dt> <dd>2014-02-04 17:03:21 -0800 (Tue, 04 Feb 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>DFG PutByVal on typed arrays should detect OutOfBounds sooner
https://bugs.webkit.org/show_bug.cgi?id=128162
Source/JavaScriptCore:
Reviewed by Mark Hahnenberg.
Just wire the m_outOfBounds flag in ArrayProfile into the OutOfBounds speculation in
DFG::ArrayMode for typed arrays.
Also make it possible to have tests for convergence.
Also turn one of the LayoutTests/js/dfg- tests into a stress test because it
was relying on a specific number of recompiles. Stress tests instead take
the approach of just running for a while. That's more robust.
* bytecode/CodeBlock.h:
* dfg/DFGArrayMode.cpp:
(JSC::DFG::ArrayMode::fromObserved):
(JSC::DFG::ArrayMode::refine):
* dfg/DFGArrayMode.h:
(JSC::DFG::ArrayMode::withSpeculationFromProfile):
(JSC::DFG::ArrayMode::withProfile):
* ftl/FTLLowerDFGToLLVM.cpp:
(JSC::FTL::LowerDFGToLLVM::compilePutByVal):
* jit/JITPropertyAccess.cpp:
(JSC::JIT::emitIntTypedArrayPutByVal):
(JSC::JIT::emitFloatTypedArrayPutByVal):
* jsc.cpp:
(GlobalObject::finishCreation):
(functionReoptimizationRetryCount):
* runtime/TestRunnerUtils.cpp:
(JSC::getExecutableForFunction):
(JSC::getSomeBaselineCodeBlockForFunction):
(JSC::numberOfDFGCompiles):
(JSC::setNeverInline):
* runtime/TestRunnerUtils.h:
* tests/stress/float32-repeat-out-of-bounds.js: Added.
(foo):
* tests/stress/int8-repeat-out-of-bounds.js: Added.
(foo):
* tests/stress/string-out-of-bounds-negative-proto-value.js: Added.
(foo):
Tools:
Reviewed by Mark Hahnenberg.
Add a defautNoEagerRun, which is intended to be used for convergence tests.
* Scripts/run-jsc-stress-tests:
LayoutTests:
Reviewed by Mark Hahnenberg.
dfg-string-out-of-blahblah was moved to JSC/tests/stress.
dfg-convert-this-dom-window was using dfgShouldBe() incorrectly and this got revealed
by my TestRunnerUtils refactoring.
* js/dfg-string-out-of-bounds-negative-proto-value-expected.txt: Removed.
* js/dfg-string-out-of-bounds-negative-proto-value.html: Removed.
* js/script-tests/dfg-convert-this-dom-window.js:
* js/script-tests/dfg-string-out-of-bounds-negative-proto-value.js: Removed.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsjsscripttestsdfgconvertthisdomwindowjs">trunk/LayoutTests/js/script-tests/dfg-convert-this-dom-window.js</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodeCodeBlockh">trunk/Source/JavaScriptCore/bytecode/CodeBlock.h</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGArrayModecpp">trunk/Source/JavaScriptCore/dfg/DFGArrayMode.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGArrayModeh">trunk/Source/JavaScriptCore/dfg/DFGArrayMode.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreftlFTLLowerDFGToLLVMcpp">trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorejitJITPropertyAccesscpp">trunk/Source/JavaScriptCore/jit/JITPropertyAccess.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorejsccpp">trunk/Source/JavaScriptCore/jsc.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeTestRunnerUtilscpp">trunk/Source/JavaScriptCore/runtime/TestRunnerUtils.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeTestRunnerUtilsh">trunk/Source/JavaScriptCore/runtime/TestRunnerUtils.h</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsScriptsrunjscstresstests">trunk/Tools/Scripts/run-jsc-stress-tests</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoretestsstressfloat32repeatoutofboundsjs">trunk/Source/JavaScriptCore/tests/stress/float32-repeat-out-of-bounds.js</a></li>
<li><a href="#trunkSourceJavaScriptCoretestsstressint8repeatoutofboundsjs">trunk/Source/JavaScriptCore/tests/stress/int8-repeat-out-of-bounds.js</a></li>
<li><a href="#trunkSourceJavaScriptCoretestsstressstringoutofboundsnegativeprotovaluejs">trunk/Source/JavaScriptCore/tests/stress/string-out-of-bounds-negative-proto-value.js</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsjsdfgstringoutofboundsnegativeprotovalueexpectedtxt">trunk/LayoutTests/js/dfg-string-out-of-bounds-negative-proto-value-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsdfgstringoutofboundsnegativeprotovaluehtml">trunk/LayoutTests/js/dfg-string-out-of-bounds-negative-proto-value.html</a></li>
<li><a href="#trunkLayoutTestsjsscripttestsdfgstringoutofboundsnegativeprotovaluejs">trunk/LayoutTests/js/script-tests/dfg-string-out-of-bounds-negative-proto-value.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (163417 => 163418)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-02-05 00:26:59 UTC (rev 163417)
+++ trunk/LayoutTests/ChangeLog        2014-02-05 01:03:21 UTC (rev 163418)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2014-02-04 Filip Pizlo <fpizlo@apple.com>
+
+ DFG PutByVal on typed arrays should detect OutOfBounds sooner
+ https://bugs.webkit.org/show_bug.cgi?id=128162
+
+ Reviewed by Mark Hahnenberg.
+
+ dfg-string-out-of-blahblah was moved to JSC/tests/stress.
+
+ dfg-convert-this-dom-window was using dfgShouldBe() incorrectly and this got revealed
+ by my TestRunnerUtils refactoring.
+
+ * js/dfg-string-out-of-bounds-negative-proto-value-expected.txt: Removed.
+ * js/dfg-string-out-of-bounds-negative-proto-value.html: Removed.
+ * js/script-tests/dfg-convert-this-dom-window.js:
+ * js/script-tests/dfg-string-out-of-bounds-negative-proto-value.js: Removed.
+
</ins><span class="cx"> 2014-02-04 Brady Eidson <beidson@apple.com>
</span><span class="cx">
</span><span class="cx"> IDB: indexeddb/mozilla/add-twice-failure.html fails
</span></span></pre></div>
<a id="trunkLayoutTestsjsdfgstringoutofboundsnegativeprotovalueexpectedtxt"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/js/dfg-string-out-of-bounds-negative-proto-value-expected.txt (163417 => 163418)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dfg-string-out-of-bounds-negative-proto-value-expected.txt        2014-02-05 00:26:59 UTC (rev 163417)
+++ trunk/LayoutTests/js/dfg-string-out-of-bounds-negative-proto-value-expected.txt        2014-02-05 01:03:21 UTC (rev 163418)
</span><span class="lines">@@ -1,9 +0,0 @@
</span><del>-Tests what happens when you do a negative out-of-bounds access on a string while the prototype has a negative indexed property.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-Passed some tests silently.
-
-TEST COMPLETE
-
</del></span></pre></div>
<a id="trunkLayoutTestsjsdfgstringoutofboundsnegativeprotovaluehtml"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/js/dfg-string-out-of-bounds-negative-proto-value.html (163417 => 163418)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dfg-string-out-of-bounds-negative-proto-value.html        2014-02-05 00:26:59 UTC (rev 163417)
+++ trunk/LayoutTests/js/dfg-string-out-of-bounds-negative-proto-value.html        2014-02-05 01:03:21 UTC (rev 163418)
</span><span class="lines">@@ -1,10 +0,0 @@
</span><del>-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
-<html>
-<head>
-<script src="../resources/js-test-pre.js"></script>
-</head>
-<body>
-<script src="script-tests/dfg-string-out-of-bounds-negative-proto-value.js"></script>
-<script src="../resources/js-test-post.js"></script>
-</body>
-</html>
</del></span></pre></div>
<a id="trunkLayoutTestsjsscripttestsdfgconvertthisdomwindowjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/js/script-tests/dfg-convert-this-dom-window.js (163417 => 163418)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/script-tests/dfg-convert-this-dom-window.js        2014-02-05 00:26:59 UTC (rev 163417)
+++ trunk/LayoutTests/js/script-tests/dfg-convert-this-dom-window.js        2014-02-05 01:03:21 UTC (rev 163418)
</span><span class="lines">@@ -19,5 +19,5 @@
</span><span class="cx"> dfgShouldBe(myFunction, "myFunction.aliasedCall(null)", '[this, "myFunction", undefined]');
</span><span class="cx"> dfgShouldBe(myFunction, "myFunction.aliasedCall(undefined)", '[this, "myFunction", undefined]');
</span><span class="cx"> dfgShouldBe(myFunctionWithCall.call, "myFunctionWithCall.call(myObject, 'arg1')", '[myFunctionWithCall, "myFunctionWithCall.call", myObject]');
</span><del>-dfgShouldBe(myFunctionWithCall.aliasedCall, "myFunctionWithCall.aliasedCall(myObject, 'arg1')", '[myObject, "myFunctionWithCall", "arg1"]');
</del><ins>+dfgShouldBe(myFunctionWithCall, "myFunctionWithCall.aliasedCall(myObject, 'arg1')", '[myObject, "myFunctionWithCall", "arg1"]');
</ins><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestsjsscripttestsdfgstringoutofboundsnegativeprotovaluejs"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/js/script-tests/dfg-string-out-of-bounds-negative-proto-value.js (163417 => 163418)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/script-tests/dfg-string-out-of-bounds-negative-proto-value.js        2014-02-05 00:26:59 UTC (rev 163417)
+++ trunk/LayoutTests/js/script-tests/dfg-string-out-of-bounds-negative-proto-value.js        2014-02-05 01:03:21 UTC (rev 163418)
</span><span class="lines">@@ -1,16 +0,0 @@
</span><del>-description(
-"Tests what happens when you do a negative out-of-bounds access on a string while the prototype has a negative indexed property."
-);
-
-function foo(s) {
- return s[-1];
-}
-
-noInline(foo);
-silentTestPass = true;
-
-String.prototype[-1] = "hello";
-
-for (var i = 0; i < 2; i = dfgIncrement({f:foo, i:i + 1, n:1, compiles:2}))
- shouldBe("foo(\"hello\")", "\"hello\"");
-
</del></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (163417 => 163418)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2014-02-05 00:26:59 UTC (rev 163417)
+++ trunk/Source/JavaScriptCore/ChangeLog        2014-02-05 01:03:21 UTC (rev 163418)
</span><span class="lines">@@ -1,3 +1,47 @@
</span><ins>+2014-02-04 Filip Pizlo <fpizlo@apple.com>
+
+ DFG PutByVal on typed arrays should detect OutOfBounds sooner
+ https://bugs.webkit.org/show_bug.cgi?id=128162
+
+ Reviewed by Mark Hahnenberg.
+
+ Just wire the m_outOfBounds flag in ArrayProfile into the OutOfBounds speculation in
+ DFG::ArrayMode for typed arrays.
+
+ Also make it possible to have tests for convergence.
+
+ Also turn one of the LayoutTests/js/dfg- tests into a stress test because it
+ was relying on a specific number of recompiles. Stress tests instead take
+ the approach of just running for a while. That's more robust.
+
+ * bytecode/CodeBlock.h:
+ * dfg/DFGArrayMode.cpp:
+ (JSC::DFG::ArrayMode::fromObserved):
+ (JSC::DFG::ArrayMode::refine):
+ * dfg/DFGArrayMode.h:
+ (JSC::DFG::ArrayMode::withSpeculationFromProfile):
+ (JSC::DFG::ArrayMode::withProfile):
+ * ftl/FTLLowerDFGToLLVM.cpp:
+ (JSC::FTL::LowerDFGToLLVM::compilePutByVal):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::emitIntTypedArrayPutByVal):
+ (JSC::JIT::emitFloatTypedArrayPutByVal):
+ * jsc.cpp:
+ (GlobalObject::finishCreation):
+ (functionReoptimizationRetryCount):
+ * runtime/TestRunnerUtils.cpp:
+ (JSC::getExecutableForFunction):
+ (JSC::getSomeBaselineCodeBlockForFunction):
+ (JSC::numberOfDFGCompiles):
+ (JSC::setNeverInline):
+ * runtime/TestRunnerUtils.h:
+ * tests/stress/float32-repeat-out-of-bounds.js: Added.
+ (foo):
+ * tests/stress/int8-repeat-out-of-bounds.js: Added.
+ (foo):
+ * tests/stress/string-out-of-bounds-negative-proto-value.js: Added.
+ (foo):
+
</ins><span class="cx"> 2014-02-04 Mark Hahnenberg <mhahnenberg@apple.com>
</span><span class="cx">
</span><span class="cx"> Refactor MarkStackArray to allow more than JSCells to be stored
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeCodeBlockh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/CodeBlock.h (163417 => 163418)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/CodeBlock.h        2014-02-05 00:26:59 UTC (rev 163417)
+++ trunk/Source/JavaScriptCore/bytecode/CodeBlock.h        2014-02-05 01:03:21 UTC (rev 163418)
</span><span class="lines">@@ -774,7 +774,7 @@
</span><span class="cx"> // When we observe a lot of speculation failures, we trigger a
</span><span class="cx"> // reoptimization. But each time, we increase the optimization trigger
</span><span class="cx"> // to avoid thrashing.
</span><del>- unsigned reoptimizationRetryCounter() const;
</del><ins>+ JS_EXPORT_PRIVATE unsigned reoptimizationRetryCounter() const;
</ins><span class="cx"> void countReoptimization();
</span><span class="cx"> #if ENABLE(JIT)
</span><span class="cx"> unsigned numberOfDFGCompiles();
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGArrayModecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGArrayMode.cpp (163417 => 163418)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGArrayMode.cpp        2014-02-05 00:26:59 UTC (rev 163417)
+++ trunk/Source/JavaScriptCore/dfg/DFGArrayMode.cpp        2014-02-05 01:03:21 UTC (rev 163418)
</span><span class="lines">@@ -49,7 +49,7 @@
</span><span class="cx"> case asArrayModes(NonArray):
</span><span class="cx"> if (action == Array::Write && !profile->mayInterceptIndexedAccesses(locker))
</span><span class="cx"> return ArrayMode(Array::Undecided, nonArray, Array::OutOfBounds, Array::Convert);
</span><del>- return ArrayMode(Array::SelectUsingPredictions, nonArray);
</del><ins>+ return ArrayMode(Array::SelectUsingPredictions, nonArray).withSpeculationFromProfile(locker, profile, makeSafe);
</ins><span class="cx">
</span><span class="cx"> case asArrayModes(ArrayWithUndecided):
</span><span class="cx"> if (action == Array::Write)
</span><span class="lines">@@ -59,7 +59,7 @@
</span><span class="cx"> case asArrayModes(NonArray) | asArrayModes(ArrayWithUndecided):
</span><span class="cx"> if (action == Array::Write && !profile->mayInterceptIndexedAccesses(locker))
</span><span class="cx"> return ArrayMode(Array::Undecided, Array::PossiblyArray, Array::OutOfBounds, Array::Convert);
</span><del>- return ArrayMode(Array::SelectUsingPredictions);
</del><ins>+ return ArrayMode(Array::SelectUsingPredictions).withSpeculationFromProfile(locker, profile, makeSafe);
</ins><span class="cx">
</span><span class="cx"> case asArrayModes(NonArrayWithInt32):
</span><span class="cx"> return ArrayMode(Array::Int32, nonArray, Array::AsIs).withProfile(locker, profile, makeSafe);
</span><span class="lines">@@ -100,7 +100,7 @@
</span><span class="cx">
</span><span class="cx"> default:
</span><span class="cx"> if ((observed & asArrayModes(NonArray)) && profile->mayInterceptIndexedAccesses(locker))
</span><del>- return ArrayMode(Array::SelectUsingPredictions);
</del><ins>+ return ArrayMode(Array::SelectUsingPredictions).withSpeculationFromProfile(locker, profile, makeSafe);
</ins><span class="cx">
</span><span class="cx"> Array::Type type;
</span><span class="cx"> Array::Class arrayClass;
</span><span class="lines">@@ -199,10 +199,10 @@
</span><span class="cx"> return withType(Array::Arguments);
</span><span class="cx">
</span><span class="cx"> ArrayMode result;
</span><del>- if (graph.hasExitSite(codeOrigin, OutOfBounds))
</del><ins>+ if (graph.hasExitSite(codeOrigin, OutOfBounds) || !isInBounds())
</ins><span class="cx"> result = withSpeculation(Array::OutOfBounds);
</span><span class="cx"> else
</span><del>- result = *this;
</del><ins>+ result = withSpeculation(Array::InBounds);
</ins><span class="cx">
</span><span class="cx"> if (isInt8ArraySpeculation(base))
</span><span class="cx"> return result.withType(Array::Int8Array);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGArrayModeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGArrayMode.h (163417 => 163418)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGArrayMode.h        2014-02-05 00:26:59 UTC (rev 163417)
+++ trunk/Source/JavaScriptCore/dfg/DFGArrayMode.h        2014-02-05 01:03:21 UTC (rev 163418)
</span><span class="lines">@@ -173,11 +173,15 @@
</span><span class="cx"> return ArrayMode(type(), arrayClass(), speculation, conversion());
</span><span class="cx"> }
</span><span class="cx">
</span><del>- ArrayMode withProfile(const ConcurrentJITLocker& locker, ArrayProfile* profile, bool makeSafe) const
</del><ins>+ ArrayMode withArrayClass(Array::Class arrayClass) const
</ins><span class="cx"> {
</span><ins>+ return ArrayMode(type(), arrayClass, speculation(), conversion());
+ }
+
+ ArrayMode withSpeculationFromProfile(const ConcurrentJITLocker& locker, ArrayProfile* profile, bool makeSafe) const
+ {
</ins><span class="cx"> Array::Speculation mySpeculation;
</span><del>- Array::Class myArrayClass;
-
</del><ins>+
</ins><span class="cx"> if (makeSafe)
</span><span class="cx"> mySpeculation = Array::OutOfBounds;
</span><span class="cx"> else if (profile->mayStoreToHole(locker))
</span><span class="lines">@@ -185,6 +189,13 @@
</span><span class="cx"> else
</span><span class="cx"> mySpeculation = Array::InBounds;
</span><span class="cx">
</span><ins>+ return withSpeculation(mySpeculation);
+ }
+
+ ArrayMode withProfile(const ConcurrentJITLocker& locker, ArrayProfile* profile, bool makeSafe) const
+ {
+ Array::Class myArrayClass;
+
</ins><span class="cx"> if (isJSArray()) {
</span><span class="cx"> if (profile->usesOriginalArrayStructures(locker) && benefitsFromOriginalArray())
</span><span class="cx"> myArrayClass = Array::OriginalArray;
</span><span class="lines">@@ -193,7 +204,7 @@
</span><span class="cx"> } else
</span><span class="cx"> myArrayClass = arrayClass();
</span><span class="cx">
</span><del>- return ArrayMode(type(), myArrayClass, mySpeculation, conversion());
</del><ins>+ return withArrayClass(myArrayClass).withSpeculationFromProfile(locker, profile, makeSafe);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> ArrayMode withType(Array::Type type) const
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreftlFTLLowerDFGToLLVMcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp (163417 => 163418)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp        2014-02-05 00:26:59 UTC (rev 163417)
+++ trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp        2014-02-05 01:03:21 UTC (rev 163418)
</span><span class="lines">@@ -2217,7 +2217,7 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (m_node->arrayMode().isInBounds())
</del><ins>+ if (m_node->arrayMode().isInBounds() || m_node->op() == PutByValAlias)
</ins><span class="cx"> m_out.store(valueToStore, pointer, refType);
</span><span class="cx"> else {
</span><span class="cx"> LBasicBlock isInBounds = FTL_NEW_BLOCK(m_out, ("PutByVal typed array in bounds case"));
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitJITPropertyAccesscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/JITPropertyAccess.cpp (163417 => 163418)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/JITPropertyAccess.cpp        2014-02-05 00:26:59 UTC (rev 163417)
+++ trunk/Source/JavaScriptCore/jit/JITPropertyAccess.cpp        2014-02-05 01:03:21 UTC (rev 163418)
</span><span class="lines">@@ -1281,6 +1281,7 @@
</span><span class="cx">
</span><span class="cx"> JIT::JumpList JIT::emitIntTypedArrayPutByVal(Instruction* currentInstruction, PatchableJump& badType, TypedArrayType type)
</span><span class="cx"> {
</span><ins>+ ArrayProfile* profile = currentInstruction[4].u.arrayProfile;
</ins><span class="cx"> ASSERT(isInt(type));
</span><span class="cx">
</span><span class="cx"> int value = currentInstruction[3].u.operand;
</span><span class="lines">@@ -1301,7 +1302,10 @@
</span><span class="cx">
</span><span class="cx"> loadPtr(Address(base, JSCell::structureOffset()), earlyScratch);
</span><span class="cx"> badType = patchableBranchPtr(NotEqual, Address(earlyScratch, Structure::classInfoOffset()), TrustedImmPtr(classInfoForType(type)));
</span><del>- slowCases.append(branch32(AboveOrEqual, property, Address(base, JSArrayBufferView::offsetOfLength())));
</del><ins>+ Jump inBounds = branch32(Below, property, Address(base, JSArrayBufferView::offsetOfLength()));
+ emitArrayProfileOutOfBoundsSpecialCase(profile);
+ Jump done = jump();
+ inBounds.link(this);
</ins><span class="cx">
</span><span class="cx"> #if USE(JSVALUE64)
</span><span class="cx"> emitGetVirtualRegister(value, earlyScratch);
</span><span class="lines">@@ -1342,11 +1346,14 @@
</span><span class="cx"> CRASH();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ done.link(this);
+
</ins><span class="cx"> return slowCases;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> JIT::JumpList JIT::emitFloatTypedArrayPutByVal(Instruction* currentInstruction, PatchableJump& badType, TypedArrayType type)
</span><span class="cx"> {
</span><ins>+ ArrayProfile* profile = currentInstruction[4].u.arrayProfile;
</ins><span class="cx"> ASSERT(isFloat(type));
</span><span class="cx">
</span><span class="cx"> int value = currentInstruction[3].u.operand;
</span><span class="lines">@@ -1367,7 +1374,10 @@
</span><span class="cx">
</span><span class="cx"> loadPtr(Address(base, JSCell::structureOffset()), earlyScratch);
</span><span class="cx"> badType = patchableBranchPtr(NotEqual, Address(earlyScratch, Structure::classInfoOffset()), TrustedImmPtr(classInfoForType(type)));
</span><del>- slowCases.append(branch32(AboveOrEqual, property, Address(base, JSArrayBufferView::offsetOfLength())));
</del><ins>+ Jump inBounds = branch32(Below, property, Address(base, JSArrayBufferView::offsetOfLength()));
+ emitArrayProfileOutOfBoundsSpecialCase(profile);
+ Jump done = jump();
+ inBounds.link(this);
</ins><span class="cx">
</span><span class="cx"> #if USE(JSVALUE64)
</span><span class="cx"> emitGetVirtualRegister(value, earlyScratch);
</span><span class="lines">@@ -1406,6 +1416,8 @@
</span><span class="cx"> CRASH();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ done.link(this);
+
</ins><span class="cx"> return slowCases;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejsccpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jsc.cpp (163417 => 163418)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jsc.cpp        2014-02-05 00:26:59 UTC (rev 163417)
+++ trunk/Source/JavaScriptCore/jsc.cpp        2014-02-05 01:03:21 UTC (rev 163418)
</span><span class="lines">@@ -112,6 +112,7 @@
</span><span class="cx"> static EncodedJSValue JSC_HOST_CALL functionPreciseTime(ExecState*);
</span><span class="cx"> static EncodedJSValue JSC_HOST_CALL functionNeverInlineFunction(ExecState*);
</span><span class="cx"> static EncodedJSValue JSC_HOST_CALL functionNumberOfDFGCompiles(ExecState*);
</span><ins>+static EncodedJSValue JSC_HOST_CALL functionReoptimizationRetryCount(ExecState*);
</ins><span class="cx"> static EncodedJSValue JSC_HOST_CALL functionTransferArrayBuffer(ExecState*);
</span><span class="cx"> static NO_RETURN_WITH_VALUE EncodedJSValue JSC_HOST_CALL functionQuit(ExecState*);
</span><span class="cx">
</span><span class="lines">@@ -234,6 +235,7 @@
</span><span class="cx"> addFunction(vm, "neverInlineFunction", functionNeverInlineFunction, 1);
</span><span class="cx"> addFunction(vm, "noInline", functionNeverInlineFunction, 1);
</span><span class="cx"> addFunction(vm, "numberOfDFGCompiles", functionNumberOfDFGCompiles, 1);
</span><ins>+ addFunction(vm, "reoptimizationRetryCount", functionReoptimizationRetryCount, 1);
</ins><span class="cx"> addFunction(vm, "transferArrayBuffer", functionTransferArrayBuffer, 1);
</span><span class="cx"> #if ENABLE(SAMPLING_FLAGS)
</span><span class="cx"> addFunction(vm, "setSamplingFlags", functionSetSamplingFlags, 1);
</span><span class="lines">@@ -505,6 +507,18 @@
</span><span class="cx"> return JSValue::encode(numberOfDFGCompiles(exec));
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+EncodedJSValue JSC_HOST_CALL functionReoptimizationRetryCount(ExecState* exec)
+{
+ if (exec->argumentCount() < 1)
+ return JSValue::encode(jsUndefined());
+
+ CodeBlock* block = getSomeBaselineCodeBlockForFunction(exec->argument(0));
+ if (!block)
+ return JSValue::encode(jsNumber(0));
+
+ return JSValue::encode(jsNumber(block->reoptimizationRetryCounter()));
+}
+
</ins><span class="cx"> EncodedJSValue JSC_HOST_CALL functionTransferArrayBuffer(ExecState* exec)
</span><span class="cx"> {
</span><span class="cx"> if (exec->argumentCount() < 1)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeTestRunnerUtilscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/TestRunnerUtils.cpp (163417 => 163418)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/TestRunnerUtils.cpp        2014-02-05 00:26:59 UTC (rev 163417)
+++ trunk/Source/JavaScriptCore/runtime/TestRunnerUtils.cpp        2014-02-05 01:03:21 UTC (rev 163418)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2013 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
</ins><span class="cx"> *
</span><span class="cx"> * Redistribution and use in source and binary forms, with or without
</span><span class="cx"> * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -31,7 +31,7 @@
</span><span class="cx">
</span><span class="cx"> namespace JSC {
</span><span class="cx">
</span><del>-static FunctionExecutable* getExecutable(JSValue theFunctionValue)
</del><ins>+FunctionExecutable* getExecutableForFunction(JSValue theFunctionValue)
</ins><span class="cx"> {
</span><span class="cx"> JSFunction* theFunction = jsDynamicCast<JSFunction*>(theFunctionValue);
</span><span class="cx"> if (!theFunction)
</span><span class="lines">@@ -42,6 +42,20 @@
</span><span class="cx"> return executable;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+CodeBlock* getSomeBaselineCodeBlockForFunction(JSValue theFunctionValue)
+{
+ FunctionExecutable* executable = getExecutableForFunction(theFunctionValue);
+ if (!executable)
+ return 0;
+
+ CodeBlock* baselineCodeBlock = executable->baselineCodeBlockFor(CodeForCall);
+
+ if (!baselineCodeBlock)
+ baselineCodeBlock = executable->baselineCodeBlockFor(CodeForConstruct);
+
+ return baselineCodeBlock;
+}
+
</ins><span class="cx"> JSValue numberOfDFGCompiles(JSValue theFunctionValue)
</span><span class="cx"> {
</span><span class="cx"> bool pretendToHaveManyCompiles = false;
</span><span class="lines">@@ -51,27 +65,19 @@
</span><span class="cx"> #else
</span><span class="cx"> pretendToHaveManyCompiles = true;
</span><span class="cx"> #endif
</span><del>-
- if (FunctionExecutable* executable = getExecutable(theFunctionValue)) {
- CodeBlock* baselineCodeBlock = executable->baselineCodeBlockFor(CodeForCall);
-
- if (!baselineCodeBlock)
- baselineCodeBlock = executable->baselineCodeBlockFor(CodeForConstruct);
-
- if (!baselineCodeBlock)
- return jsNumber(0);
</del><span class="cx">
</span><ins>+ if (CodeBlock* baselineCodeBlock = getSomeBaselineCodeBlockForFunction(theFunctionValue)) {
</ins><span class="cx"> if (pretendToHaveManyCompiles)
</span><span class="cx"> return jsNumber(1000000.0);
</span><span class="cx"> return jsNumber(baselineCodeBlock->numberOfDFGCompiles());
</span><span class="cx"> }
</span><span class="cx">
</span><del>- return jsUndefined();
</del><ins>+ return jsNumber(0);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> JSValue setNeverInline(JSValue theFunctionValue)
</span><span class="cx"> {
</span><del>- if (FunctionExecutable* executable = getExecutable(theFunctionValue))
</del><ins>+ if (FunctionExecutable* executable = getExecutableForFunction(theFunctionValue))
</ins><span class="cx"> executable->setNeverInline(true);
</span><span class="cx">
</span><span class="cx"> return jsUndefined();
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeTestRunnerUtilsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/TestRunnerUtils.h (163417 => 163418)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/TestRunnerUtils.h        2014-02-05 00:26:59 UTC (rev 163417)
+++ trunk/Source/JavaScriptCore/runtime/TestRunnerUtils.h        2014-02-05 01:03:21 UTC (rev 163418)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2013 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
</ins><span class="cx"> *
</span><span class="cx"> * Redistribution and use in source and binary forms, with or without
</span><span class="cx"> * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -30,6 +30,12 @@
</span><span class="cx">
</span><span class="cx"> namespace JSC {
</span><span class="cx">
</span><ins>+class CodeBlock;
+class FunctionExecutable;
+
+JS_EXPORT_PRIVATE FunctionExecutable* getExecutableForFunction(JSValue theFunctionValue);
+JS_EXPORT_PRIVATE CodeBlock* getSomeBaselineCodeBlockForFunction(JSValue theFunctionValue);
+
</ins><span class="cx"> JS_EXPORT_PRIVATE JSValue numberOfDFGCompiles(JSValue function);
</span><span class="cx"> JS_EXPORT_PRIVATE JSValue setNeverInline(JSValue function);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoretestsstressfloat32repeatoutofboundsjs"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/tests/stress/float32-repeat-out-of-bounds.js (0 => 163418)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/stress/float32-repeat-out-of-bounds.js         (rev 0)
+++ trunk/Source/JavaScriptCore/tests/stress/float32-repeat-out-of-bounds.js        2014-02-05 01:03:21 UTC (rev 163418)
</span><span class="lines">@@ -0,0 +1,17 @@
</span><ins>+//@ defaultNoEagerRun
+
+function foo(a) {
+ a[0] = 1;
+ a[1] = 2;
+ a[2] = 3;
+}
+
+noInline(foo);
+
+var array = new Float32Array(1);
+
+for (var i = 0; i < 100000; ++i)
+ foo(array);
+
+if (reoptimizationRetryCount(foo))
+ throw "Error: unexpected retry count: " + reoptimizationRetryCount(foo);
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoretestsstressint8repeatoutofboundsjs"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/tests/stress/int8-repeat-out-of-bounds.js (0 => 163418)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/stress/int8-repeat-out-of-bounds.js         (rev 0)
+++ trunk/Source/JavaScriptCore/tests/stress/int8-repeat-out-of-bounds.js        2014-02-05 01:03:21 UTC (rev 163418)
</span><span class="lines">@@ -0,0 +1,17 @@
</span><ins>+//@ defaultNoEagerRun
+
+function foo(a) {
+ a[0] = 1;
+ a[1] = 2;
+ a[2] = 3;
+}
+
+noInline(foo);
+
+var array = new Int8Array(1);
+
+for (var i = 0; i < 100000; ++i)
+ foo(array);
+
+if (reoptimizationRetryCount(foo))
+ throw "Error: unexpected retry count: " + reoptimizationRetryCount(foo);
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoretestsstressstringoutofboundsnegativeprotovaluejs"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/tests/stress/string-out-of-bounds-negative-proto-value.js (0 => 163418)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/stress/string-out-of-bounds-negative-proto-value.js         (rev 0)
+++ trunk/Source/JavaScriptCore/tests/stress/string-out-of-bounds-negative-proto-value.js        2014-02-05 01:03:21 UTC (rev 163418)
</span><span class="lines">@@ -0,0 +1,14 @@
</span><ins>+function foo(s) {
+ return s[-1];
+}
+
+noInline(foo);
+
+String.prototype[-1] = "hello";
+
+for (var i = 0; i < 100000; ++i) {
+ var result = foo("hello");
+ if (result != "hello")
+ throw "Error: bad result: " + result;
+}
+
</ins></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (163417 => 163418)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2014-02-05 00:26:59 UTC (rev 163417)
+++ trunk/Tools/ChangeLog        2014-02-05 01:03:21 UTC (rev 163418)
</span><span class="lines">@@ -1,5 +1,16 @@
</span><span class="cx"> 2014-02-04 Filip Pizlo <fpizlo@apple.com>
</span><span class="cx">
</span><ins>+ DFG PutByVal on typed arrays should detect OutOfBounds sooner
+ https://bugs.webkit.org/show_bug.cgi?id=128162
+
+ Reviewed by Mark Hahnenberg.
+
+ Add a defautNoEagerRun, which is intended to be used for convergence tests.
+
+ * Scripts/run-jsc-stress-tests:
+
+2014-02-04 Filip Pizlo <fpizlo@apple.com>
+
</ins><span class="cx"> export-llvm-build should work with git checkouts
</span><span class="cx"> https://bugs.webkit.org/show_bug.cgi?id=128217
</span><span class="cx">
</span></span></pre></div>
<a id="trunkToolsScriptsrunjscstresstests"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/run-jsc-stress-tests (163417 => 163418)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/run-jsc-stress-tests        2014-02-05 00:26:59 UTC (rev 163417)
+++ trunk/Tools/Scripts/run-jsc-stress-tests        2014-02-05 01:03:21 UTC (rev 163418)
</span><span class="lines">@@ -603,6 +603,13 @@
</span><span class="cx"> end
</span><span class="cx"> end
</span><span class="cx">
</span><ins>+# This is expected to not do eager runs because eager runs can have a lot of recompilations
+# for reasons that don't arise in the real world. It's used for tests that assert convergence
+# by counting recompilations.
+def defaultNoEagerRun
+ defaultQuickRun
+end
+
</ins><span class="cx"> def runProfiler
</span><span class="cx"> profilerOutput = uniqueFilename(".json")
</span><span class="cx"> if $canRunDisplayProfilerOutput
</span></span></pre>
</div>
</div>
</body>
</html>