Index: src/compiler/js-builtin-reducer.cc |
diff --git a/src/compiler/js-builtin-reducer.cc b/src/compiler/js-builtin-reducer.cc |
index 5551b22dbcc681b4467af918e6125cc330ccaa22..063327c92e111ee4f483372d2ad37b710d038a43 100644 |
--- a/src/compiler/js-builtin-reducer.cc |
+++ b/src/compiler/js-builtin-reducer.cc |
@@ -177,6 +177,18 @@ Reduction JSBuiltinReducer::ReduceMathCos(Node* node) { |
return NoChange(); |
} |
+// ES6 section 20.2.2.13 Math.cosh ( x ) |
+Reduction JSBuiltinReducer::ReduceMathCosh(Node* node) { |
+ JSCallReduction r(node); |
+ if (r.InputsMatchOne(Type::PlainPrimitive())) { |
+ // Math.cosh(a:plain-primitive) -> NumberCosh(ToNumber(a)) |
+ Node* input = ToNumber(r.GetJSCallInput(0)); |
+ Node* value = graph()->NewNode(simplified()->NumberCosh(), input); |
+ return Replace(value); |
+ } |
+ return NoChange(); |
+} |
+ |
// ES6 section 20.2.2.14 Math.exp ( x ) |
Reduction JSBuiltinReducer::ReduceMathExp(Node* node) { |
JSCallReduction r(node); |
@@ -388,6 +400,18 @@ Reduction JSBuiltinReducer::ReduceMathSin(Node* node) { |
return NoChange(); |
} |
+// ES6 section 20.2.2.31 Math.sinh ( x ) |
+Reduction JSBuiltinReducer::ReduceMathSinh(Node* node) { |
+ JSCallReduction r(node); |
+ if (r.InputsMatchOne(Type::PlainPrimitive())) { |
+ // Math.sinh(a:plain-primitive) -> NumberSinh(ToNumber(a)) |
+ Node* input = ToNumber(r.GetJSCallInput(0)); |
+ Node* value = graph()->NewNode(simplified()->NumberSinh(), input); |
+ return Replace(value); |
+ } |
+ return NoChange(); |
+} |
+ |
// ES6 section 20.2.2.32 Math.sqrt ( x ) |
Reduction JSBuiltinReducer::ReduceMathSqrt(Node* node) { |
JSCallReduction r(node); |
@@ -412,6 +436,18 @@ Reduction JSBuiltinReducer::ReduceMathTan(Node* node) { |
return NoChange(); |
} |
+// ES6 section 20.2.2.34 Math.tanh ( x ) |
+Reduction JSBuiltinReducer::ReduceMathTanh(Node* node) { |
+ JSCallReduction r(node); |
+ if (r.InputsMatchOne(Type::PlainPrimitive())) { |
+ // Math.tanh(a:plain-primitive) -> NumberTanh(ToNumber(a)) |
+ Node* input = ToNumber(r.GetJSCallInput(0)); |
+ Node* value = graph()->NewNode(simplified()->NumberTanh(), input); |
+ return Replace(value); |
+ } |
+ return NoChange(); |
+} |
+ |
// ES6 section 20.2.2.35 Math.trunc ( x ) |
Reduction JSBuiltinReducer::ReduceMathTrunc(Node* node) { |
JSCallReduction r(node); |
@@ -467,6 +503,9 @@ Reduction JSBuiltinReducer::Reduce(Node* node) { |
case kMathCos: |
reduction = ReduceMathCos(node); |
break; |
+ case kMathCosh: |
+ reduction = ReduceMathCosh(node); |
+ break; |
case kMathExp: |
reduction = ReduceMathExp(node); |
break; |
@@ -509,12 +548,18 @@ Reduction JSBuiltinReducer::Reduce(Node* node) { |
case kMathSin: |
reduction = ReduceMathSin(node); |
break; |
+ case kMathSinh: |
+ reduction = ReduceMathSinh(node); |
+ break; |
case kMathSqrt: |
reduction = ReduceMathSqrt(node); |
break; |
case kMathTan: |
reduction = ReduceMathTan(node); |
break; |
+ case kMathTanh: |
+ reduction = ReduceMathTanh(node); |
+ break; |
case kMathTrunc: |
reduction = ReduceMathTrunc(node); |
break; |