Index: src/compiler/js-builtin-reducer.cc |
diff --git a/src/compiler/js-builtin-reducer.cc b/src/compiler/js-builtin-reducer.cc |
index 2f4e2feed27b39eeff4c2204948af6ebb0327135..7ac4ca518d18bc72626d5aa3f35afe7e0e2480d9 100644 |
--- a/src/compiler/js-builtin-reducer.cc |
+++ b/src/compiler/js-builtin-reducer.cc |
@@ -183,6 +183,17 @@ Reduction JSBuiltinReducer::ReduceMathFround(Node* node) { |
return NoChange(); |
} |
+// ES6 section 20.2.2.20 Math.log ( x ) |
+Reduction JSBuiltinReducer::ReduceMathLog(Node* node) { |
+ JSCallReduction r(node); |
+ if (r.InputsMatchOne(Type::Number())) { |
+ // Math.log(a:number) -> NumberLog(a) |
+ Node* value = graph()->NewNode(simplified()->NumberLog(), r.left()); |
+ return Replace(value); |
+ } |
+ return NoChange(); |
+} |
+ |
// ES6 section 20.2.2.28 Math.round ( x ) |
Reduction JSBuiltinReducer::ReduceMathRound(Node* node) { |
JSCallReduction r(node); |
@@ -253,6 +264,9 @@ Reduction JSBuiltinReducer::Reduce(Node* node) { |
case kMathFround: |
reduction = ReduceMathFround(node); |
break; |
+ case kMathLog: |
+ reduction = ReduceMathLog(node); |
+ break; |
case kMathRound: |
reduction = ReduceMathRound(node); |
break; |