Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(913)

Unified Diff: src/compiler/js-builtin-reducer.cc

Issue 2029413005: [builtins] Migrate Math.log to TurboFan. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix typo. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;

Powered by Google App Engine
This is Rietveld 408576698