Commit 11d4b5e5 authored by Leszek Swirski's avatar Leszek Swirski Committed by V8 LUCI CQ

[maglev] Consistently increment input_location for lazy deopt

The DeepForEachInput helper was not incrementing the input_location
index in the IsResultRegister case, while other paths (graph printing,
code gen) were. Change these to consistently only increment the index
when the input is used (i.e. match DeepForEachInput).

Bug: v8:7700
Change-Id: Iaa54ef4e44db54023e3c19a088d14ad204bb2620
Fixed: chromium:1360800
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3905722
Auto-Submit: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: 's avatarJakob Linke <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/main@{#83355}
parent 831ef4e6
......@@ -233,14 +233,13 @@ class TranslationArrayProcessor {
}
private:
const InputLocation* EmitDeoptFrame(const MaglevCompilationUnit& unit,
const CheckpointedInterpreterState& state,
const InputLocation* input_locations) {
void EmitDeoptFrame(const MaglevCompilationUnit& unit,
const CheckpointedInterpreterState& state,
const InputLocation* input_locations) {
if (state.parent) {
// Deopt input locations are in the order of deopt frame emission, so
// update the pointer after emitting the parent frame.
input_locations =
EmitDeoptFrame(*unit.caller(), *state.parent, input_locations);
EmitDeoptFrame(*unit.caller(), *state.parent, input_locations);
}
// Returns are used for updating an accumulator or register after a lazy
......@@ -252,9 +251,8 @@ class TranslationArrayProcessor {
GetDeoptLiteral(*unit.shared_function_info().object()),
unit.register_count(), return_offset, return_count);
return EmitDeoptFrameValues(unit, state.register_frame, input_locations,
interpreter::Register::invalid_value(),
return_count);
EmitDeoptFrameValues(unit, state.register_frame, input_locations,
interpreter::Register::invalid_value(), return_count);
}
void EmitEagerDeopt(EagerDeoptInfo* deopt_info) {
......@@ -283,8 +281,8 @@ class TranslationArrayProcessor {
if (deopt_info->state.parent) {
// Deopt input locations are in the order of deopt frame emission, so
// update the pointer after emitting the parent frame.
input_locations = EmitDeoptFrame(
*unit.caller(), *deopt_info->state.parent, input_locations);
EmitDeoptFrame(*unit.caller(), *deopt_info->state.parent,
input_locations);
}
// Return offsets are counted from the end of the translation frame, which
......@@ -400,10 +398,10 @@ class TranslationArrayProcessor {
result_location.index() + result_size - 1);
}
const InputLocation* EmitDeoptFrameValues(
void EmitDeoptFrameValues(
const MaglevCompilationUnit& compilation_unit,
const CompactInterpreterFrameState* checkpoint_state,
const InputLocation* input_locations,
const InputLocation*& input_location,
interpreter::Register result_location, int result_size) {
// Closure
if (compilation_unit.inlining_depth() == 0) {
......@@ -418,7 +416,6 @@ class TranslationArrayProcessor {
// TODO(leszeks): The input locations array happens to be in the same order
// as parameters+context+locals+accumulator are accessed here. We should
// make this clearer and guard against this invariant failing.
const InputLocation* input_location = input_locations;
// Parameters
{
......@@ -430,9 +427,9 @@ class TranslationArrayProcessor {
translation_array_builder().StoreOptimizedOut();
} else {
EmitDeoptFrameSingleValue(value, *input_location);
input_location++;
}
i++;
input_location++;
});
}
......@@ -447,18 +444,15 @@ class TranslationArrayProcessor {
checkpoint_state->ForEachLocal(
compilation_unit, [&](ValueNode* value, interpreter::Register reg) {
DCHECK_LE(i, reg.index());
if (InReturnValues(reg, result_location, result_size)) {
input_location++;
return;
}
if (InReturnValues(reg, result_location, result_size)) return;
while (i < reg.index()) {
translation_array_builder().StoreOptimizedOut();
i++;
}
DCHECK_EQ(i, reg.index());
EmitDeoptFrameSingleValue(value, *input_location);
i++;
input_location++;
i++;
});
while (i < compilation_unit.register_count()) {
translation_array_builder().StoreOptimizedOut();
......@@ -473,12 +467,11 @@ class TranslationArrayProcessor {
result_location, result_size)) {
ValueNode* value = checkpoint_state->accumulator(compilation_unit);
EmitDeoptFrameSingleValue(value, *input_location);
input_location++;
} else {
translation_array_builder().StoreOptimizedOut();
}
}
return input_location;
}
int GetDeoptLiteral(Object obj) {
......
......@@ -429,8 +429,8 @@ void PrintLazyDeopt(std::ostream& os, std::vector<BasicBlock*> targets,
} else {
os << PrintNodeLabel(graph_labeller, node) << ":"
<< deopt_info->input_locations[index].operand();
index++;
}
index++;
});
os << "}\n";
}
......
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