Reviewers: ulan,

Description:
Merged r18737 into 3.23 branch.

Fixed floor-of-div optimization.

BUG=334708
LOG=N
[email protected]

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

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

Affected files (+13, -20 lines):
  M src/hydrogen-instructions.cc
  M src/version.cc
  A + test/mjsunit/regress/regress-334708.js


Index: src/hydrogen-instructions.cc
diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc
index 9f962023572b38d3b2f879933171eccb0f13c49d..519fb0ff8092d77421927715a4f732c1bb715cc4 100644
--- a/src/hydrogen-instructions.cc
+++ b/src/hydrogen-instructions.cc
@@ -1441,7 +1441,6 @@ HValue* HUnaryMathOperation::Canonicalize() {

   if (op() == kMathFloor) {
     HValue* val = value();
-    if (val->IsChange()) val = HChange::cast(val)->value();
     if (val->IsDiv() && (val->UseCount() == 1)) {
       HDiv* hdiv = HDiv::cast(val);
       HValue* left = hdiv->left();
@@ -1480,17 +1479,8 @@ HValue* HUnaryMathOperation::Canonicalize() {
       }
       HMathFloorOfDiv* instr =
HMathFloorOfDiv::New(block()->zone(), context(), new_left, new_right);
-      // Replace this HMathFloor instruction by the new HMathFloorOfDiv.
       instr->InsertBefore(this);
-      ReplaceAllUsesWith(instr);
-      Kill();
- // We know the division had no other uses than this HMathFloor. Delete it.
-      // Dead code elimination will deal with |left| and |right| if
-      // appropriate.
-      hdiv->DeleteAndReplaceWith(NULL);
-
-      // Return NULL to remove this instruction from the graph.
-      return NULL;
+      return instr;
     }
   }
   return this;
Index: src/version.cc
diff --git a/src/version.cc b/src/version.cc
index 45e5ebce9ed844b24f94c81e4d8af249f73d7149..ed1354cd501fc1955c05906b0e01635a0affbc5c 100644
--- a/src/version.cc
+++ b/src/version.cc
@@ -35,7 +35,7 @@
 #define MAJOR_VERSION     3
 #define MINOR_VERSION     23
 #define BUILD_NUMBER      17
-#define PATCH_LEVEL       9
+#define PATCH_LEVEL       10
 // Use 1 for candidates and 0 otherwise.
 // (Boolean macro values are not supported by all preprocessors.)
 #define IS_CANDIDATE_VERSION 0
Index: test/mjsunit/regress/regress-334708.js
diff --git a/test/mjsunit/lithium/MathExp.js b/test/mjsunit/regress/regress-334708.js
similarity index 86%
copy from test/mjsunit/lithium/MathExp.js
copy to test/mjsunit/regress/regress-334708.js
index 854ff5fd7fd2a7a22bcc3557e4e2bb4c01d9b83f..f0291bbdab61128baad9df89457d045b66644f1b 100644
--- a/test/mjsunit/lithium/MathExp.js
+++ b/test/mjsunit/regress/regress-334708.js
@@ -1,4 +1,4 @@
-// Copyright 2013 the V8 project authors. All rights reserved.
+// Copyright 2014 the V8 project authors. All rights reserved.
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
 // met:
@@ -27,13 +27,16 @@

 // Flags: --allow-natives-syntax

-function foo(x) {
-  return Math.exp(x);
+function foo(x, y) {
+  return Math.floor(x / y);
 }

-foo(12.3);
-var r1 = foo(12.3);
-%OptimizeFunctionOnNextCall(foo);
-var r2 = foo(12.3);
+function bar(x, y) {
+  return foo(x + 1, y + 1);
+}
+
+foo(16, "4");

-assertEquals(r1, r2);
+bar(64, 2);
+%OptimizeFunctionOnNextCall(bar);
+bar(64, 2);


--
--
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/groups/opt_out.

Reply via email to