[maglev] Fix deopt vs translation index

Correct use the lazy deopt's deopt index in safepoints, instead of the
index in the translation array.

Bug: v8:7700
Change-Id: I4a99ceb8bb54f2fba5bee0e6ddd6629b44439ce1
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3605609
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Auto-Submit: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: Victor Gomes <victorgomes@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80157}
This commit is contained in:
Leszek Swirski 2022-04-25 17:57:21 +02:00 committed by V8 LUCI CQ
parent 07ec534d29
commit 65d29d321b
2 changed files with 12 additions and 8 deletions

View File

@ -361,6 +361,8 @@ class MaglevCodeGeneratorImpl final {
USE(optimized_out_constant_index);
DCHECK_EQ(kOptimizedOutConstantIndex, optimized_out_constant_index);
int deopt_index = 0;
__ RecordComment("-- Non-lazy deopts");
for (EagerDeoptInfo* deopt_info : code_gen_state_.eager_deopts()) {
EmitEagerDeopt(deopt_info);
@ -369,6 +371,7 @@ class MaglevCodeGeneratorImpl final {
__ CallForDeoptimization(Builtin::kDeoptimizationEntry_Eager, 0,
&deopt_info->deopt_entry_label,
DeoptimizeKind::kEager, nullptr, nullptr);
deopt_index++;
}
__ RecordComment("-- Lazy deopts");
@ -385,7 +388,8 @@ class MaglevCodeGeneratorImpl final {
safepoint_table_builder_.UpdateDeoptimizationInfo(
deopt_info->deopting_call_return_pc,
deopt_info->deopt_entry_label.pos(), last_updated_safepoint,
deopt_info->deopt_index);
deopt_index);
deopt_index++;
}
}
@ -416,7 +420,7 @@ class MaglevCodeGeneratorImpl final {
int frame_count = 1 + deopt_info->unit.inlining_depth();
int jsframe_count = frame_count;
int update_feedback_count = 0;
deopt_info->deopt_index = translation_array_builder_.BeginTranslation(
deopt_info->translation_index = translation_array_builder_.BeginTranslation(
frame_count, jsframe_count, update_feedback_count);
EmitDeoptFrame(deopt_info->unit, deopt_info->state,
@ -431,7 +435,7 @@ class MaglevCodeGeneratorImpl final {
int frame_count = 1;
int jsframe_count = 1;
int update_feedback_count = 0;
deopt_info->deopt_index = translation_array_builder_.BeginTranslation(
deopt_info->translation_index = translation_array_builder_.BeginTranslation(
frame_count, jsframe_count, update_feedback_count);
// Return offsets are counted from the end of the translation frame, which
@ -675,9 +679,9 @@ class MaglevCodeGeneratorImpl final {
// Populate deoptimization entries.
int i = 0;
for (EagerDeoptInfo* deopt_info : code_gen_state_.eager_deopts()) {
DCHECK_NE(deopt_info->deopt_index, -1);
DCHECK_NE(deopt_info->translation_index, -1);
data->SetBytecodeOffset(i, deopt_info->state.bytecode_position);
data->SetTranslationIndex(i, Smi::FromInt(deopt_info->deopt_index));
data->SetTranslationIndex(i, Smi::FromInt(deopt_info->translation_index));
data->SetPc(i, Smi::FromInt(deopt_info->deopt_entry_label.pos()));
#ifdef DEBUG
data->SetNodeId(i, Smi::FromInt(i));
@ -685,9 +689,9 @@ class MaglevCodeGeneratorImpl final {
i++;
}
for (LazyDeoptInfo* deopt_info : code_gen_state_.lazy_deopts()) {
DCHECK_NE(deopt_info->deopt_index, -1);
DCHECK_NE(deopt_info->translation_index, -1);
data->SetBytecodeOffset(i, deopt_info->state.bytecode_position);
data->SetTranslationIndex(i, Smi::FromInt(deopt_info->deopt_index));
data->SetTranslationIndex(i, Smi::FromInt(deopt_info->translation_index));
data->SetPc(i, Smi::FromInt(deopt_info->deopt_entry_label.pos()));
#ifdef DEBUG
data->SetNodeId(i, Smi::FromInt(i));

View File

@ -358,7 +358,7 @@ class DeoptInfo {
CheckpointedInterpreterState state;
InputLocation* input_locations = nullptr;
Label deopt_entry_label;
int deopt_index = -1;
int translation_index = -1;
};
class EagerDeoptInfo : public DeoptInfo {