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

Unified Diff: src/compiler/simplified-lowering.cc

Issue 2222513002: [turbofan] Insert sigma nodes for loop variable backedge. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 4 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
Index: src/compiler/simplified-lowering.cc
diff --git a/src/compiler/simplified-lowering.cc b/src/compiler/simplified-lowering.cc
index 093b09ecc0f711bd466af097dc88750097a1431f..b65e29242c45d56a38c8abc44d28afb63b34759d 100644
--- a/src/compiler/simplified-lowering.cc
+++ b/src/compiler/simplified-lowering.cc
@@ -424,6 +424,12 @@ class RepresentationSelector {
break;
}
+ case IrOpcode::kSigma: {
+ new_type =
+ op_typer_.TypeSigma(node->op(), FeedbackTypeOf(node->InputAt(0)));
+ break;
+ }
+
case IrOpcode::kSelect: {
new_type = TypeSelect(node);
break;
@@ -811,9 +817,12 @@ class RepresentationSelector {
}
// Infer representation for phi-like nodes.
- MachineRepresentation GetOutputInfoForPhi(Node* node, Truncation use) {
+ // The {node} parameter is only used to decide on the int64 representation.
+ // Once the type system supports an external pointer type, the {node}
+ // parameter can be removed.
+ MachineRepresentation GetOutputInfoForPhi(Node* node, Type* type,
+ Truncation use) {
// Compute the representation.
- Type* type = TypeOf(node);
if (type->Is(Type::None())) {
return MachineRepresentation::kNone;
} else if (type->Is(Type::Signed32()) || type->Is(Type::Unsigned32())) {
@@ -860,7 +869,8 @@ class RepresentationSelector {
SimplifiedLowering* lowering) {
ProcessInput(node, 0, UseInfo::Bool());
- MachineRepresentation output = GetOutputInfoForPhi(node, truncation);
+ MachineRepresentation output =
+ GetOutputInfoForPhi(node, TypeOf(node), truncation);
SetOutput(node, output);
if (lower()) {
@@ -881,7 +891,8 @@ class RepresentationSelector {
// Helper for handling phis.
void VisitPhi(Node* node, Truncation truncation,
SimplifiedLowering* lowering) {
- MachineRepresentation output = GetOutputInfoForPhi(node, truncation);
+ MachineRepresentation output =
+ GetOutputInfoForPhi(node, TypeOf(node), truncation);
// Only set the output representation if not running with type
// feedback. (Feedback typing will set the representation.)
SetOutput(node, output);
@@ -895,7 +906,7 @@ class RepresentationSelector {
}
// Convert inputs to the output representation of this phi, pass the
- // truncation truncation along.
+ // truncation along.
UseInfo input_use(output, truncation);
for (int i = 0; i < node->InputCount(); i++) {
ProcessInput(node, i, i < values ? input_use : UseInfo::None());
@@ -2444,6 +2455,20 @@ class RepresentationSelector {
return VisitLeaf(node, MachineType::PointerRepresentation());
case IrOpcode::kStateValues:
return VisitStateValues(node);
+ case IrOpcode::kSigma: {
+ // We just get rid of the sigma here. In principle, it should be
+ // possible to refine the truncation and representation based on
+ // the sigma's type.
+ MachineRepresentation output =
+ GetOutputInfoForPhi(node, TypeOf(node->InputAt(0)), truncation);
+
+ ProcessInput(node, 0, UseInfo(output, truncation));
+ ProcessInput(node, 1, UseInfo::None());
Benedikt Meurer 2016/08/05 12:54:20 Nit: You could use VisitUnop here.
+
+ SetOutput(node, output);
+ if (lower()) DeferReplacement(node, node->InputAt(0));
+ return;
+ }
// The following opcodes are not produced before representation
// inference runs, so we do not have any real test coverage.
@@ -2486,8 +2511,6 @@ class RepresentationSelector {
Node* control = NodeProperties::GetControlInput(node);
Node* effect = NodeProperties::GetEffectInput(node);
ReplaceEffectControlUses(node, effect, control);
- } else {
- DCHECK_EQ(0, node->op()->ControlInputCount());
}
replacements_.push_back(node);

Powered by Google App Engine
This is Rietveld 408576698