Reviewers: ulan,
Description:
Merged r18737 into 3.22 branch.
Fixed floor-of-div optimization.
BUG=334708
LOG=N
[email protected]
Please review this at https://codereview.chromium.org/146723002/
SVN Base: https://v8.googlecode.com/svn/branches/3.22
Affected files (+13, -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
206ab7e2accf5e496b6cd814eb1071c511cb21e7..4e817664f0fef5a102675d116629d4ca37584632
100644
--- a/src/hydrogen-instructions.cc
+++ b/src/hydrogen-instructions.cc
@@ -1371,7 +1371,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();
@@ -1410,17 +1409,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
dfda1a3ba6d7adaef82b95abb6dd27f5105e4021..1e5594af591730cf195030ce96a2e70e85efe0f2
100644
--- a/src/version.cc
+++ b/src/version.cc
@@ -35,7 +35,7 @@
#define MAJOR_VERSION 3
#define MINOR_VERSION 22
#define BUILD_NUMBER 24
-#define PATCH_LEVEL 17
+#define PATCH_LEVEL 18
// 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/compiler/lazy-const-lookup.js
b/test/mjsunit/regress/regress-334708.js
similarity index 86%
copy from test/mjsunit/compiler/lazy-const-lookup.js
copy to test/mjsunit/regress/regress-334708.js
index
b4f15a1c9f4977dcd42f249d8242849e3269906d..f0291bbdab61128baad9df89457d045b66644f1b
100644
--- a/test/mjsunit/compiler/lazy-const-lookup.js
+++ b/test/mjsunit/regress/regress-334708.js
@@ -1,4 +1,4 @@
-// Copyright 2011 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,15 +27,16 @@
// Flags: --allow-natives-syntax
-function outer() {
- const x = 1;
- function inner() {
- return x;
- }
- inner();
- %OptimizeFunctionOnNextCall(inner);
- inner();
+function foo(x, y) {
+ return Math.floor(x / y);
}
-outer();
+function bar(x, y) {
+ return foo(x + 1, y + 1);
+}
+
+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.