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 704463004: [turbofan] Turn various diamonds into selects. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix cctest. Created 6 years, 1 month 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/change-lowering.cc ('k') | src/compiler/machine-operator-reducer.cc » ('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 b363d3ddb6f51a94ce3fc888356cc4fe0536a5dc..28580a1a3d912f3bd733d0580755d44a8d4708e3 100644
--- a/src/compiler/js-builtin-reducer.cc
+++ b/src/compiler/js-builtin-reducer.cc
@@ -105,12 +105,12 @@ Reduction JSBuiltinReducer::ReduceMathAbs(Node* node) {
}
if (r.InputsMatchOne(Type::Number())) {
// Math.abs(a:number) -> (a > 0 ? a : 0 - a)
- Node* value = r.left();
- Node* zero = jsgraph()->ZeroConstant();
- Node* cmp = graph()->NewNode(simplified()->NumberLessThan(), zero, value);
- Diamond d(graph(), common(), cmp);
- Node* neg = graph()->NewNode(simplified()->NumberSubtract(), zero, value);
- return Replace(d.Phi(kMachNone, value, neg));
+ 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();
}
@@ -143,10 +143,11 @@ Reduction JSBuiltinReducer::ReduceMathMax(Node* node) {
// Math.max(a:int32, b:int32, ...)
Node* value = r.GetJSCallInput(0);
for (int i = 1; i < r.GetJSCallArity(); i++) {
- Node* p = r.GetJSCallInput(i);
- Node* cmp = graph()->NewNode(simplified()->NumberLessThan(), value, p);
- Diamond d(graph(), common(), cmp);
- value = d.Phi(kMachNone, p, value);
+ Node* const input = r.GetJSCallInput(i);
+ value = graph()->NewNode(
+ common()->Select(kMachNone),
+ graph()->NewNode(simplified()->NumberLessThan(), input, value), input,
+ value);
}
return Replace(value);
}
« no previous file with comments | « src/compiler/change-lowering.cc ('k') | src/compiler/machine-operator-reducer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698