Index: src/compiler/js-builtin-reducer.cc |
diff --git a/src/compiler/js-builtin-reducer.cc b/src/compiler/js-builtin-reducer.cc |
index 36c6cb40dbed8ade69bb2dbd5276ec4c63d963ac..6d175780aa5485c1864187545d89b9f35703b73a 100644 |
--- a/src/compiler/js-builtin-reducer.cc |
+++ b/src/compiler/js-builtin-reducer.cc |
@@ -374,6 +374,18 @@ Reduction JSBuiltinReducer::ReduceMathSqrt(Node* node) { |
return NoChange(); |
} |
+// ES6 section 20.2.2.33 Math.tan ( x ) |
+Reduction JSBuiltinReducer::ReduceMathTan(Node* node) { |
+ JSCallReduction r(node); |
+ if (r.InputsMatchOne(Type::PlainPrimitive())) { |
+ // Math.tan(a:plain-primitive) -> NumberTan(ToNumber(a)) |
+ Node* input = ToNumber(r.GetJSCallInput(0)); |
+ Node* value = graph()->NewNode(simplified()->NumberTan(), input); |
+ return Replace(value); |
+ } |
+ return NoChange(); |
+} |
+ |
// ES6 section 20.2.2.35 Math.trunc ( x ) |
Reduction JSBuiltinReducer::ReduceMathTrunc(Node* node) { |
JSCallReduction r(node); |
@@ -468,6 +480,9 @@ Reduction JSBuiltinReducer::Reduce(Node* node) { |
case kMathSqrt: |
reduction = ReduceMathSqrt(node); |
break; |
+ case kMathTan: |
+ reduction = ReduceMathTan(node); |
+ break; |
case kMathTrunc: |
reduction = ReduceMathTrunc(node); |
break; |