Title: [183650] trunk
- Revision
- 183650
- Author
- [email protected]
- Date
- 2015-04-30 16:02:33 -0700 (Thu, 30 Apr 2015)
Log Message
js/regress/is-string-fold-tricky.html and js/regress/is-string-fold.html are crashing
https://bugs.webkit.org/show_bug.cgi?id=144463
Reviewed by Benjamin Poulain.
Source/_javascript_Core:
Fixup phase was super cleverly folding an IsString(@x) when @x is predicted SpecString
into a Check(String:@x) followed by JSConstant(true). Then in these tests the
ValueAdd(IsString(@x), @stuff) would try to turn this into an integer add by cleverly
converting the boolean into an integer. But as part of doing that, it would try to
short-circuit any profiling by leveraging the fact that the IsString is now a constant,
and it would try to figure out if the addition might overflow. Part of that logic
involved checking if the immediate is either a boolean or a sufficiently small integer.
But: it would check if it's a sufficiently small integer before checking if it was a
boolean, so it would try to call asNumber() on the boolean.
All of this cleverness was very deliberate, but apparently the @stuff + booleanConstant
case was previously never hit until I wrote these tests, and so we never knew that
calling asNumber() on a boolean was wrong.
The fix is super simple: the _expression_ should just check for boolean first.
This bug was benign in release builds. JSValue::asNumber() on a boolean would return
garbage, and that's OK, since we'd take the boolean case anyway.
* dfg/DFGGraph.h:
(JSC::DFG::Graph::addImmediateShouldSpeculateInt32):
LayoutTests:
Unskip now that the bug is fixed.
* TestExpectations:
* js/regress/script-tests/is-string-fold-tricky.js:
* js/regress/script-tests/is-string-fold.js:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (183649 => 183650)
--- trunk/LayoutTests/ChangeLog 2015-04-30 22:57:28 UTC (rev 183649)
+++ trunk/LayoutTests/ChangeLog 2015-04-30 23:02:33 UTC (rev 183650)
@@ -1,3 +1,16 @@
+2015-04-30 Filip Pizlo <[email protected]>
+
+ js/regress/is-string-fold-tricky.html and js/regress/is-string-fold.html are crashing
+ https://bugs.webkit.org/show_bug.cgi?id=144463
+
+ Reviewed by Benjamin Poulain.
+
+ Unskip now that the bug is fixed.
+
+ * TestExpectations:
+ * js/regress/script-tests/is-string-fold-tricky.js:
+ * js/regress/script-tests/is-string-fold.js:
+
2015-04-30 Brady Eidson <[email protected]>
_javascript_ using WebSQL can create their own WebKit info table.
Modified: trunk/LayoutTests/TestExpectations (183649 => 183650)
--- trunk/LayoutTests/TestExpectations 2015-04-30 22:57:28 UTC (rev 183649)
+++ trunk/LayoutTests/TestExpectations 2015-04-30 23:02:33 UTC (rev 183650)
@@ -527,6 +527,3 @@
webkit.org/b/143778 streams/reference-implementation/readable-stream.html [ Pass Failure ]
webkit.org/b/144258 [ Debug ] js/class-syntax-semicolon.html [ Skip ]
-
-webkit.org/b/144463 js/regress/is-string-fold.html [ Skip ]
-webkit.org/b/144463 js/regress/is-string-fold-tricky.html [ Skip ]
Modified: trunk/LayoutTests/js/regress/script-tests/is-string-fold-tricky.js (183649 => 183650)
--- trunk/LayoutTests/js/regress/script-tests/is-string-fold-tricky.js 2015-04-30 22:57:28 UTC (rev 183649)
+++ trunk/LayoutTests/js/regress/script-tests/is-string-fold-tricky.js 2015-04-30 23:02:33 UTC (rev 183650)
@@ -1,6 +1,3 @@
-// webkit.org/b/144463
-//@ skip
-
var object = {};
(function() {
var result = 0;
Modified: trunk/LayoutTests/js/regress/script-tests/is-string-fold.js (183649 => 183650)
--- trunk/LayoutTests/js/regress/script-tests/is-string-fold.js 2015-04-30 22:57:28 UTC (rev 183649)
+++ trunk/LayoutTests/js/regress/script-tests/is-string-fold.js 2015-04-30 23:02:33 UTC (rev 183650)
@@ -1,6 +1,3 @@
-// webkit.org/b/144463
-//@ skip
-
var value1 = "hello";
var value2 = 42;
(function() {
Modified: trunk/Source/_javascript_Core/ChangeLog (183649 => 183650)
--- trunk/Source/_javascript_Core/ChangeLog 2015-04-30 22:57:28 UTC (rev 183649)
+++ trunk/Source/_javascript_Core/ChangeLog 2015-04-30 23:02:33 UTC (rev 183650)
@@ -1,5 +1,34 @@
2015-04-30 Filip Pizlo <[email protected]>
+ js/regress/is-string-fold-tricky.html and js/regress/is-string-fold.html are crashing
+ https://bugs.webkit.org/show_bug.cgi?id=144463
+
+ Reviewed by Benjamin Poulain.
+
+ Fixup phase was super cleverly folding an IsString(@x) when @x is predicted SpecString
+ into a Check(String:@x) followed by JSConstant(true). Then in these tests the
+ ValueAdd(IsString(@x), @stuff) would try to turn this into an integer add by cleverly
+ converting the boolean into an integer. But as part of doing that, it would try to
+ short-circuit any profiling by leveraging the fact that the IsString is now a constant,
+ and it would try to figure out if the addition might overflow. Part of that logic
+ involved checking if the immediate is either a boolean or a sufficiently small integer.
+ But: it would check if it's a sufficiently small integer before checking if it was a
+ boolean, so it would try to call asNumber() on the boolean.
+
+ All of this cleverness was very deliberate, but apparently the @stuff + booleanConstant
+ case was previously never hit until I wrote these tests, and so we never knew that
+ calling asNumber() on a boolean was wrong.
+
+ The fix is super simple: the _expression_ should just check for boolean first.
+
+ This bug was benign in release builds. JSValue::asNumber() on a boolean would return
+ garbage, and that's OK, since we'd take the boolean case anyway.
+
+ * dfg/DFGGraph.h:
+ (JSC::DFG::Graph::addImmediateShouldSpeculateInt32):
+
+2015-04-30 Filip Pizlo <[email protected]>
+
Unreviewed, add a FIXME comment referencing https://bugs.webkit.org/show_bug.cgi?id=144458.
* jit/JITOperations.cpp:
Modified: trunk/Source/_javascript_Core/dfg/DFGGraph.h (183649 => 183650)
--- trunk/Source/_javascript_Core/dfg/DFGGraph.h 2015-04-30 22:57:28 UTC (rev 183649)
+++ trunk/Source/_javascript_Core/dfg/DFGGraph.h 2015-04-30 23:02:33 UTC (rev 183650)
@@ -889,7 +889,7 @@
if (operandResultType != NodeResultInt32 && immediateValue.isDouble())
return DontSpeculateInt32;
- if (jsNumber(immediateValue.asNumber()).isInt32() || immediateValue.isBoolean())
+ if (immediateValue.isBoolean() || jsNumber(immediateValue.asNumber()).isInt32())
return add->canSpeculateInt32(source) ? SpeculateInt32 : DontSpeculateInt32;
double doubleImmediate = immediateValue.asDouble();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes