Index: src/compiler/js-builtin-reducer.cc |
diff --git a/src/compiler/js-builtin-reducer.cc b/src/compiler/js-builtin-reducer.cc |
index 363ad9db4e8ed946858ce5b89c70338c9b9bdf67..84c07dc9d5926473ec657e84e3ebeba2be79dd66 100644 |
--- a/src/compiler/js-builtin-reducer.cc |
+++ b/src/compiler/js-builtin-reducer.cc |
@@ -142,6 +142,18 @@ Reduction JSBuiltinReducer::ReduceMathClz32(Node* node) { |
return NoChange(); |
} |
+// ES6 section 20.2.2.14 Math.exp ( x ) |
+Reduction JSBuiltinReducer::ReduceMathExp(Node* node) { |
+ JSCallReduction r(node); |
+ if (r.InputsMatchOne(Type::PlainPrimitive())) { |
+ // Math.exp(a:plain-primitive) -> NumberExp(ToNumber(a)) |
+ Node* input = ToNumber(r.GetJSCallInput(0)); |
+ Node* value = graph()->NewNode(simplified()->NumberExp(), input); |
+ return Replace(value); |
+ } |
+ return NoChange(); |
+} |
+ |
// ES6 section 20.2.2.16 Math.floor ( x ) |
Reduction JSBuiltinReducer::ReduceMathFloor(Node* node) { |
JSCallReduction r(node); |
@@ -348,6 +360,9 @@ Reduction JSBuiltinReducer::Reduce(Node* node) { |
case kMathCeil: |
reduction = ReduceMathCeil(node); |
break; |
+ case kMathExp: |
+ reduction = ReduceMathExp(node); |
+ break; |
case kMathFloor: |
reduction = ReduceMathFloor(node); |
break; |