Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Unified Diff: src/compiler/js-builtin-reducer.cc

Issue 990963003: [turbofan] Unify Math.floor / Math.ceil optimization. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/js-builtin-reducer.h ('k') | src/compiler/js-intrinsic-lowering.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/js-builtin-reducer.cc
diff --git a/src/compiler/js-builtin-reducer.cc b/src/compiler/js-builtin-reducer.cc
index df43b84c61f783e72c42d683c9a6f33e2831020c..f1ed17b358afba2f22b06a5d67414bb22d9bdee2 100644
--- a/src/compiler/js-builtin-reducer.cc
+++ b/src/compiler/js-builtin-reducer.cc
@@ -186,24 +186,11 @@ Reduction JSBuiltinReducer::ReduceMathFround(Node* node) {
// ES6 draft 10-14-14, section 20.2.2.16.
Reduction JSBuiltinReducer::ReduceMathFloor(Node* node) {
- if (!machine()->HasFloat64Floor()) return NoChange();
+ if (!machine()->HasFloat64RoundDown()) return NoChange();
JSCallReduction r(node);
if (r.InputsMatchOne(Type::Number())) {
- // Math.floor(a:number) -> Float64Floor(a)
- Node* value = graph()->NewNode(machine()->Float64Floor(), r.left());
- return Replace(value);
- }
- return NoChange();
-}
-
-
-// ES6 draft 10-14-14, section 20.2.2.10.
-Reduction JSBuiltinReducer::ReduceMathCeil(Node* node) {
- if (!machine()->HasFloat64Ceil()) return NoChange();
- JSCallReduction r(node);
- if (r.InputsMatchOne(Type::Number())) {
- // Math.ceil(a:number) -> Float64Ceil(a)
- Node* value = graph()->NewNode(machine()->Float64Ceil(), r.left());
+ // Math.floor(a:number) -> Float64RoundDown(a)
+ Node* value = graph()->NewNode(machine()->Float64RoundDown(), r.left());
return Replace(value);
}
return NoChange();
@@ -228,8 +215,6 @@ Reduction JSBuiltinReducer::Reduce(Node* node) {
return ReplaceWithPureReduction(node, ReduceMathFround(node));
case kMathFloor:
return ReplaceWithPureReduction(node, ReduceMathFloor(node));
- case kMathCeil:
- return ReplaceWithPureReduction(node, ReduceMathCeil(node));
default:
break;
}
« no previous file with comments | « src/compiler/js-builtin-reducer.h ('k') | src/compiler/js-intrinsic-lowering.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698