[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/+/2756538
Reviewed-by: Georg Neis <neis@chromium.org>
Commit-Queue: Manos Koukoutos <manoskouk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#74725}
This commit is contained in:
Manos Koukoutos 2021-05-21 15:29:11 +00:00 committed by V8 LUCI CQ
parent 99d7675279
commit 3b5293aea7

View File

@ -251,13 +251,26 @@ void Verifier::Visitor::Check(Node* node, const AllNodes& all) {
}
switch (node->opcode()) {
case IrOpcode::kStart:
case IrOpcode::kStart: {
// Start has no inputs.
CHECK_EQ(0, input_count);
// Type is a tuple.
// TODO(rossberg): Multiple outputs are currently typed as 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;
}
case IrOpcode::kEnd:
// End has no outputs.
CHECK_EQ(0, node->op()->ValueOutputCount());