Index: src/compiler/js-builtin-reducer.cc |
diff --git a/src/compiler/js-builtin-reducer.cc b/src/compiler/js-builtin-reducer.cc |
index 7ac4ca518d18bc72626d5aa3f35afe7e0e2480d9..0743f8e302e6001dffac8088014ab8607ce9a1ac 100644 |
--- a/src/compiler/js-builtin-reducer.cc |
+++ b/src/compiler/js-builtin-reducer.cc |
@@ -194,6 +194,17 @@ Reduction JSBuiltinReducer::ReduceMathLog(Node* node) { |
return NoChange(); |
} |
+// ES6 section 20.2.2.21 Math.log1p ( x ) |
+Reduction JSBuiltinReducer::ReduceMathLog1p(Node* node) { |
+ JSCallReduction r(node); |
+ if (r.InputsMatchOne(Type::Number())) { |
+ // Math.log1p(a:number) -> NumberLog1p(a) |
+ Node* value = graph()->NewNode(simplified()->NumberLog1p(), r.left()); |
+ return Replace(value); |
+ } |
+ return NoChange(); |
+} |
+ |
// ES6 section 20.2.2.28 Math.round ( x ) |
Reduction JSBuiltinReducer::ReduceMathRound(Node* node) { |
JSCallReduction r(node); |
@@ -267,6 +278,9 @@ Reduction JSBuiltinReducer::Reduce(Node* node) { |
case kMathLog: |
reduction = ReduceMathLog(node); |
break; |
+ case kMathLog1p: |
+ reduction = ReduceMathLog1p(node); |
+ break; |
case kMathRound: |
reduction = ReduceMathRound(node); |
break; |