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

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

Issue 2077533002: [builtins] Introduce proper Float64Exp operator. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: REBASE. Import tests from Raymond. 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 363ad9db4e8ed946858ce5b89c70338c9b9bdf67..84c07dc9d5926473ec657e84e3ebeba2be79dd66 100644
--- a/src/compiler/js-builtin-reducer.cc
+++ b/src/compiler/js-builtin-reducer.cc
@@ -142,6 +142,18 @@ Reduction JSBuiltinReducer::ReduceMathClz32(Node* node) {
return NoChange();
}
+// ES6 section 20.2.2.14 Math.exp ( x )
+Reduction JSBuiltinReducer::ReduceMathExp(Node* node) {
+ JSCallReduction r(node);
+ if (r.InputsMatchOne(Type::PlainPrimitive())) {
+ // Math.exp(a:plain-primitive) -> NumberExp(ToNumber(a))
+ Node* input = ToNumber(r.GetJSCallInput(0));
+ Node* value = graph()->NewNode(simplified()->NumberExp(), input);
+ return Replace(value);
+ }
+ return NoChange();
+}
+
// ES6 section 20.2.2.16 Math.floor ( x )
Reduction JSBuiltinReducer::ReduceMathFloor(Node* node) {
JSCallReduction r(node);
@@ -348,6 +360,9 @@ Reduction JSBuiltinReducer::Reduce(Node* node) {
case kMathCeil:
reduction = ReduceMathCeil(node);
break;
+ case kMathExp:
+ reduction = ReduceMathExp(node);
+ break;
case kMathFloor:
reduction = ReduceMathFloor(node);
break;

Powered by Google App Engine
This is Rietveld 408576698