Reviewers: Jakob,

Description:
Fix constant folding of %_IsMinusZero.

[email protected]

Please review this at https://codereview.chromium.org/190793015/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+5, -1 lines):
  M src/hydrogen-instructions.cc
  M test/mjsunit/constant-fold-control-instructions.js


Index: src/hydrogen-instructions.cc
diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc
index be2b7b80a77fca7d568ef7fd72a3e48247996287..79c7964d15492ead5d3312a5ef53ad82770c1154 100644
--- a/src/hydrogen-instructions.cc
+++ b/src/hydrogen-instructions.cc
@@ -3145,8 +3145,8 @@ bool HCompareMinusZeroAndBranch::KnownSuccessorBlock(HBasicBlock** block) {
     if (constant->HasDoubleValue()) {
       *block = IsMinusZero(constant->DoubleValue())
           ? FirstSuccessor() : SecondSuccessor();
+      return true;
     }
-    return true;
   }
   if (value()->representation().IsSmiOrInteger32()) {
     // A Smi or Integer32 cannot contain minus zero.
Index: test/mjsunit/constant-fold-control-instructions.js
diff --git a/test/mjsunit/constant-fold-control-instructions.js b/test/mjsunit/constant-fold-control-instructions.js index d047684997a597676544f670a6f0f53dcb1dfc9a..eb1b0f3c0b70cdc2139c0d59d073b7e1b346342e 100644
--- a/test/mjsunit/constant-fold-control-instructions.js
+++ b/test/mjsunit/constant-fold-control-instructions.js
@@ -34,6 +34,10 @@ function test() {

   assertTrue(%_IsSpecObject(new Date()));
   assertFalse(%_IsSpecObject(1));
+
+  assertTrue(%_IsMinusZero(-0.0));
+  assertFalse(%_IsMinusZero(1));
+  assertFalse(%_IsMinusZero(""));
 }




--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to