Bug 1001222 - Implicitly use operands to JSOP_POS. (r=jandem)
authorShu-yu Guo <shu@rfrn.org>
Fri, 25 Apr 2014 12:13:13 -0700
changeset 198818 e50c224f30a7e6872b848c61da17361b8553060b
parent 198817 aa534ca9cea506e444dd195f10c43e4d1d417c72
child 198819 60b6bdaafba7b8b5ee5acb7a295f6f13402d1e72
push id3624
push userasasaki@mozilla.com
push dateMon, 09 Jun 2014 21:49:01 +0000
treeherdermozilla-beta@b1a5da15899a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem
bugs1001222
milestone31.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1001222 - Implicitly use operands to JSOP_POS. (r=jandem)
js/src/jit-test/tests/ion/bug1001222.js
js/src/jit/IonBuilder.cpp
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/ion/bug1001222.js
@@ -0,0 +1,5 @@
+function f(x, y) {
+  return +(x ? x : y), y >>> 0
+}
+f(0, -0)
+f(0, 2147483649)
--- a/js/src/jit/IonBuilder.cpp
+++ b/js/src/jit/IonBuilder.cpp
@@ -3879,17 +3879,20 @@ IonBuilder::jsop_binary(JSOp op)
 
     return jsop_binary(op, left, right);
 }
 
 bool
 IonBuilder::jsop_pos()
 {
     if (IsNumberType(current->peek(-1)->type())) {
-        // Already int32 or double.
+        // Already int32 or double. Set the operand as implicitly used so it
+        // doesn't get optimized out if it has no other uses, as we could bail
+        // out.
+        current->peek(-1)->setImplicitlyUsedUnchecked();
         return true;
     }
 
     // Compile +x as x * 1.
     MDefinition *value = current->pop();
     MConstant *one = MConstant::New(alloc(), Int32Value(1));
     current->add(one);