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

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

Issue 1004083002: [turbofan] Use builtin inlining mechanism for Math.abs and Math.sqrt. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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/js-intrinsic-lowering.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 e2d12f0b5193f600b7f33de08052e242a6f99bb6..2a032dbfb2dc1d1df44abb07552ae372081aa09e 100644
--- a/src/compiler/js-builtin-reducer.cc
+++ b/src/compiler/js-builtin-reducer.cc
@@ -100,38 +100,6 @@ JSBuiltinReducer::JSBuiltinReducer(JSGraph* jsgraph)
: jsgraph_(jsgraph), simplified_(jsgraph->zone()) {}
-// ECMA-262, section 15.8.2.1.
-Reduction JSBuiltinReducer::ReduceMathAbs(Node* node) {
- JSCallReduction r(node);
- if (r.InputsMatchOne(Type::Unsigned32())) {
- // Math.abs(a:uint32) -> a
- return Replace(r.left());
- }
- if (r.InputsMatchOne(Type::Number())) {
- // Math.abs(a:number) -> (a > 0 ? a : 0 - a)
- Node* const value = r.left();
- Node* const zero = jsgraph()->ZeroConstant();
- return Replace(graph()->NewNode(
- common()->Select(kMachNone),
- graph()->NewNode(simplified()->NumberLessThan(), zero, value), value,
- graph()->NewNode(simplified()->NumberSubtract(), zero, value)));
- }
- return NoChange();
-}
-
-
-// ECMA-262, section 15.8.2.17.
-Reduction JSBuiltinReducer::ReduceMathSqrt(Node* node) {
- JSCallReduction r(node);
- if (r.InputsMatchOne(Type::Number())) {
- // Math.sqrt(a:number) -> Float64Sqrt(a)
- Node* value = graph()->NewNode(machine()->Float64Sqrt(), r.left());
- return Replace(value);
- }
- return NoChange();
-}
-
-
// ECMA-262, section 15.8.2.11.
Reduction JSBuiltinReducer::ReduceMathMax(Node* node) {
JSCallReduction r(node);
@@ -190,10 +158,6 @@ Reduction JSBuiltinReducer::Reduce(Node* node) {
// Dispatch according to the BuiltinFunctionId if present.
if (!r.HasBuiltinFunctionId()) return NoChange();
switch (r.GetBuiltinFunctionId()) {
- case kMathAbs:
- return ReplaceWithPureReduction(node, ReduceMathAbs(node));
- case kMathSqrt:
- return ReplaceWithPureReduction(node, ReduceMathSqrt(node));
case kMathMax:
return ReplaceWithPureReduction(node, ReduceMathMax(node));
case kMathImul:
« no previous file with comments | « src/compiler/js-builtin-reducer.h ('k') | src/compiler/js-intrinsic-lowering.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698