Commit 6422aa92 authored by Georg Neis's avatar Georg Neis Committed by Commit Bot

[modules] Make debug-scopes handle synthetic variables

... by skipping over them. Such variables appear in the case of direct
namespace exports and default exports. (Actually, the name used for
default exports used to be "*default*" which is not recognized as
synthetic, so I'm renaming it here to ".default").

Bug: chromium:932111
Change-Id: I0554dae9614334fdc02e78606f2db47e92196429
Reviewed-on: https://chromium-review.googlesource.com/c/1494010
Commit-Queue: Georg Neis <neis@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#60012}
parent 21f75f9a
......@@ -207,6 +207,7 @@ class AstBigInt {
F(default, "default") \
F(done, "done") \
F(dot, ".") \
F(dot_default, ".default") \
F(dot_for, ".for") \
F(dot_generator_object, ".generator_object") \
F(dot_iterator, ".iterator") \
......@@ -236,7 +237,6 @@ class AstBigInt {
F(return, "return") \
F(set, "set") \
F(set_space, "set ") \
F(star_default_star, "*default*") \
F(string, "string") \
F(symbol, "symbol") \
F(target, "target") \
......
......@@ -585,7 +585,7 @@ void ScopeIterator::VisitModuleScope(const Visitor& visitor) const {
{
String raw_name;
scope_info->ModuleVariable(i, &raw_name, &index);
CHECK(!ScopeInfo::VariableIsSynthetic(raw_name));
if (ScopeInfo::VariableIsSynthetic(raw_name)) continue;
name = handle(raw_name, isolate_);
}
Handle<Object> value = Module::LoadVariable(isolate_, module, index);
......
......@@ -137,6 +137,7 @@
V(_, display_name_string, "displayName") \
V(_, done_string, "done") \
V(_, dot_catch_string, ".catch") \
V(_, dot_default_string, ".default") \
V(_, dot_for_string, ".for") \
V(_, dot_generator_object_string, ".generator_object") \
V(_, dot_iterator_string, ".iterator") \
......@@ -258,7 +259,6 @@
V(_, sourceText_string, "sourceText") \
V(_, stack_string, "stack") \
V(_, stackTraceLimit_string, "stackTraceLimit") \
V(_, star_default_star_string, "*default*") \
V(_, sticky_string, "sticky") \
V(_, String_string, "String") \
V(_, string_string, "string") \
......
......@@ -1173,7 +1173,7 @@ Statement* Parser::ParseExportDefault() {
SetFunctionName(value, ast_value_factory()->default_string());
const AstRawString* local_name =
ast_value_factory()->star_default_star_string();
ast_value_factory()->dot_default_string();
local_names.Add(local_name, zone());
// It's fine to declare this as VariableMode::kConst because the user has
......
......@@ -622,11 +622,10 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) {
return arg == nullptr || literal->AsRawString() == arg;
}
V8_INLINE void GetDefaultStrings(
const AstRawString** default_string,
const AstRawString** star_default_star_string) {
V8_INLINE void GetDefaultStrings(const AstRawString** default_string,
const AstRawString** dot_default_string) {
*default_string = ast_value_factory()->default_string();
*star_default_star_string = ast_value_factory()->star_default_star_string();
*dot_default_string = ast_value_factory()->dot_default_string();
}
// Functions for encapsulating the differences between parsing and preparsing;
......
......@@ -1360,7 +1360,7 @@ class PreParser : public ParserBase<PreParser> {
V8_INLINE static void GetDefaultStrings(
PreParserIdentifier* default_string,
PreParserIdentifier* star_default_star_string) {}
PreParserIdentifier* dot_default_string) {}
// Functions for encapsulating the differences between parsing and preparsing;
// operations interleaved with the recursive descent.
......
......@@ -7591,7 +7591,7 @@ TEST(ModuleParsingInternals) {
i::VariableLocation::MODULE);
CHECK(declarations->AtForTest(7)->var()->raw_name()->IsOneByteEqualTo(
"*default*"));
".default"));
CHECK(declarations->AtForTest(7)->var()->mode() == i::VariableMode::kConst);
CHECK(declarations->AtForTest(7)->var()->binding_needs_init());
CHECK(declarations->AtForTest(7)->var()->location() ==
......@@ -7680,7 +7680,7 @@ TEST(ModuleParsingInternals) {
entry = descriptor->regular_exports()
.find(declarations->AtForTest(7)->var()->raw_name())
->second;
CheckEntry(entry, "default", "*default*", nullptr, -1);
CheckEntry(entry, "default", ".default", nullptr, -1);
entry = descriptor->regular_exports()
.find(declarations->AtForTest(12)->var()->raw_name())
->second;
......
......@@ -2,7 +2,7 @@ Tests evaluateOnCallFrame in module.
Running test: testTotal
foo1 (module1:7:2)
foo2 (module2:6:9)
foo2 (module2:7:9)
(anonymous) (module3:4:0)
local:foo1
[
......
......@@ -14,11 +14,14 @@ export function foo1() {
let g1 = 2;
debugger;
return a1 + b1 + c1 + g1;
}`;
};
export default 42;
`;
var module2 = `
import { foo1 } from 'module1';
let a2 = 20;
export * as mod1 from 'module1';
export let b2 = 21;
export function foo2() {
let c2 = 22;
......
......@@ -302,46 +302,46 @@ KNOWN_MAPS = {
("RO_SPACE", 0x026e1): (111, "Tuple2Map"),
("RO_SPACE", 0x02781): (113, "ArrayBoilerplateDescriptionMap"),
("RO_SPACE", 0x02ac1): (100, "InterceptorInfoMap"),
("RO_SPACE", 0x04fe9): (89, "AccessCheckInfoMap"),
("RO_SPACE", 0x05039): (90, "AccessorInfoMap"),
("RO_SPACE", 0x05089): (91, "AccessorPairMap"),
("RO_SPACE", 0x050d9): (92, "AliasedArgumentsEntryMap"),
("RO_SPACE", 0x05129): (93, "AllocationMementoMap"),
("RO_SPACE", 0x05179): (94, "AsmWasmDataMap"),
("RO_SPACE", 0x051c9): (95, "AsyncGeneratorRequestMap"),
("RO_SPACE", 0x05219): (96, "ClassPositionsMap"),
("RO_SPACE", 0x05269): (97, "DebugInfoMap"),
("RO_SPACE", 0x052b9): (98, "FunctionTemplateInfoMap"),
("RO_SPACE", 0x05309): (99, "FunctionTemplateRareDataMap"),
("RO_SPACE", 0x05359): (101, "InterpreterDataMap"),
("RO_SPACE", 0x053a9): (102, "ModuleInfoEntryMap"),
("RO_SPACE", 0x053f9): (103, "ModuleMap"),
("RO_SPACE", 0x05449): (104, "ObjectTemplateInfoMap"),
("RO_SPACE", 0x05499): (105, "PromiseCapabilityMap"),
("RO_SPACE", 0x054e9): (106, "PromiseReactionMap"),
("RO_SPACE", 0x05539): (107, "PrototypeInfoMap"),
("RO_SPACE", 0x05589): (108, "ScriptMap"),
("RO_SPACE", 0x055d9): (109, "StackFrameInfoMap"),
("RO_SPACE", 0x05629): (110, "StackTraceFrameMap"),
("RO_SPACE", 0x05679): (112, "Tuple3Map"),
("RO_SPACE", 0x056c9): (114, "WasmDebugInfoMap"),
("RO_SPACE", 0x05719): (115, "WasmExceptionTagMap"),
("RO_SPACE", 0x05769): (116, "WasmExportedFunctionDataMap"),
("RO_SPACE", 0x057b9): (117, "CallableTaskMap"),
("RO_SPACE", 0x05809): (118, "CallbackTaskMap"),
("RO_SPACE", 0x05859): (119, "PromiseFulfillReactionJobTaskMap"),
("RO_SPACE", 0x058a9): (120, "PromiseRejectReactionJobTaskMap"),
("RO_SPACE", 0x058f9): (121, "PromiseResolveThenableJobTaskMap"),
("RO_SPACE", 0x05949): (122, "FinalizationGroupCleanupJobTaskMap"),
("RO_SPACE", 0x05999): (123, "AllocationSiteWithWeakNextMap"),
("RO_SPACE", 0x059e9): (123, "AllocationSiteWithoutWeakNextMap"),
("RO_SPACE", 0x05a39): (157, "LoadHandler1Map"),
("RO_SPACE", 0x05a89): (157, "LoadHandler2Map"),
("RO_SPACE", 0x05ad9): (157, "LoadHandler3Map"),
("RO_SPACE", 0x05b29): (165, "StoreHandler0Map"),
("RO_SPACE", 0x05b79): (165, "StoreHandler1Map"),
("RO_SPACE", 0x05bc9): (165, "StoreHandler2Map"),
("RO_SPACE", 0x05c19): (165, "StoreHandler3Map"),
("RO_SPACE", 0x04fe1): (89, "AccessCheckInfoMap"),
("RO_SPACE", 0x05031): (90, "AccessorInfoMap"),
("RO_SPACE", 0x05081): (91, "AccessorPairMap"),
("RO_SPACE", 0x050d1): (92, "AliasedArgumentsEntryMap"),
("RO_SPACE", 0x05121): (93, "AllocationMementoMap"),
("RO_SPACE", 0x05171): (94, "AsmWasmDataMap"),
("RO_SPACE", 0x051c1): (95, "AsyncGeneratorRequestMap"),
("RO_SPACE", 0x05211): (96, "ClassPositionsMap"),
("RO_SPACE", 0x05261): (97, "DebugInfoMap"),
("RO_SPACE", 0x052b1): (98, "FunctionTemplateInfoMap"),
("RO_SPACE", 0x05301): (99, "FunctionTemplateRareDataMap"),
("RO_SPACE", 0x05351): (101, "InterpreterDataMap"),
("RO_SPACE", 0x053a1): (102, "ModuleInfoEntryMap"),
("RO_SPACE", 0x053f1): (103, "ModuleMap"),
("RO_SPACE", 0x05441): (104, "ObjectTemplateInfoMap"),
("RO_SPACE", 0x05491): (105, "PromiseCapabilityMap"),
("RO_SPACE", 0x054e1): (106, "PromiseReactionMap"),
("RO_SPACE", 0x05531): (107, "PrototypeInfoMap"),
("RO_SPACE", 0x05581): (108, "ScriptMap"),
("RO_SPACE", 0x055d1): (109, "StackFrameInfoMap"),
("RO_SPACE", 0x05621): (110, "StackTraceFrameMap"),
("RO_SPACE", 0x05671): (112, "Tuple3Map"),
("RO_SPACE", 0x056c1): (114, "WasmDebugInfoMap"),
("RO_SPACE", 0x05711): (115, "WasmExceptionTagMap"),
("RO_SPACE", 0x05761): (116, "WasmExportedFunctionDataMap"),
("RO_SPACE", 0x057b1): (117, "CallableTaskMap"),
("RO_SPACE", 0x05801): (118, "CallbackTaskMap"),
("RO_SPACE", 0x05851): (119, "PromiseFulfillReactionJobTaskMap"),
("RO_SPACE", 0x058a1): (120, "PromiseRejectReactionJobTaskMap"),
("RO_SPACE", 0x058f1): (121, "PromiseResolveThenableJobTaskMap"),
("RO_SPACE", 0x05941): (122, "FinalizationGroupCleanupJobTaskMap"),
("RO_SPACE", 0x05991): (123, "AllocationSiteWithWeakNextMap"),
("RO_SPACE", 0x059e1): (123, "AllocationSiteWithoutWeakNextMap"),
("RO_SPACE", 0x05a31): (157, "LoadHandler1Map"),
("RO_SPACE", 0x05a81): (157, "LoadHandler2Map"),
("RO_SPACE", 0x05ad1): (157, "LoadHandler3Map"),
("RO_SPACE", 0x05b21): (165, "StoreHandler0Map"),
("RO_SPACE", 0x05b71): (165, "StoreHandler1Map"),
("RO_SPACE", 0x05bc1): (165, "StoreHandler2Map"),
("RO_SPACE", 0x05c11): (165, "StoreHandler3Map"),
("MAP_SPACE", 0x00139): (1057, "ExternalMap"),
("MAP_SPACE", 0x00189): (1073, "JSMessageObjectMap"),
}
......
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