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

Unified Diff: src/compiler/effect-control-linearizer.cc

Issue 2082993002: [turbofan] Address the useless overflow bit materialization. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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/effect-control-linearizer.h ('k') | src/compiler/int64-lowering.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/effect-control-linearizer.cc
diff --git a/src/compiler/effect-control-linearizer.cc b/src/compiler/effect-control-linearizer.cc
index 44f428d17531d8faa6b3c4c2eca8e40ccf75ca0a..b7f6b129e548340287492e13cb0d3c47a9a74f66 100644
--- a/src/compiler/effect-control-linearizer.cc
+++ b/src/compiler/effect-control-linearizer.cc
@@ -440,6 +440,12 @@ bool EffectControlLinearizer::TryWireInStateEffect(Node* node,
case IrOpcode::kCheckTaggedSigned:
state = LowerCheckTaggedSigned(node, frame_state, *effect, *control);
break;
+ case IrOpcode::kCheckedInt32Add:
+ state = LowerCheckedInt32Add(node, frame_state, *effect, *control);
+ break;
+ case IrOpcode::kCheckedInt32Sub:
+ state = LowerCheckedInt32Sub(node, frame_state, *effect, *control);
+ break;
case IrOpcode::kCheckedUint32ToInt32:
state = LowerCheckedUint32ToInt32(node, frame_state, *effect, *control);
break;
@@ -476,9 +482,6 @@ bool EffectControlLinearizer::TryWireInStateEffect(Node* node,
case IrOpcode::kStringFromCharCode:
state = LowerStringFromCharCode(node, *effect, *control);
break;
- case IrOpcode::kCheckIf:
- state = LowerCheckIf(node, frame_state, *effect, *control);
- break;
case IrOpcode::kCheckFloat64Hole:
state = LowerCheckFloat64Hole(node, frame_state, *effect, *control);
break;
@@ -554,10 +557,11 @@ EffectControlLinearizer::LowerChangeFloat64ToTagged(Node* node, Node* effect,
if (machine()->Is64()) {
vsmi = ChangeInt32ToSmi(value32);
} else {
- Node* smi_tag =
- graph()->NewNode(machine()->Int32AddWithOverflow(), value32, value32);
+ Node* smi_tag = graph()->NewNode(machine()->Int32AddWithOverflow(), value32,
+ value32, if_smi);
- Node* check_ovf = graph()->NewNode(common()->Projection(1), smi_tag);
+ Node* check_ovf =
+ graph()->NewNode(common()->Projection(1), smi_tag, if_smi);
Node* branch_ovf = graph()->NewNode(common()->Branch(BranchHint::kFalse),
check_ovf, if_smi);
@@ -565,7 +569,7 @@ EffectControlLinearizer::LowerChangeFloat64ToTagged(Node* node, Node* effect,
if_box = graph()->NewNode(common()->Merge(2), if_ovf, if_box);
if_smi = graph()->NewNode(common()->IfFalse(), branch_ovf);
- vsmi = graph()->NewNode(common()->Projection(0), smi_tag);
+ vsmi = graph()->NewNode(common()->Projection(0), smi_tag, if_smi);
}
// Allocate the box for the {value}.
@@ -617,9 +621,10 @@ EffectControlLinearizer::LowerChangeInt32ToTagged(Node* node, Node* effect,
return ValueEffectControl(ChangeInt32ToSmi(value), effect, control);
}
- Node* add = graph()->NewNode(machine()->Int32AddWithOverflow(), value, value);
+ Node* add = graph()->NewNode(machine()->Int32AddWithOverflow(), value, value,
+ control);
- Node* ovf = graph()->NewNode(common()->Projection(1), add);
+ Node* ovf = graph()->NewNode(common()->Projection(1), add, control);
Node* branch =
graph()->NewNode(common()->Branch(BranchHint::kFalse), ovf, control);
@@ -628,7 +633,7 @@ EffectControlLinearizer::LowerChangeInt32ToTagged(Node* node, Node* effect,
AllocateHeapNumberWithValue(ChangeInt32ToFloat64(value), effect, if_true);
Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
- Node* vfalse = graph()->NewNode(common()->Projection(0), add);
+ Node* vfalse = graph()->NewNode(common()->Projection(0), add, if_false);
Node* merge = graph()->NewNode(common()->Merge(2), alloc.control, if_false);
Node* phi = graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2),
@@ -835,6 +840,48 @@ EffectControlLinearizer::LowerCheckTaggedSigned(Node* node, Node* frame_state,
}
EffectControlLinearizer::ValueEffectControl
+EffectControlLinearizer::LowerCheckedInt32Add(Node* node, Node* frame_state,
+ Node* effect, Node* control) {
+ Node* lhs = node->InputAt(0);
+ Node* rhs = node->InputAt(1);
+
+ Node* value =
+ graph()->NewNode(machine()->Int32AddWithOverflow(), lhs, rhs, control);
+
+ Node* check = graph()->NewNode(common()->Projection(1), value, control);
+ control = effect = graph()->NewNode(common()->DeoptimizeIf(), check,
+ frame_state, effect, control);
+
+ value = graph()->NewNode(common()->Projection(0), value, control);
+
+ // Make sure the lowered node does not appear in any use lists.
+ node->TrimInputCount(0);
+
+ return ValueEffectControl(value, effect, control);
+}
+
+EffectControlLinearizer::ValueEffectControl
+EffectControlLinearizer::LowerCheckedInt32Sub(Node* node, Node* frame_state,
+ Node* effect, Node* control) {
+ Node* lhs = node->InputAt(0);
+ Node* rhs = node->InputAt(1);
+
+ Node* value =
+ graph()->NewNode(machine()->Int32SubWithOverflow(), lhs, rhs, control);
+
+ Node* check = graph()->NewNode(common()->Projection(1), value, control);
+ control = effect = graph()->NewNode(common()->DeoptimizeIf(), check,
+ frame_state, effect, control);
+
+ value = graph()->NewNode(common()->Projection(0), value, control);
+
+ // Make sure the lowered node does not appear in any use lists.
+ node->TrimInputCount(0);
+
+ return ValueEffectControl(value, effect, control);
+}
+
+EffectControlLinearizer::ValueEffectControl
EffectControlLinearizer::LowerCheckedUint32ToInt32(Node* node,
Node* frame_state,
Node* effect,
@@ -1372,17 +1419,6 @@ EffectControlLinearizer::LowerStringFromCharCode(Node* node, Node* effect,
}
EffectControlLinearizer::ValueEffectControl
-EffectControlLinearizer::LowerCheckIf(Node* node, Node* frame_state,
- Node* effect, Node* control) {
- NodeProperties::ReplaceEffectInput(node, effect);
- NodeProperties::ReplaceControlInput(node, control);
- DCHECK_NOT_NULL(frame_state);
- node->InsertInput(graph()->zone(), 1, frame_state);
- NodeProperties::ChangeOp(node, common()->DeoptimizeIf());
- return ValueEffectControl(node, node, node);
-}
-
-EffectControlLinearizer::ValueEffectControl
EffectControlLinearizer::LowerCheckFloat64Hole(Node* node, Node* frame_state,
Node* effect, Node* control) {
// If we reach this point w/o eliminating the {node} that's marked
« no previous file with comments | « src/compiler/effect-control-linearizer.h ('k') | src/compiler/int64-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698