Reviewers: Sven Panne,

Description:
Merged r18737 into trunk branch.

Fixed floor-of-div optimization.

BUG=334708
LOG=N
[email protected]

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

SVN Base: https://v8.googlecode.com/svn/trunk

Affected files (+12, -22 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 062b5ae7ace247dc6a38891952d77c0f827c7143..453239b62c6517a567eed450a1a204223dfa6100 100644
--- a/src/hydrogen-instructions.cc
+++ b/src/hydrogen-instructions.cc
@@ -1442,7 +1442,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();
@@ -1481,17 +1480,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 17d326f2f3a5bd5a113e31a70fc86daab7683485..a4c75e50d4f42b6a49f22b76f12184972ec97eb9 100644
--- a/src/version.cc
+++ b/src/version.cc
@@ -35,7 +35,7 @@
 #define MAJOR_VERSION     3
 #define MINOR_VERSION     24
 #define BUILD_NUMBER      21
-#define PATCH_LEVEL       0
+#define PATCH_LEVEL       1
 // 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/regress-333594.js b/test/mjsunit/regress/regress-334708.js
similarity index 90%
copy from test/mjsunit/regress-333594.js
copy to test/mjsunit/regress/regress-334708.js
index 6f6dbaafcd64d8b752226a290df525ca200b69a0..f0291bbdab61128baad9df89457d045b66644f1b 100644
--- a/test/mjsunit/regress-333594.js
+++ b/test/mjsunit/regress/regress-334708.js
@@ -27,16 +27,16 @@

 // Flags: --allow-natives-syntax

-var a = { x: 1.1 };
-a.x = 0;
-var G = a.x;
-var o = { x: {} };
+function foo(x, y) {
+  return Math.floor(x / y);
+}

-function func() {
-  return {x: G};
+function bar(x, y) {
+  return foo(x + 1, y + 1);
 }

-func();
-func();
-%OptimizeFunctionOnNextCall(func);
-assertEquals(0, func().x);
+foo(16, "4");
+
+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