Skip to content

Commit de52faf

Browse files
mi-acCommit bot
authored andcommitted
Revert of [modules] Add partial support for debug-scopes. (patchset #1 id:1 of https://codereview.chromium.org/2445683002/ )
Reason for revert: Breaks https://build.chromium.org/p/client.v8/builders/V8%20Mac%20GC%20Stress/builds/9349 Original issue's description: > [modules] Add partial support for debug-scopes. > > Setting variables is not yet implemented.. > > R=adamk@chromium.org > BUG=v8:1569 TBR=adamk@chromium.org,yangguo@chromium.org,neis@chromium.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=v8:1569 Review-Url: https://codereview.chromium.org/2449883002 Cr-Commit-Position: refs/heads/master@{#40564}
1 parent f97b28f commit de52faf

8 files changed

Lines changed: 15 additions & 1247 deletions

File tree

src/ast/scopeinfo.cc

Lines changed: 6 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -647,8 +647,12 @@ int ScopeInfo::ModuleIndex(Handle<String> name, VariableMode* mode,
647647
int entry = ModuleVariablesIndex();
648648
for (int i = 0; i < module_vars_count; ++i) {
649649
if (*name == get(entry + kModuleVariableNameOffset)) {
650-
int index;
651-
ModuleVariable(i, nullptr, &index, mode, init_flag, maybe_assigned_flag);
650+
int index = Smi::cast(get(entry + kModuleVariableIndexOffset))->value();
651+
int properties =
652+
Smi::cast(get(entry + kModuleVariablePropertiesOffset))->value();
653+
*mode = VariableModeField::decode(properties);
654+
*init_flag = InitFlagField::decode(properties);
655+
*maybe_assigned_flag = MaybeAssignedFlagField::decode(properties);
652656
return index;
653657
}
654658
entry += kModuleVariableEntryLength;
@@ -790,34 +794,6 @@ int ScopeInfo::ModuleVariableCountIndex() { return ModuleInfoIndex() + 1; }
790794

791795
int ScopeInfo::ModuleVariablesIndex() { return ModuleVariableCountIndex() + 1; }
792796

793-
void ScopeInfo::ModuleVariable(int i, String** name, int* index,
794-
VariableMode* mode,
795-
InitializationFlag* init_flag,
796-
MaybeAssignedFlag* maybe_assigned_flag) {
797-
DCHECK_LE(0, i);
798-
DCHECK_LT(i, Smi::cast(get(ModuleVariableCountIndex()))->value());
799-
800-
int entry = ModuleVariablesIndex() + i * kModuleVariableEntryLength;
801-
int properties =
802-
Smi::cast(get(entry + kModuleVariablePropertiesOffset))->value();
803-
804-
if (name != nullptr) {
805-
*name = String::cast(get(entry + kModuleVariableNameOffset));
806-
}
807-
if (index != nullptr) {
808-
*index = Smi::cast(get(entry + kModuleVariableIndexOffset))->value();
809-
}
810-
if (mode != nullptr) {
811-
*mode = VariableModeField::decode(properties);
812-
}
813-
if (init_flag != nullptr) {
814-
*init_flag = InitFlagField::decode(properties);
815-
}
816-
if (maybe_assigned_flag != nullptr) {
817-
*maybe_assigned_flag = MaybeAssignedFlagField::decode(properties);
818-
}
819-
}
820-
821797
#ifdef DEBUG
822798

823799
static void PrintList(const char* list_name,
@@ -928,20 +904,5 @@ Handle<ModuleInfo> ModuleInfo::New(Isolate* isolate, Zone* zone,
928904
return result;
929905
}
930906

931-
Handle<ModuleInfoEntry> ModuleInfo::LookupRegularImport(
932-
Handle<ModuleInfo> info, Handle<String> local_name) {
933-
Isolate* isolate = info->GetIsolate();
934-
Handle<FixedArray> regular_imports(info->regular_imports(), isolate);
935-
for (int i = 0, n = regular_imports->length(); i < n; ++i) {
936-
Handle<ModuleInfoEntry> entry(
937-
ModuleInfoEntry::cast(regular_imports->get(i)), isolate);
938-
if (String::cast(entry->local_name())->Equals(*local_name)) {
939-
return entry;
940-
}
941-
}
942-
UNREACHABLE();
943-
return Handle<ModuleInfoEntry>();
944-
}
945-
946907
} // namespace internal
947908
} // namespace v8

src/contexts.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ Context* Context::declaration_context() {
8282
Context* Context::closure_context() {
8383
Context* current = this;
8484
while (!current->IsFunctionContext() && !current->IsScriptContext() &&
85-
!current->IsModuleContext() && !current->IsNativeContext()) {
85+
!current->IsNativeContext()) {
8686
current = current->previous();
8787
DCHECK(current->closure() == closure());
8888
}

src/debug/debug-scopes.cc

Lines changed: 8 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,6 @@ ScopeIterator::ScopeIterator(Isolate* isolate, FrameInspector* frame_inspector,
101101
// Language mode may be inherited from the eval caller.
102102
// Retrieve it from shared function info.
103103
info->set_language_mode(shared_info->language_mode());
104-
} else if (scope_info->scope_type() == MODULE_SCOPE) {
105-
info->set_module();
106104
} else {
107105
DCHECK(scope_info->scope_type() == SCRIPT_SCOPE);
108106
}
@@ -610,10 +608,17 @@ MaybeHandle<JSObject> ScopeIterator::MaterializeModuleScope() {
610608
Handle<Context> context = CurrentContext();
611609
DCHECK(context->IsModuleContext());
612610
Handle<ScopeInfo> scope_info(context->scope_info());
611+
612+
// Allocate and initialize a JSObject with all the members of the debugged
613+
// module.
613614
Handle<JSObject> module_scope =
614615
isolate_->factory()->NewJSObjectWithNullProto();
616+
617+
// Fill all context locals.
615618
CopyContextLocalsToScopeObject(scope_info, context, module_scope);
616-
CopyModuleVarsToScopeObject(scope_info, context, module_scope);
619+
620+
// TODO(neis): Also collect stack locals as well as imports and exports.
621+
617622
return module_scope;
618623
}
619624

@@ -784,51 +789,6 @@ void ScopeIterator::CopyContextLocalsToScopeObject(
784789
}
785790
}
786791

787-
void ScopeIterator::CopyModuleVarsToScopeObject(Handle<ScopeInfo> scope_info,
788-
Handle<Context> context,
789-
Handle<JSObject> scope_object) {
790-
Isolate* isolate = scope_info->GetIsolate();
791-
792-
int module_variable_count =
793-
Smi::cast(scope_info->get(scope_info->ModuleVariableCountIndex()))
794-
->value();
795-
for (int i = 0; i < module_variable_count; ++i) {
796-
Handle<String> local_name;
797-
bool is_export;
798-
{
799-
String* name;
800-
int index;
801-
scope_info->ModuleVariable(i, &name, &index);
802-
CHECK(!ScopeInfo::VariableIsSynthetic(name));
803-
local_name = handle(name, isolate);
804-
is_export = index == Variable::kModuleExportIndex;
805-
}
806-
807-
Handle<Object> value;
808-
if (is_export) {
809-
value =
810-
Module::LoadExport(handle(context->module(), isolate), local_name);
811-
} else {
812-
Handle<ModuleInfo> module_info(scope_info->ModuleDescriptorInfo(),
813-
isolate);
814-
Handle<ModuleInfoEntry> entry =
815-
ModuleInfo::LookupRegularImport(module_info, local_name);
816-
Handle<String> import_name(String::cast(entry->import_name()), isolate);
817-
int module_request = Smi::cast(entry->module_request())->value();
818-
value = Module::LoadImport(handle(context->module(), isolate),
819-
import_name, module_request);
820-
}
821-
822-
// Reflect variables under TDZ as undefined in scope object.
823-
if (value->IsTheHole(isolate)) continue;
824-
// This should always succeed.
825-
// TODO(verwaest): Use AddDataProperty instead.
826-
JSObject::SetOwnPropertyIgnoreAttributes(scope_object, local_name, value,
827-
NONE)
828-
.Check();
829-
}
830-
}
831-
832792
void ScopeIterator::CopyContextExtensionToScopeObject(
833793
Handle<Context> context, Handle<JSObject> scope_object,
834794
KeyCollectionMode mode) {

src/debug/debug-scopes.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,6 @@ class ScopeIterator {
153153
void CopyContextLocalsToScopeObject(Handle<ScopeInfo> scope_info,
154154
Handle<Context> context,
155155
Handle<JSObject> scope_object);
156-
void CopyModuleVarsToScopeObject(Handle<ScopeInfo> scope_info,
157-
Handle<Context> context,
158-
Handle<JSObject> scope_object);
159156
void CopyContextExtensionToScopeObject(Handle<Context> context,
160157
Handle<JSObject> scope_object,
161158
KeyCollectionMode mode);

src/debug/mirrors.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,6 @@ var ScopeType = { Global: 0,
257257
Block: 5,
258258
Script: 6,
259259
Eval: 7,
260-
Module: 8,
261260
};
262261

263262
/**

src/objects.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4686,14 +4686,6 @@ class ScopeInfo : public FixedArray {
46864686
VariableLocation* location, InitializationFlag* init_flag,
46874687
MaybeAssignedFlag* maybe_assigned_flag);
46884688

4689-
// Get metadata of i-th MODULE-allocated variable, where 0 <= i <
4690-
// ModuleVariableCount. The metadata is returned via out-arguments, which may
4691-
// be nullptr if the corresponding information is not requested
4692-
void ModuleVariable(int i, String** name, int* index,
4693-
VariableMode* mode = nullptr,
4694-
InitializationFlag* init_flag = nullptr,
4695-
MaybeAssignedFlag* maybe_assigned_flag = nullptr);
4696-
46974689
// Used for the function name variable for named function expressions, and for
46984690
// the receiver.
46994691
enum VariableAllocationInfo { NONE, STACK, CONTEXT, UNUSED };
@@ -4761,19 +4753,14 @@ class ModuleInfoEntry : public FixedArray {
47614753
class ModuleInfo : public FixedArray {
47624754
public:
47634755
DECLARE_CAST(ModuleInfo)
4764-
47654756
static Handle<ModuleInfo> New(Isolate* isolate, Zone* zone,
47664757
ModuleDescriptor* descr);
4767-
47684758
inline FixedArray* module_requests() const;
47694759
inline FixedArray* special_exports() const;
47704760
inline FixedArray* regular_exports() const;
47714761
inline FixedArray* namespace_imports() const;
47724762
inline FixedArray* regular_imports() const;
47734763

4774-
static Handle<ModuleInfoEntry> LookupRegularImport(Handle<ModuleInfo> info,
4775-
Handle<String> local_name);
4776-
47774764
#ifdef DEBUG
47784765
inline bool Equals(ModuleInfo* other) const;
47794766
#endif

0 commit comments

Comments
 (0)