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

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

Issue 2068743002: [builtins] Unify Atanh, Cbrt and Expm1 as exports from flibm. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixed type warning. 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
« no previous file with comments | « src/compiler/js-builtin-reducer.h ('k') | src/compiler/machine-operator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/js-builtin-reducer.cc
diff --git a/src/compiler/js-builtin-reducer.cc b/src/compiler/js-builtin-reducer.cc
index 84c07dc9d5926473ec657e84e3ebeba2be79dd66..c1fb41d0d35afcdda986d50397e37f0b086aa71e 100644
--- a/src/compiler/js-builtin-reducer.cc
+++ b/src/compiler/js-builtin-reducer.cc
@@ -118,6 +118,17 @@ Reduction JSBuiltinReducer::ReduceMathAtan2(Node* node) {
return NoChange();
}
+// ES6 section 20.2.2.7 Math.atanh ( x )
+Reduction JSBuiltinReducer::ReduceMathAtanh(Node* node) {
+ JSCallReduction r(node);
+ if (r.InputsMatchOne(Type::Number())) {
+ // Math.atanh(a:number) -> NumberAtanh(a)
+ Node* value = graph()->NewNode(simplified()->NumberAtanh(), r.left());
+ return Replace(value);
+ }
+ return NoChange();
+}
+
// ES6 section 20.2.2.10 Math.ceil ( x )
Reduction JSBuiltinReducer::ReduceMathCeil(Node* node) {
JSCallReduction r(node);
@@ -154,6 +165,17 @@ Reduction JSBuiltinReducer::ReduceMathExp(Node* node) {
return NoChange();
}
+// ES6 section 20.2.2.15 Math.expm1 ( x )
+Reduction JSBuiltinReducer::ReduceMathExpm1(Node* node) {
+ JSCallReduction r(node);
+ if (r.InputsMatchOne(Type::Number())) {
+ // Math.expm1(a:number) -> NumberExpm1(a)
+ Node* value = graph()->NewNode(simplified()->NumberExpm1(), r.left());
+ return Replace(value);
+ }
+ return NoChange();
+}
+
// ES6 section 20.2.2.16 Math.floor ( x )
Reduction JSBuiltinReducer::ReduceMathFloor(Node* node) {
JSCallReduction r(node);
@@ -293,6 +315,17 @@ Reduction JSBuiltinReducer::ReduceMathLog10(Node* node) {
return NoChange();
}
+// ES6 section 20.2.2.9 Math.cbrt ( x )
+Reduction JSBuiltinReducer::ReduceMathCbrt(Node* node) {
+ JSCallReduction r(node);
+ if (r.InputsMatchOne(Type::Number())) {
+ // Math.cbrt(a:number) -> NumberCbrt(a)
+ Node* value = graph()->NewNode(simplified()->NumberCbrt(), r.left());
+ return Replace(value);
+ }
+ return NoChange();
+}
+
// ES6 section 20.2.2.28 Math.round ( x )
Reduction JSBuiltinReducer::ReduceMathRound(Node* node) {
JSCallReduction r(node);
@@ -354,6 +387,9 @@ Reduction JSBuiltinReducer::Reduce(Node* node) {
case kMathAtan2:
reduction = ReduceMathAtan2(node);
break;
+ case kMathAtanh:
+ reduction = ReduceMathAtanh(node);
+ break;
case kMathClz32:
reduction = ReduceMathClz32(node);
break;
@@ -363,6 +399,9 @@ Reduction JSBuiltinReducer::Reduce(Node* node) {
case kMathExp:
reduction = ReduceMathExp(node);
break;
+ case kMathExpm1:
+ reduction = ReduceMathExpm1(node);
+ break;
case kMathFloor:
reduction = ReduceMathFloor(node);
break;
@@ -390,6 +429,9 @@ Reduction JSBuiltinReducer::Reduce(Node* node) {
case kMathMin:
reduction = ReduceMathMin(node);
break;
+ case kMathCbrt:
+ reduction = ReduceMathCbrt(node);
+ break;
case kMathRound:
reduction = ReduceMathRound(node);
break;
« no previous file with comments | « src/compiler/js-builtin-reducer.h ('k') | src/compiler/machine-operator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698