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

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

Issue 2065503002: [builtins] Introduce proper Float64Atan and Float64Atan2 operators. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: [WIP] Fix GCC/Win32. 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 0743f8e302e6001dffac8088014ab8607ce9a1ac..51d16b73a7ac966e86628214608d62927cd34bd6 100644
--- a/src/compiler/js-builtin-reducer.cc
+++ b/src/compiler/js-builtin-reducer.cc
@@ -183,6 +183,29 @@ Reduction JSBuiltinReducer::ReduceMathFround(Node* node) {
return NoChange();
}
+// ES6 section 20.2.2.6 Math.atan ( x )
+Reduction JSBuiltinReducer::ReduceMathAtan(Node* node) {
+ JSCallReduction r(node);
+ if (r.InputsMatchOne(Type::Number())) {
+ // Math.atan(a:number) -> NumberAtan(a)
+ Node* value = graph()->NewNode(simplified()->NumberAtan(), r.left());
+ return Replace(value);
+ }
+ return NoChange();
+}
+
+// ES6 section 20.2.2.8 Math.atan2 ( y, x )
+Reduction JSBuiltinReducer::ReduceMathAtan2(Node* node) {
+ JSCallReduction r(node);
+ if (r.InputsMatchTwo(Type::Number(), Type::Number())) {
+ // Math.atan2(a:number, b:number) -> NumberAtan2(a, b)
+ Node* value =
+ graph()->NewNode(simplified()->NumberAtan2(), r.left(), r.right());
+ return Replace(value);
+ }
+ return NoChange();
+}
+
// ES6 section 20.2.2.20 Math.log ( x )
Reduction JSBuiltinReducer::ReduceMathLog(Node* node) {
JSCallReduction r(node);
@@ -275,6 +298,12 @@ Reduction JSBuiltinReducer::Reduce(Node* node) {
case kMathFround:
reduction = ReduceMathFround(node);
break;
+ case kMathAtan:
+ reduction = ReduceMathAtan(node);
+ break;
+ case kMathAtan2:
+ reduction = ReduceMathAtan2(node);
+ break;
case kMathLog:
reduction = ReduceMathLog(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