Commit 3b5293ae authored by Manos Koukoutos's avatar Manos Koukoutos Committed by V8 LUCI CQ

[turbofan] Impose uniqueness of parameters in verifier

This is required by the register allocator.

Bug: v8:11796

Change-Id: I714576fdd89487b88e5c412fe0d2981eb39210d8
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2756538Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
Commit-Queue: Manos Koukoutos <manoskouk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#74725}
parent 99d76752
...@@ -251,13 +251,26 @@ void Verifier::Visitor::Check(Node* node, const AllNodes& all) { ...@@ -251,13 +251,26 @@ void Verifier::Visitor::Check(Node* node, const AllNodes& all) {
} }
switch (node->opcode()) { switch (node->opcode()) {
case IrOpcode::kStart: case IrOpcode::kStart: {
// Start has no inputs. // Start has no inputs.
CHECK_EQ(0, input_count); CHECK_EQ(0, input_count);
// Type is a tuple. // Type is a tuple.
// TODO(rossberg): Multiple outputs are currently typed as Internal. // TODO(rossberg): Multiple outputs are currently typed as Internal.
CheckTypeIs(node, Type::Internal()); CheckTypeIs(node, Type::Internal());
// Check that parameters are unique. We need this because the register
// allocator gets confused when there are two identical parameters which
// are both hard-assigned to the same register (such as the instance
// parameter in wasm).
std::unordered_set<int> param_indices;
for (Node* use : node->uses()) {
if (all.IsLive(use) && use->opcode() == IrOpcode::kParameter) {
int index = ParameterIndexOf(use->op());
CHECK_EQ(param_indices.count(index), 0);
param_indices.insert(index);
}
}
break; break;
}
case IrOpcode::kEnd: case IrOpcode::kEnd:
// End has no outputs. // End has no outputs.
CHECK_EQ(0, node->op()->ValueOutputCount()); CHECK_EQ(0, node->op()->ValueOutputCount());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment