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

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

Issue 1828253002: [builtins] Provide Math.floor as TurboFan builtin. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: REBASE. Address feedback. Created 4 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 7be3a50ed07f95dbef8a1bc534e562afd003c48f..6b8c25d72665bb0c3a6cd97d3dcb8e1e6533622e 100644
--- a/src/compiler/js-builtin-reducer.cc
+++ b/src/compiler/js-builtin-reducer.cc
@@ -129,6 +129,18 @@ Reduction JSBuiltinReducer::ReduceMathImul(Node* node) {
return NoChange();
}
+// ES6 draft 08-24-14, section 20.2.2.16.
+Reduction JSBuiltinReducer::ReduceMathFloor(Node* node) {
+ JSCallReduction r(node);
+ if (r.InputsMatchOne(Type::Number()) &&
+ machine()->Float64RoundDown().IsSupported()) {
+ // Math.floor(a:number) -> Float64RoundDown(a)
+ Node* value =
+ graph()->NewNode(machine()->Float64RoundDown().op(), r.left());
+ return Replace(value);
+ }
+ return NoChange();
+}
// ES6 draft 08-24-14, section 20.2.2.17.
Reduction JSBuiltinReducer::ReduceMathFround(Node* node) {
@@ -192,6 +204,9 @@ Reduction JSBuiltinReducer::Reduce(Node* node) {
case kMathImul:
reduction = ReduceMathImul(node);
break;
+ case kMathFloor:
+ reduction = ReduceMathFloor(node);
+ break;
case kMathFround:
reduction = ReduceMathFround(node);
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