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

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

Issue 2103733003: [turbofan] Introduce Float64Pow and NumberPow operators. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: REBASE on ARM64 bug fix. 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 81d63924e1c4db8e0e63efa779a3def1d536c82f..5551b22dbcc681b4467af918e6125cc330ccaa22 100644
--- a/src/compiler/js-builtin-reducer.cc
+++ b/src/compiler/js-builtin-reducer.cc
@@ -339,6 +339,20 @@ Reduction JSBuiltinReducer::ReduceMathMin(Node* node) {
return NoChange();
}
+// ES6 section 20.2.2.26 Math.pow ( x, y )
+Reduction JSBuiltinReducer::ReduceMathPow(Node* node) {
+ JSCallReduction r(node);
+ if (r.InputsMatchTwo(Type::PlainPrimitive(), Type::PlainPrimitive())) {
+ // Math.pow(a:plain-primitive,
+ // b:plain-primitive) -> NumberPow(ToNumber(a), ToNumber(b))
+ Node* left = ToNumber(r.left());
+ Node* right = ToNumber(r.right());
+ Node* value = graph()->NewNode(simplified()->NumberPow(), left, right);
+ return Replace(value);
+ }
+ return NoChange();
+}
+
// ES6 section 20.2.2.28 Math.round ( x )
Reduction JSBuiltinReducer::ReduceMathRound(Node* node) {
JSCallReduction r(node);
@@ -441,12 +455,15 @@ Reduction JSBuiltinReducer::Reduce(Node* node) {
case kMathAtanh:
reduction = ReduceMathAtanh(node);
break;
- case kMathClz32:
- reduction = ReduceMathClz32(node);
+ case kMathCbrt:
+ reduction = ReduceMathCbrt(node);
break;
case kMathCeil:
reduction = ReduceMathCeil(node);
break;
+ case kMathClz32:
+ reduction = ReduceMathClz32(node);
+ break;
case kMathCos:
reduction = ReduceMathCos(node);
break;
@@ -483,8 +500,8 @@ Reduction JSBuiltinReducer::Reduce(Node* node) {
case kMathMin:
reduction = ReduceMathMin(node);
break;
- case kMathCbrt:
- reduction = ReduceMathCbrt(node);
+ case kMathPow:
+ reduction = ReduceMathPow(node);
break;
case kMathRound:
reduction = ReduceMathRound(node);
« 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