Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(334)

Unified Diff: src/ast/scopeinfo.cc

Issue 2460233003: [modules] Assign cell indices at validation time. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/ast/scopeinfo.cc
diff --git a/src/ast/scopeinfo.cc b/src/ast/scopeinfo.cc
index c4e43077afd4813f5e734b8fdfa4a2945e05874b..667c069a20b817d981032a7c193889047e53933a 100644
--- a/src/ast/scopeinfo.cc
+++ b/src/ast/scopeinfo.cc
@@ -654,7 +654,7 @@ int ScopeInfo::ModuleIndex(Handle<String> name, VariableMode* mode,
entry += kModuleVariableEntryLength;
}
- return -1;
+ return 0;
}
int ScopeInfo::ContextSlotIndex(Handle<ScopeInfo> scope_info,
@@ -806,6 +806,7 @@ void ScopeInfo::ModuleVariable(int i, String** name, int* index,
}
if (index != nullptr) {
*index = Smi::cast(get(entry + kModuleVariableIndexOffset))->value();
+ DCHECK_NE(*index, 0);
}
if (mode != nullptr) {
*mode = VariableModeField::decode(properties);
@@ -867,13 +868,14 @@ Handle<ModuleInfoEntry> ModuleInfoEntry::New(Isolate* isolate,
Handle<Object> export_name,
Handle<Object> local_name,
Handle<Object> import_name,
- Handle<Object> module_request,
+ int module_request, int cell_index,
int beg_pos, int end_pos) {
Handle<ModuleInfoEntry> result = isolate->factory()->NewModuleInfoEntry();
result->set(kExportNameIndex, *export_name);
result->set(kLocalNameIndex, *local_name);
result->set(kImportNameIndex, *import_name);
- result->set(kModuleRequestIndex, *module_request);
+ result->set(kModuleRequestIndex, Smi::FromInt(module_request));
+ result->set(kCellIndexIndex, Smi::FromInt(cell_index));
result->set(kBegPosIndex, Smi::FromInt(beg_pos));
result->set(kEndPosIndex, Smi::FromInt(end_pos));
return result;

Powered by Google App Engine
This is Rietveld 408576698