Commit aa04a967 authored by Ng Zhi An's avatar Ng Zhi An Committed by V8 LUCI CQ

[diagnostics] Fix incorrect check for MIN_CONTEXT_SLOTS

MIN_CONTEXT_SLOTS is set to be equals to EXTENSION_INDEX, which is 2,
see
https://source.chromium.org/chromium/chromium/src/+/main:v8/src/objects/contexts.h;l=519;drc=bb32a2dd632d7350dfb722c9b4ffe4d6e3633225
We check for the scope's ContextHeaderLength instead, and handle
both cases where there is an extension slot or not.

Change-Id: I0fe46cb49bfcd4b8321f777d47e375e0fd204d00
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3085626
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Reviewed-by: 's avatarVictor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#76237}
parent 34916c4a
...@@ -1092,7 +1092,7 @@ class DebugInfoSection : public DebugSection { ...@@ -1092,7 +1092,7 @@ class DebugInfoSection : public DebugSection {
int params = scope.ParameterCount(); int params = scope.ParameterCount();
int context_slots = scope.ContextLocalCount(); int context_slots = scope.ContextLocalCount();
// The real slot ID is internal_slots + context_slot_id. // The real slot ID is internal_slots + context_slot_id.
int internal_slots = Context::MIN_CONTEXT_SLOTS; int internal_slots = scope.ContextHeaderLength();
int current_abbreviation = 4; int current_abbreviation = 4;
for (int param = 0; param < params; ++param) { for (int param = 0; param < params; ++param) {
...@@ -1109,7 +1109,7 @@ class DebugInfoSection : public DebugSection { ...@@ -1109,7 +1109,7 @@ class DebugInfoSection : public DebugSection {
} }
// See contexts.h for more information. // See contexts.h for more information.
DCHECK_EQ(Context::MIN_CONTEXT_SLOTS, 3); DCHECK(internal_slots == 2 || internal_slots == 3);
DCHECK_EQ(Context::SCOPE_INFO_INDEX, 0); DCHECK_EQ(Context::SCOPE_INFO_INDEX, 0);
DCHECK_EQ(Context::PREVIOUS_INDEX, 1); DCHECK_EQ(Context::PREVIOUS_INDEX, 1);
DCHECK_EQ(Context::EXTENSION_INDEX, 2); DCHECK_EQ(Context::EXTENSION_INDEX, 2);
...@@ -1117,8 +1117,10 @@ class DebugInfoSection : public DebugSection { ...@@ -1117,8 +1117,10 @@ class DebugInfoSection : public DebugSection {
w->WriteString(".scope_info"); w->WriteString(".scope_info");
w->WriteULEB128(current_abbreviation++); w->WriteULEB128(current_abbreviation++);
w->WriteString(".previous"); w->WriteString(".previous");
if (internal_slots == 3) {
w->WriteULEB128(current_abbreviation++); w->WriteULEB128(current_abbreviation++);
w->WriteString(".extension"); w->WriteString(".extension");
}
for (int context_slot = 0; context_slot < context_slots; ++context_slot) { for (int context_slot = 0; context_slot < context_slots; ++context_slot) {
w->WriteULEB128(current_abbreviation++); w->WriteULEB128(current_abbreviation++);
......
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