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

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

Issue 2060743002: [builtins] Introduce proper Float64Log1p operator. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@Math_Log
Patch Set: REBASE 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 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;

Powered by Google App Engine
This is Rietveld 408576698