Index: src/compiler/js-builtin-reducer.cc |
diff --git a/src/compiler/js-builtin-reducer.cc b/src/compiler/js-builtin-reducer.cc |
index 84c07dc9d5926473ec657e84e3ebeba2be79dd66..c1fb41d0d35afcdda986d50397e37f0b086aa71e 100644 |
--- a/src/compiler/js-builtin-reducer.cc |
+++ b/src/compiler/js-builtin-reducer.cc |
@@ -118,6 +118,17 @@ Reduction JSBuiltinReducer::ReduceMathAtan2(Node* node) { |
return NoChange(); |
} |
+// ES6 section 20.2.2.7 Math.atanh ( x ) |
+Reduction JSBuiltinReducer::ReduceMathAtanh(Node* node) { |
+ JSCallReduction r(node); |
+ if (r.InputsMatchOne(Type::Number())) { |
+ // Math.atanh(a:number) -> NumberAtanh(a) |
+ Node* value = graph()->NewNode(simplified()->NumberAtanh(), r.left()); |
+ return Replace(value); |
+ } |
+ return NoChange(); |
+} |
+ |
// ES6 section 20.2.2.10 Math.ceil ( x ) |
Reduction JSBuiltinReducer::ReduceMathCeil(Node* node) { |
JSCallReduction r(node); |
@@ -154,6 +165,17 @@ Reduction JSBuiltinReducer::ReduceMathExp(Node* node) { |
return NoChange(); |
} |
+// ES6 section 20.2.2.15 Math.expm1 ( x ) |
+Reduction JSBuiltinReducer::ReduceMathExpm1(Node* node) { |
+ JSCallReduction r(node); |
+ if (r.InputsMatchOne(Type::Number())) { |
+ // Math.expm1(a:number) -> NumberExpm1(a) |
+ Node* value = graph()->NewNode(simplified()->NumberExpm1(), r.left()); |
+ return Replace(value); |
+ } |
+ return NoChange(); |
+} |
+ |
// ES6 section 20.2.2.16 Math.floor ( x ) |
Reduction JSBuiltinReducer::ReduceMathFloor(Node* node) { |
JSCallReduction r(node); |
@@ -293,6 +315,17 @@ Reduction JSBuiltinReducer::ReduceMathLog10(Node* node) { |
return NoChange(); |
} |
+// ES6 section 20.2.2.9 Math.cbrt ( x ) |
+Reduction JSBuiltinReducer::ReduceMathCbrt(Node* node) { |
+ JSCallReduction r(node); |
+ if (r.InputsMatchOne(Type::Number())) { |
+ // Math.cbrt(a:number) -> NumberCbrt(a) |
+ Node* value = graph()->NewNode(simplified()->NumberCbrt(), r.left()); |
+ return Replace(value); |
+ } |
+ return NoChange(); |
+} |
+ |
// ES6 section 20.2.2.28 Math.round ( x ) |
Reduction JSBuiltinReducer::ReduceMathRound(Node* node) { |
JSCallReduction r(node); |
@@ -354,6 +387,9 @@ Reduction JSBuiltinReducer::Reduce(Node* node) { |
case kMathAtan2: |
reduction = ReduceMathAtan2(node); |
break; |
+ case kMathAtanh: |
+ reduction = ReduceMathAtanh(node); |
+ break; |
case kMathClz32: |
reduction = ReduceMathClz32(node); |
break; |
@@ -363,6 +399,9 @@ Reduction JSBuiltinReducer::Reduce(Node* node) { |
case kMathExp: |
reduction = ReduceMathExp(node); |
break; |
+ case kMathExpm1: |
+ reduction = ReduceMathExpm1(node); |
+ break; |
case kMathFloor: |
reduction = ReduceMathFloor(node); |
break; |
@@ -390,6 +429,9 @@ Reduction JSBuiltinReducer::Reduce(Node* node) { |
case kMathMin: |
reduction = ReduceMathMin(node); |
break; |
+ case kMathCbrt: |
+ reduction = ReduceMathCbrt(node); |
+ break; |
case kMathRound: |
reduction = ReduceMathRound(node); |
break; |