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; |