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

Unified Diff: src/compiler/common-operator-reducer.cc

Issue 1072353002: [turbofan] Optimize silent hole checks on legacy const context slots. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address comment. Created 5 years, 8 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/ast-graph-builder.cc ('k') | test/mjsunit/asm/pointer-masking.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/common-operator-reducer.cc
diff --git a/src/compiler/common-operator-reducer.cc b/src/compiler/common-operator-reducer.cc
index 8001961d37215c8b57ddaac7ea0ebbc5e6a38d7a..2ade817c234b1b3a564a27d080bcd8a446bdcdff 100644
--- a/src/compiler/common-operator-reducer.cc
+++ b/src/compiler/common-operator-reducer.cc
@@ -109,40 +109,51 @@ Reduction CommonOperatorReducer::ReduceSelect(Node* node) {
Node* vtrue = NodeProperties::GetValueInput(node, 1);
Node* vfalse = NodeProperties::GetValueInput(node, 2);
if (vtrue == vfalse) return Replace(vtrue);
- if (cond->opcode() == IrOpcode::kFloat32LessThan) {
- Float32BinopMatcher mcond(cond);
- if (mcond.left().Is(0.0) && mcond.right().Equals(vtrue) &&
- vfalse->opcode() == IrOpcode::kFloat32Sub &&
- machine()->HasFloat32Abs()) {
- Float32BinopMatcher mvfalse(vfalse);
- if (mvfalse.left().IsZero() && mvfalse.right().Equals(vtrue)) {
- return Change(node, machine()->Float32Abs(), vtrue);
- }
- }
- if (mcond.left().Equals(vtrue) && mcond.right().Equals(vfalse) &&
- machine()->HasFloat32Min()) {
- return Change(node, machine()->Float32Min(), vtrue, vfalse);
- } else if (mcond.left().Equals(vfalse) && mcond.right().Equals(vtrue) &&
- machine()->HasFloat32Max()) {
- return Change(node, machine()->Float32Max(), vtrue, vfalse);
+ switch (cond->opcode()) {
+ case IrOpcode::kHeapConstant: {
+ HeapObjectMatcher<HeapObject> mcond(cond);
+ return Replace(mcond.Value().handle()->BooleanValue() ? vtrue : vfalse);
}
- } else if (cond->opcode() == IrOpcode::kFloat64LessThan) {
- Float64BinopMatcher mcond(cond);
- if (mcond.left().Is(0.0) && mcond.right().Equals(vtrue) &&
- vfalse->opcode() == IrOpcode::kFloat64Sub &&
- machine()->HasFloat64Abs()) {
- Float64BinopMatcher mvfalse(vfalse);
- if (mvfalse.left().IsZero() && mvfalse.right().Equals(vtrue)) {
- return Change(node, machine()->Float64Abs(), vtrue);
+ case IrOpcode::kFloat32LessThan: {
+ Float32BinopMatcher mcond(cond);
+ if (mcond.left().Is(0.0) && mcond.right().Equals(vtrue) &&
+ vfalse->opcode() == IrOpcode::kFloat32Sub &&
+ machine()->HasFloat32Abs()) {
+ Float32BinopMatcher mvfalse(vfalse);
+ if (mvfalse.left().IsZero() && mvfalse.right().Equals(vtrue)) {
+ return Change(node, machine()->Float32Abs(), vtrue);
+ }
}
+ if (mcond.left().Equals(vtrue) && mcond.right().Equals(vfalse) &&
+ machine()->HasFloat32Min()) {
+ return Change(node, machine()->Float32Min(), vtrue, vfalse);
+ } else if (mcond.left().Equals(vfalse) && mcond.right().Equals(vtrue) &&
+ machine()->HasFloat32Max()) {
+ return Change(node, machine()->Float32Max(), vtrue, vfalse);
+ }
+ break;
}
- if (mcond.left().Equals(vtrue) && mcond.right().Equals(vfalse) &&
- machine()->HasFloat64Min()) {
- return Change(node, machine()->Float64Min(), vtrue, vfalse);
- } else if (mcond.left().Equals(vfalse) && mcond.right().Equals(vtrue) &&
- machine()->HasFloat64Max()) {
- return Change(node, machine()->Float64Max(), vtrue, vfalse);
+ case IrOpcode::kFloat64LessThan: {
+ Float64BinopMatcher mcond(cond);
+ if (mcond.left().Is(0.0) && mcond.right().Equals(vtrue) &&
+ vfalse->opcode() == IrOpcode::kFloat64Sub &&
+ machine()->HasFloat64Abs()) {
+ Float64BinopMatcher mvfalse(vfalse);
+ if (mvfalse.left().IsZero() && mvfalse.right().Equals(vtrue)) {
+ return Change(node, machine()->Float64Abs(), vtrue);
+ }
+ }
+ if (mcond.left().Equals(vtrue) && mcond.right().Equals(vfalse) &&
+ machine()->HasFloat64Min()) {
+ return Change(node, machine()->Float64Min(), vtrue, vfalse);
+ } else if (mcond.left().Equals(vfalse) && mcond.right().Equals(vtrue) &&
+ machine()->HasFloat64Max()) {
+ return Change(node, machine()->Float64Max(), vtrue, vfalse);
+ }
+ break;
}
+ default:
+ break;
}
return NoChange();
}
« no previous file with comments | « src/compiler/ast-graph-builder.cc ('k') | test/mjsunit/asm/pointer-masking.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698