Plumb import assertions through SourceTextModuleDescriptor's ModuleRequestMap

This change plumbs import assertions from SourceTextModuleDescriptor's
ModuleRequestMap into SourceTextModuleInfo via a new ModuleRequest
type, where previously there had been only the specifier.

SourceTextModuleDescriptor::module_map now deduplicates module requests
using the specifier and the import assertions.  Continuing to use the
specifier alone would cause a loss of information in the event that
a module imports from the same specifier multiple times using different
sets of assertions.  Failing to deduplicate at all would result in
multiple requests for statements like `import {a,b,c} from "foo.js"`,
which would be a potential performance issue.  See design doc at
https://docs.google.com/document/d/1yuXgNHSbTAPubT1Mg0JXp5uTrfirkvO1g5cHHCe-LmY
for more detail on this decision.

v8::internal::ModuleRequest holds the assertions as an array of the form
[key1, value1, position1, key2, value2, assertion2, ...].  However the
parser still needs to use a map, since duplicate assertion keys need to
be detected at parse time.  A follow-up  change will ensure that
assertions are sorted using a proper lexicographic sort.

Bug: v8:10958
Change-Id: Iff13fb9a37d58fc1622cd3cce78925ad2b7a14bb
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2493060
Commit-Queue: Dan Clark <daniec@microsoft.com>
Reviewed-by: Adam Klein <adamk@chromium.org>
Reviewed-by: Marja Hölttä <marja@chromium.org>
Cr-Commit-Position: refs/heads/master@{#71066}
This commit is contained in:
Daniel Clark 2020-11-09 14:59:00 -08:00 committed by Commit Bot
parent e42e855462
commit ea0ccc7ee3
15 changed files with 728 additions and 218 deletions

View File

@ -2249,7 +2249,9 @@ Local<String> Module::GetModuleRequest(int i) const {
i::Handle<i::SourceTextModule>::cast(self)->info().module_requests(),
isolate);
CHECK_LT(i, module_requests->length());
return ToApiHandle<String>(i::handle(module_requests->get(i), isolate));
i::Handle<i::ModuleRequest> module_request(
i::ModuleRequest::cast(module_requests->get(i)), isolate);
return ToApiHandle<String>(i::handle(module_request->specifier(), isolate));
}
Location Module::GetModuleRequestLocation(int i) const {

View File

@ -16,17 +16,47 @@ namespace internal {
bool SourceTextModuleDescriptor::AstRawStringComparer::operator()(
const AstRawString* lhs, const AstRawString* rhs) const {
return ThreeWayCompare(lhs, rhs) < 0;
}
int SourceTextModuleDescriptor::AstRawStringComparer::ThreeWayCompare(
const AstRawString* lhs, const AstRawString* rhs) {
// Fast path for equal pointers: a pointer is not strictly less than itself.
if (lhs == rhs) return false;
// Order by contents (ordering by hash is unstable across runs).
if (lhs->is_one_byte() != rhs->is_one_byte()) {
return lhs->is_one_byte();
return lhs->is_one_byte() ? -1 : 1;
}
if (lhs->byte_length() != rhs->byte_length()) {
return lhs->byte_length() < rhs->byte_length();
return lhs->byte_length() - rhs->byte_length();
}
return memcmp(lhs->raw_data(), rhs->raw_data(), lhs->byte_length()) < 0;
return memcmp(lhs->raw_data(), rhs->raw_data(), lhs->byte_length());
}
bool SourceTextModuleDescriptor::ModuleRequestComparer::operator()(
const AstModuleRequest* lhs, const AstModuleRequest* rhs) const {
if (int specifier_comparison = AstRawStringComparer::ThreeWayCompare(
lhs->specifier(), rhs->specifier()))
return specifier_comparison < 0;
if (lhs->import_assertions()->size() != rhs->import_assertions()->size())
return (lhs->import_assertions()->size() <
rhs->import_assertions()->size());
auto lhsIt = lhs->import_assertions()->cbegin();
auto rhsIt = rhs->import_assertions()->cbegin();
for (; lhsIt != lhs->import_assertions()->cend(); ++lhsIt, ++rhsIt) {
if (int assertion_key_comparison =
AstRawStringComparer::ThreeWayCompare(lhsIt->first, rhsIt->first))
return assertion_key_comparison < 0;
if (int assertion_value_comparison = AstRawStringComparer::ThreeWayCompare(
lhsIt->second.first, rhsIt->second.first))
return assertion_value_comparison < 0;
}
return false;
}
void SourceTextModuleDescriptor::AddImport(
@ -34,11 +64,11 @@ void SourceTextModuleDescriptor::AddImport(
const AstRawString* module_request,
const ImportAssertions* import_assertions, const Scanner::Location loc,
const Scanner::Location specifier_loc, Zone* zone) {
// TODO(v8:10958) Add import_assertions to the Entry.
Entry* entry = zone->New<Entry>(loc);
entry->local_name = local_name;
entry->import_name = import_name;
entry->module_request = AddModuleRequest(module_request, specifier_loc);
entry->module_request =
AddModuleRequest(module_request, import_assertions, specifier_loc, zone);
AddRegularImport(entry);
}
@ -46,19 +76,18 @@ void SourceTextModuleDescriptor::AddStarImport(
const AstRawString* local_name, const AstRawString* module_request,
const ImportAssertions* import_assertions, const Scanner::Location loc,
const Scanner::Location specifier_loc, Zone* zone) {
// TODO(v8:10958) Add import_assertions to the Entry.
Entry* entry = zone->New<Entry>(loc);
entry->local_name = local_name;
entry->module_request = AddModuleRequest(module_request, specifier_loc);
entry->module_request =
AddModuleRequest(module_request, import_assertions, specifier_loc, zone);
AddNamespaceImport(entry, zone);
}
void SourceTextModuleDescriptor::AddEmptyImport(
const AstRawString* module_request,
const ImportAssertions* import_assertions,
const Scanner::Location specifier_loc) {
// TODO(v8:10958) Add import_assertions to the Entry.
AddModuleRequest(module_request, specifier_loc);
const Scanner::Location specifier_loc, Zone* zone) {
AddModuleRequest(module_request, import_assertions, specifier_loc, zone);
}
void SourceTextModuleDescriptor::AddExport(const AstRawString* local_name,
@ -75,13 +104,13 @@ void SourceTextModuleDescriptor::AddExport(
const AstRawString* module_request,
const ImportAssertions* import_assertions, const Scanner::Location loc,
const Scanner::Location specifier_loc, Zone* zone) {
// TODO(v8:10958) Add import_assertions to the Entry.
DCHECK_NOT_NULL(import_name);
DCHECK_NOT_NULL(export_name);
Entry* entry = zone->New<Entry>(loc);
entry->export_name = export_name;
entry->import_name = import_name;
entry->module_request = AddModuleRequest(module_request, specifier_loc);
entry->module_request =
AddModuleRequest(module_request, import_assertions, specifier_loc, zone);
AddSpecialExport(entry, zone);
}
@ -89,9 +118,9 @@ void SourceTextModuleDescriptor::AddStarExport(
const AstRawString* module_request,
const ImportAssertions* import_assertions, const Scanner::Location loc,
const Scanner::Location specifier_loc, Zone* zone) {
// TODO(v8:10958) Add import_assertions to the Entry.
Entry* entry = zone->New<Entry>(loc);
entry->module_request = AddModuleRequest(module_request, specifier_loc);
entry->module_request =
AddModuleRequest(module_request, import_assertions, specifier_loc, zone);
AddSpecialExport(entry, zone);
}
@ -104,6 +133,32 @@ Handle<PrimitiveHeapObject> ToStringOrUndefined(LocalIsolate* isolate,
}
} // namespace
template <typename LocalIsolate>
Handle<ModuleRequest> SourceTextModuleDescriptor::AstModuleRequest::Serialize(
LocalIsolate* isolate) const {
// The import assertions will be stored in this array in the form:
// [key1, value1, location1, key2, value2, location2, ...]
Handle<FixedArray> import_assertions_array =
isolate->factory()->NewFixedArray(
static_cast<int>(import_assertions()->size() * 3));
int i = 0;
for (auto iter = import_assertions()->cbegin();
iter != import_assertions()->cend(); ++iter, i += 3) {
import_assertions_array->set(i, *iter->first->string());
import_assertions_array->set(i + 1, *iter->second.first->string());
import_assertions_array->set(i + 2,
Smi::FromInt(iter->second.second.beg_pos));
}
return v8::internal::ModuleRequest::New(isolate, specifier()->string(),
import_assertions_array);
}
template Handle<ModuleRequest>
SourceTextModuleDescriptor::AstModuleRequest::Serialize(Isolate* isolate) const;
template Handle<ModuleRequest>
SourceTextModuleDescriptor::AstModuleRequest::Serialize(
LocalIsolate* isolate) const;
template <typename LocalIsolate>
Handle<SourceTextModuleInfoEntry> SourceTextModuleDescriptor::Entry::Serialize(
LocalIsolate* isolate) const {

View File

@ -13,6 +13,7 @@ namespace internal {
class AstRawString;
class ModuleRequest;
class SourceTextModuleInfo;
class SourceTextModuleInfoEntry;
class PendingCompilationErrorHandler;
@ -55,7 +56,7 @@ class SourceTextModuleDescriptor : public ZoneObject {
// export {} from "foo.js"; (sic!)
void AddEmptyImport(const AstRawString* module_request,
const ImportAssertions* import_assertions,
const Scanner::Location specifier_loc);
const Scanner::Location specifier_loc, Zone* zone);
// export {x};
// export {x as y};
@ -123,20 +124,55 @@ class SourceTextModuleDescriptor : public ZoneObject {
enum CellIndexKind { kInvalid, kExport, kImport };
static CellIndexKind GetCellIndexKind(int cell_index);
struct ModuleRequest {
class AstModuleRequest : public ZoneObject {
public:
// TODO(v8:10958): Consider storing module request location here
// instead of using separate ModuleRequestLocation struct.
AstModuleRequest(const AstRawString* specifier,
const ImportAssertions* import_assertions)
: specifier_(specifier), import_assertions_(import_assertions) {}
template <typename LocalIsolate>
Handle<v8::internal::ModuleRequest> Serialize(LocalIsolate* isolate) const;
const AstRawString* specifier() const { return specifier_; }
const ImportAssertions* import_assertions() const {
return import_assertions_;
}
private:
const AstRawString* specifier_;
const ImportAssertions* import_assertions_;
};
struct ModuleRequestLocation {
// The index at which we will place the request in SourceTextModuleInfo's
// module_requests FixedArray.
int index;
// The JS source code position of the request, used for reporting errors.
int position;
ModuleRequest(int index, int position) : index(index), position(position) {}
ModuleRequestLocation(int index, int position)
: index(index), position(position) {}
};
// Custom content-based comparer for the below maps, to keep them stable
// across parses.
struct V8_EXPORT_PRIVATE AstRawStringComparer {
bool operator()(const AstRawString* lhs, const AstRawString* rhs) const;
static int ThreeWayCompare(const AstRawString* lhs,
const AstRawString* rhs);
};
struct V8_EXPORT_PRIVATE ModuleRequestComparer {
bool operator()(const AstModuleRequest* lhs,
const AstModuleRequest* rhs) const;
};
using ModuleRequestMap =
ZoneMap<const AstRawString*, ModuleRequest, AstRawStringComparer>;
ZoneMap<const AstModuleRequest*, ModuleRequestLocation,
ModuleRequestComparer>;
using RegularExportMap =
ZoneMultimap<const AstRawString*, Entry*, AstRawStringComparer>;
using RegularImportMap =
@ -233,13 +269,15 @@ class SourceTextModuleDescriptor : public ZoneObject {
void AssignCellIndices();
int AddModuleRequest(const AstRawString* specifier,
Scanner::Location specifier_loc) {
const ImportAssertions* import_assertions,
Scanner::Location specifier_loc, Zone* zone) {
DCHECK_NOT_NULL(specifier);
int module_requests_count = static_cast<int>(module_requests_.size());
auto it = module_requests_
.insert(std::make_pair(specifier,
ModuleRequest(module_requests_count,
specifier_loc.beg_pos)))
.insert(std::make_pair(
zone->New<AstModuleRequest>(specifier, import_assertions),
ModuleRequestLocation(module_requests_count,
specifier_loc.beg_pos)))
.first;
return it->second.index;
}

View File

@ -309,6 +309,7 @@ Type::bitset BitsetType::Lub(const MapRefLike& map) {
case EVAL_CONTEXT_TYPE:
case FUNCTION_CONTEXT_TYPE:
case MODULE_CONTEXT_TYPE:
case MODULE_REQUEST_TYPE:
case NATIVE_CONTEXT_TYPE:
case SCRIPT_CONTEXT_TYPE:
case WITH_CONTEXT_TYPE:

View File

@ -1385,6 +1385,17 @@ void Module::ModuleVerify(Isolate* isolate) {
CHECK_NE(hash(), 0);
}
void ModuleRequest::ModuleRequestVerify(Isolate* isolate) {
TorqueGeneratedClassVerifiers::ModuleRequestVerify(*this, isolate);
CHECK_EQ(0, import_assertions().length() % 3);
for (int i = 0; i < import_assertions().length(); i += 3) {
CHECK(import_assertions().get(i).IsString()); // Assertion key
CHECK(import_assertions().get(i + 1).IsString()); // Assertion value
CHECK(import_assertions().get(i + 2).IsSmi()); // Assertion location
}
}
void SourceTextModule::SourceTextModuleVerify(Isolate* isolate) {
TorqueGeneratedClassVerifiers::SourceTextModuleVerify(*this, isolate);

View File

@ -25,6 +25,7 @@ OBJECT_CONSTRUCTORS_IMPL(Module, HeapObject)
TQ_OBJECT_CONSTRUCTORS_IMPL(JSModuleNamespace)
NEVER_READ_ONLY_SPACE_IMPL(Module)
NEVER_READ_ONLY_SPACE_IMPL(ModuleRequest)
NEVER_READ_ONLY_SPACE_IMPL(SourceTextModule)
NEVER_READ_ONLY_SPACE_IMPL(SyntheticModule)

View File

@ -135,6 +135,7 @@ namespace internal {
function_template_rare_data) \
V(_, INTERCEPTOR_INFO_TYPE, InterceptorInfo, interceptor_info) \
V(_, INTERPRETER_DATA_TYPE, InterpreterData, interpreter_data) \
V(_, MODULE_REQUEST_TYPE, ModuleRequest, module_request) \
V(_, PROMISE_CAPABILITY_TYPE, PromiseCapability, promise_capability) \
V(_, PROMISE_REACTION_TYPE, PromiseReaction, promise_reaction) \
V(_, PROPERTY_DESCRIPTOR_OBJECT_TYPE, PropertyDescriptorObject, \

View File

@ -1043,6 +1043,24 @@ std::ostream& operator<<(std::ostream& os, VariableAllocationInfo var_info) {
return os;
}
template <typename LocalIsolate>
Handle<ModuleRequest> ModuleRequest::New(LocalIsolate* isolate,
Handle<String> specifier,
Handle<FixedArray> import_assertions) {
Handle<ModuleRequest> result = Handle<ModuleRequest>::cast(
isolate->factory()->NewStruct(MODULE_REQUEST_TYPE, AllocationType::kOld));
result->set_specifier(*specifier);
result->set_import_assertions(*import_assertions);
return result;
}
template Handle<ModuleRequest> ModuleRequest::New(
Isolate* isolate, Handle<String> specifier,
Handle<FixedArray> import_assertions);
template Handle<ModuleRequest> ModuleRequest::New(
LocalIsolate* isolate, Handle<String> specifier,
Handle<FixedArray> import_assertions);
template <typename LocalIsolate>
Handle<SourceTextModuleInfoEntry> SourceTextModuleInfoEntry::New(
LocalIsolate* isolate, Handle<PrimitiveHeapObject> export_name,
@ -1082,7 +1100,9 @@ Handle<SourceTextModuleInfo> SourceTextModuleInfo::New(
Handle<FixedArray> module_request_positions =
isolate->factory()->NewFixedArray(size);
for (const auto& elem : descr->module_requests()) {
module_requests->set(elem.second.index, *elem.first->string());
Handle<ModuleRequest> serialized_module_request =
elem.first->Serialize(isolate);
module_requests->set(elem.second.index, *serialized_module_request);
module_request_positions->set(elem.second.index,
Smi::FromInt(elem.second.position));
}

View File

@ -17,6 +17,7 @@ namespace internal {
#include "torque-generated/src/objects/source-text-module-tq-inl.inc"
TQ_OBJECT_CONSTRUCTORS_IMPL(ModuleRequest)
TQ_OBJECT_CONSTRUCTORS_IMPL(SourceTextModule)
TQ_OBJECT_CONSTRUCTORS_IMPL(SourceTextModuleInfoEntry)

View File

@ -234,16 +234,20 @@ MaybeHandle<Cell> SourceTextModule::ResolveExport(
MaybeHandle<Cell> SourceTextModule::ResolveImport(
Isolate* isolate, Handle<SourceTextModule> module, Handle<String> name,
int module_request, MessageLocation loc, bool must_resolve,
int module_request_index, MessageLocation loc, bool must_resolve,
Module::ResolveSet* resolve_set) {
Handle<Module> requested_module(
Module::cast(module->requested_modules().get(module_request)), isolate);
Handle<String> specifier(
String::cast(module->info().module_requests().get(module_request)),
Module::cast(module->requested_modules().get(module_request_index)),
isolate);
Handle<ModuleRequest> module_request(
ModuleRequest::cast(
module->info().module_requests().get(module_request_index)),
isolate);
Handle<String> module_specifier(String::cast(module_request->specifier()),
isolate);
MaybeHandle<Cell> result =
Module::ResolveExport(isolate, requested_module, specifier, name, loc,
must_resolve, resolve_set);
Module::ResolveExport(isolate, requested_module, module_specifier, name,
loc, must_resolve, resolve_set);
DCHECK_IMPLIES(isolate->has_pending_exception(), result.is_null());
return result;
}
@ -312,7 +316,10 @@ bool SourceTextModule::PrepareInstantiate(
Handle<FixedArray> module_requests(module_info->module_requests(), isolate);
Handle<FixedArray> requested_modules(module->requested_modules(), isolate);
for (int i = 0, length = module_requests->length(); i < length; ++i) {
Handle<String> specifier(String::cast(module_requests->get(i)), isolate);
Handle<ModuleRequest> module_request(
ModuleRequest::cast(module_requests->get(i)), isolate);
Handle<String> specifier(module_request->specifier(), isolate);
// TODO(v8:10958) Pass import assertions to the callback
v8::Local<v8::Module> api_requested_module;
if (!callback(context, v8::Utils::ToLocal(specifier),
v8::Utils::ToLocal(Handle<Module>::cast(module)))

View File

@ -126,7 +126,7 @@ class SourceTextModule
MessageLocation loc, bool must_resolve, ResolveSet* resolve_set);
static V8_WARN_UNUSED_RESULT MaybeHandle<Cell> ResolveImport(
Isolate* isolate, Handle<SourceTextModule> module, Handle<String> name,
int module_request, MessageLocation loc, bool must_resolve,
int module_request_index, MessageLocation loc, bool must_resolve,
ResolveSet* resolve_set);
static V8_WARN_UNUSED_RESULT MaybeHandle<Cell> ResolveExportUsingStarExports(
@ -238,6 +238,20 @@ class SourceTextModuleInfo : public FixedArray {
OBJECT_CONSTRUCTORS(SourceTextModuleInfo, FixedArray);
};
class ModuleRequest
: public TorqueGeneratedModuleRequest<ModuleRequest, Struct> {
public:
NEVER_READ_ONLY_SPACE
DECL_VERIFIER(ModuleRequest)
template <typename LocalIsolate>
static Handle<ModuleRequest> New(LocalIsolate* isolate,
Handle<String> specifier,
Handle<FixedArray> import_assertions);
TQ_OBJECT_CONSTRUCTORS(ModuleRequest)
};
class SourceTextModuleInfoEntry
: public TorqueGeneratedSourceTextModuleInfoEntry<SourceTextModuleInfoEntry,
Struct> {

View File

@ -47,6 +47,16 @@ extern class SourceTextModule extends Module {
flags: SmiTagged<SourceTextModuleFlags>;
}
@generateCppClass
@generatePrint
extern class ModuleRequest extends Struct {
specifier: String;
// Import assertions are stored in this array in the form:
// [key1, value1, location1, key2, value2, location2, ...]
import_assertions: FixedArray;
}
@generateCppClass
extern class SourceTextModuleInfoEntry extends Struct {
export_name: String|Undefined;

View File

@ -1306,8 +1306,8 @@ void Parser::ParseImportDeclaration() {
const AstRawString* module_specifier = ParseModuleSpecifier();
const ImportAssertions* import_assertions = ParseImportAssertClause();
ExpectSemicolon();
module()->AddEmptyImport(module_specifier, import_assertions,
specifier_loc);
module()->AddEmptyImport(module_specifier, import_assertions, specifier_loc,
zone());
return;
}
@ -1377,7 +1377,7 @@ void Parser::ParseImportDeclaration() {
if (named_imports != nullptr) {
if (named_imports->length() == 0) {
module()->AddEmptyImport(module_specifier, import_assertions,
specifier_loc);
specifier_loc, zone());
} else {
for (const NamedImport* import : *named_imports) {
module()->AddImport(import->import_name, import->local_name,
@ -1567,7 +1567,7 @@ Statement* Parser::ParseExportDeclaration() {
if (export_data->is_empty()) {
module()->AddEmptyImport(module_specifier, import_assertions,
specifier_loc);
specifier_loc, zone());
} else {
for (const ExportClauseData& data : *export_data) {
module()->AddExport(data.local_name, data.export_name,

View File

@ -8082,19 +8082,19 @@ TEST(ModuleParsingInternals) {
CHECK_EQ(5u, descriptor->module_requests().size());
for (const auto& elem : descriptor->module_requests()) {
if (elem.first->IsOneByteEqualTo("m.js")) {
if (elem.first->specifier()->IsOneByteEqualTo("m.js")) {
CHECK_EQ(0, elem.second.index);
CHECK_EQ(51, elem.second.position);
} else if (elem.first->IsOneByteEqualTo("n.js")) {
} else if (elem.first->specifier()->IsOneByteEqualTo("n.js")) {
CHECK_EQ(1, elem.second.index);
CHECK_EQ(72, elem.second.position);
} else if (elem.first->IsOneByteEqualTo("p.js")) {
} else if (elem.first->specifier()->IsOneByteEqualTo("p.js")) {
CHECK_EQ(2, elem.second.index);
CHECK_EQ(123, elem.second.position);
} else if (elem.first->IsOneByteEqualTo("q.js")) {
} else if (elem.first->specifier()->IsOneByteEqualTo("q.js")) {
CHECK_EQ(3, elem.second.index);
CHECK_EQ(249, elem.second.position);
} else if (elem.first->IsOneByteEqualTo("bar.js")) {
} else if (elem.first->specifier()->IsOneByteEqualTo("bar.js")) {
CHECK_EQ(4, elem.second.index);
CHECK_EQ(370, elem.second.position);
} else {
@ -8172,6 +8172,353 @@ TEST(ModuleParsingInternals) {
CheckEntry(entry, nullptr, "aa", "aa", 0);
}
TEST(ModuleParsingInternalsWithImportAssertions) {
i::FLAG_harmony_import_assertions = true;
i::Isolate* isolate = CcTest::i_isolate();
i::Factory* factory = isolate->factory();
v8::HandleScope handles(CcTest::isolate());
v8::Local<v8::Context> context = v8::Context::New(CcTest::isolate());
v8::Context::Scope context_scope(context);
isolate->stack_guard()->SetStackLimit(base::Stack::GetCurrentStackPosition() -
128 * 1024);
static const char kSource[] =
"import { q as z } from 'm.js';"
"import { q as z2 } from 'm.js' assert { foo: 'bar'};"
"import { q as z3 } from 'm.js' assert { foo2: 'bar'};"
"import { q as z4 } from 'm.js' assert { foo: 'bar2'};"
"import { q as z5 } from 'm.js' assert { foo: 'bar', foo2: 'bar'};"
"import { q as z6 } from 'n.js' assert { foo: 'bar'};"
"import 'm.js' assert { foo: 'bar'};"
"export * from 'm.js' assert { foo: 'bar', foo2: 'bar'};";
i::Handle<i::String> source = factory->NewStringFromAsciiChecked(kSource);
i::Handle<i::Script> script = factory->NewScript(source);
i::UnoptimizedCompileState compile_state(isolate);
i::UnoptimizedCompileFlags flags =
i::UnoptimizedCompileFlags::ForScriptCompile(isolate, *script);
flags.set_is_module(true);
i::ParseInfo info(isolate, flags, &compile_state);
CHECK_PARSE_PROGRAM(&info, script, isolate);
i::FunctionLiteral* func = info.literal();
i::ModuleScope* module_scope = func->scope()->AsModuleScope();
CHECK(module_scope->is_module_scope());
i::SourceTextModuleDescriptor* descriptor = module_scope->module();
CHECK_NOT_NULL(descriptor);
const i::AstRawString* foo_string =
info.ast_value_factory()->GetOneByteString("foo");
const i::AstRawString* foo2_string =
info.ast_value_factory()->GetOneByteString("foo2");
CHECK_EQ(6u, descriptor->module_requests().size());
for (const auto& elem : descriptor->module_requests()) {
if (elem.second.index == 0) {
CHECK(elem.first->specifier()->IsOneByteEqualTo("m.js"));
CHECK_EQ(0, elem.first->import_assertions()->size());
CHECK_EQ(23, elem.second.position);
} else if (elem.second.index == 1) {
CHECK(elem.first->specifier()->IsOneByteEqualTo("m.js"));
CHECK_EQ(1, elem.first->import_assertions()->size());
CHECK_EQ(54, elem.second.position);
CHECK(elem.first->import_assertions()
->at(foo_string)
.first->IsOneByteEqualTo("bar"));
CHECK_EQ(70,
elem.first->import_assertions()->at(foo_string).second.beg_pos);
} else if (elem.second.index == 2) {
CHECK(elem.first->specifier()->IsOneByteEqualTo("m.js"));
CHECK_EQ(1, elem.first->import_assertions()->size());
CHECK_EQ(106, elem.second.position);
CHECK(elem.first->import_assertions()
->at(foo2_string)
.first->IsOneByteEqualTo("bar"));
CHECK_EQ(122,
elem.first->import_assertions()->at(foo2_string).second.beg_pos);
} else if (elem.second.index == 3) {
CHECK(elem.first->specifier()->IsOneByteEqualTo("m.js"));
CHECK_EQ(1, elem.first->import_assertions()->size());
CHECK_EQ(159, elem.second.position);
CHECK(elem.first->import_assertions()
->at(foo_string)
.first->IsOneByteEqualTo("bar2"));
CHECK_EQ(175,
elem.first->import_assertions()->at(foo_string).second.beg_pos);
} else if (elem.second.index == 4) {
CHECK(elem.first->specifier()->IsOneByteEqualTo("m.js"));
CHECK_EQ(2, elem.first->import_assertions()->size());
CHECK_EQ(212, elem.second.position);
CHECK(elem.first->import_assertions()
->at(foo_string)
.first->IsOneByteEqualTo("bar"));
CHECK_EQ(228,
elem.first->import_assertions()->at(foo_string).second.beg_pos);
CHECK(elem.first->import_assertions()
->at(foo2_string)
.first->IsOneByteEqualTo("bar"));
CHECK_EQ(240,
elem.first->import_assertions()->at(foo2_string).second.beg_pos);
} else if (elem.second.index == 5) {
CHECK(elem.first->specifier()->IsOneByteEqualTo("n.js"));
CHECK_EQ(1, elem.first->import_assertions()->size());
CHECK_EQ(277, elem.second.position);
CHECK(elem.first->import_assertions()
->at(foo_string)
.first->IsOneByteEqualTo("bar"));
CHECK_EQ(293,
elem.first->import_assertions()->at(foo_string).second.beg_pos);
} else {
UNREACHABLE();
}
}
}
TEST(ModuleParsingImportAssertionOrdering) {
i::FLAG_harmony_import_assertions = true;
i::Isolate* isolate = CcTest::i_isolate();
i::Factory* factory = isolate->factory();
v8::HandleScope handles(CcTest::isolate());
v8::Local<v8::Context> context = v8::Context::New(CcTest::isolate());
v8::Context::Scope context_scope(context);
isolate->stack_guard()->SetStackLimit(base::Stack::GetCurrentStackPosition() -
128 * 1024);
static const char kSource[] =
"import 'foo' assert { };"
"import 'baaaaaar' assert { };"
"import 'aa' assert { };"
"import 'a' assert { a: 'b' };"
"import 'b' assert { };"
"import 'd' assert { a: 'b' };"
"import 'c' assert { };"
"import 'f' assert { };"
"import 'f' assert { a: 'b'};"
"import 'g' assert { a: 'b' };"
"import 'g' assert { };"
"import 'h' assert { a: 'd' };"
"import 'h' assert { b: 'c' };"
"import 'i' assert { b: 'c' };"
"import 'i' assert { a: 'd' };"
"import 'j' assert { a: 'b' };"
"import 'j' assert { a: 'c' };"
"import 'k' assert { a: 'c' };"
"import 'k' assert { a: 'b' };"
"import 'l' assert { a: 'b', e: 'f' };"
"import 'l' assert { a: 'c', d: 'g' };"
"import 'm' assert { a: 'c', d: 'g' };"
"import 'm' assert { a: 'b', e: 'f' };"
"import 'n' assert { 'd': '' };"
"import 'n' assert { 'a': 'b' };"
"import 'o' assert { 'a': 'b' };"
"import 'o' assert { 'd': '' };"
"import 'p' assert { 'z': 'c' };"
"import 'p' assert { 'a': 'c', 'b': 'c' };";
i::Handle<i::String> source = factory->NewStringFromAsciiChecked(kSource);
i::Handle<i::Script> script = factory->NewScript(source);
i::UnoptimizedCompileState compile_state(isolate);
i::UnoptimizedCompileFlags flags =
i::UnoptimizedCompileFlags::ForScriptCompile(isolate, *script);
flags.set_is_module(true);
i::ParseInfo info(isolate, flags, &compile_state);
CHECK_PARSE_PROGRAM(&info, script, isolate);
i::FunctionLiteral* func = info.literal();
i::ModuleScope* module_scope = func->scope()->AsModuleScope();
CHECK(module_scope->is_module_scope());
i::SourceTextModuleDescriptor* descriptor = module_scope->module();
CHECK_NOT_NULL(descriptor);
const i::AstRawString* a_string =
info.ast_value_factory()->GetOneByteString("a");
const i::AstRawString* b_string =
info.ast_value_factory()->GetOneByteString("b");
const i::AstRawString* d_string =
info.ast_value_factory()->GetOneByteString("d");
const i::AstRawString* e_string =
info.ast_value_factory()->GetOneByteString("e");
const i::AstRawString* z_string =
info.ast_value_factory()->GetOneByteString("z");
CHECK_EQ(29u, descriptor->module_requests().size());
auto request_iterator = descriptor->module_requests().cbegin();
CHECK(request_iterator->first->specifier()->IsOneByteEqualTo("a"));
++request_iterator;
CHECK(request_iterator->first->specifier()->IsOneByteEqualTo("b"));
++request_iterator;
CHECK(request_iterator->first->specifier()->IsOneByteEqualTo("c"));
++request_iterator;
CHECK(request_iterator->first->specifier()->IsOneByteEqualTo("d"));
++request_iterator;
CHECK(request_iterator->first->specifier()->IsOneByteEqualTo("f"));
CHECK_EQ(0, request_iterator->first->import_assertions()->size());
++request_iterator;
CHECK(request_iterator->first->specifier()->IsOneByteEqualTo("f"));
CHECK_EQ(1, request_iterator->first->import_assertions()->size());
++request_iterator;
CHECK(request_iterator->first->specifier()->IsOneByteEqualTo("g"));
CHECK_EQ(0, request_iterator->first->import_assertions()->size());
++request_iterator;
CHECK(request_iterator->first->specifier()->IsOneByteEqualTo("g"));
CHECK_EQ(1, request_iterator->first->import_assertions()->size());
++request_iterator;
CHECK(request_iterator->first->specifier()->IsOneByteEqualTo("h"));
CHECK_EQ(1, request_iterator->first->import_assertions()->size());
CHECK(request_iterator->first->import_assertions()
->at(a_string)
.first->IsOneByteEqualTo("d"));
++request_iterator;
CHECK(request_iterator->first->specifier()->IsOneByteEqualTo("h"));
CHECK_EQ(1, request_iterator->first->import_assertions()->size());
CHECK(request_iterator->first->import_assertions()
->at(b_string)
.first->IsOneByteEqualTo("c"));
++request_iterator;
CHECK(request_iterator->first->specifier()->IsOneByteEqualTo("i"));
CHECK_EQ(1, request_iterator->first->import_assertions()->size());
CHECK(request_iterator->first->import_assertions()
->at(a_string)
.first->IsOneByteEqualTo("d"));
++request_iterator;
CHECK(request_iterator->first->specifier()->IsOneByteEqualTo("i"));
CHECK_EQ(1, request_iterator->first->import_assertions()->size());
CHECK(request_iterator->first->import_assertions()
->at(b_string)
.first->IsOneByteEqualTo("c"));
++request_iterator;
CHECK(request_iterator->first->specifier()->IsOneByteEqualTo("j"));
CHECK_EQ(1, request_iterator->first->import_assertions()->size());
CHECK(request_iterator->first->import_assertions()
->at(a_string)
.first->IsOneByteEqualTo("b"));
++request_iterator;
CHECK(request_iterator->first->specifier()->IsOneByteEqualTo("j"));
CHECK_EQ(1, request_iterator->first->import_assertions()->size());
CHECK(request_iterator->first->import_assertions()
->at(a_string)
.first->IsOneByteEqualTo("c"));
++request_iterator;
CHECK(request_iterator->first->specifier()->IsOneByteEqualTo("k"));
CHECK_EQ(1, request_iterator->first->import_assertions()->size());
CHECK(request_iterator->first->import_assertions()
->at(a_string)
.first->IsOneByteEqualTo("b"));
++request_iterator;
CHECK(request_iterator->first->specifier()->IsOneByteEqualTo("k"));
CHECK_EQ(1, request_iterator->first->import_assertions()->size());
CHECK(request_iterator->first->import_assertions()
->at(a_string)
.first->IsOneByteEqualTo("c"));
++request_iterator;
CHECK(request_iterator->first->specifier()->IsOneByteEqualTo("l"));
CHECK_EQ(2, request_iterator->first->import_assertions()->size());
CHECK(request_iterator->first->import_assertions()
->at(a_string)
.first->IsOneByteEqualTo("b"));
CHECK(request_iterator->first->import_assertions()
->at(e_string)
.first->IsOneByteEqualTo("f"));
++request_iterator;
CHECK(request_iterator->first->specifier()->IsOneByteEqualTo("l"));
CHECK_EQ(2, request_iterator->first->import_assertions()->size());
CHECK(request_iterator->first->import_assertions()
->at(a_string)
.first->IsOneByteEqualTo("c"));
CHECK(request_iterator->first->import_assertions()
->at(d_string)
.first->IsOneByteEqualTo("g"));
++request_iterator;
CHECK(request_iterator->first->specifier()->IsOneByteEqualTo("m"));
CHECK_EQ(2, request_iterator->first->import_assertions()->size());
CHECK(request_iterator->first->import_assertions()
->at(a_string)
.first->IsOneByteEqualTo("b"));
CHECK(request_iterator->first->import_assertions()
->at(e_string)
.first->IsOneByteEqualTo("f"));
++request_iterator;
CHECK(request_iterator->first->specifier()->IsOneByteEqualTo("m"));
CHECK_EQ(2, request_iterator->first->import_assertions()->size());
CHECK(request_iterator->first->import_assertions()
->at(a_string)
.first->IsOneByteEqualTo("c"));
CHECK(request_iterator->first->import_assertions()
->at(d_string)
.first->IsOneByteEqualTo("g"));
++request_iterator;
CHECK(request_iterator->first->specifier()->IsOneByteEqualTo("n"));
CHECK_EQ(1, request_iterator->first->import_assertions()->size());
CHECK(request_iterator->first->import_assertions()
->at(a_string)
.first->IsOneByteEqualTo("b"));
++request_iterator;
CHECK(request_iterator->first->specifier()->IsOneByteEqualTo("n"));
CHECK_EQ(1, request_iterator->first->import_assertions()->size());
CHECK(request_iterator->first->import_assertions()
->at(d_string)
.first->IsOneByteEqualTo(""));
++request_iterator;
CHECK(request_iterator->first->specifier()->IsOneByteEqualTo("o"));
CHECK_EQ(1, request_iterator->first->import_assertions()->size());
CHECK(request_iterator->first->import_assertions()
->at(a_string)
.first->IsOneByteEqualTo("b"));
++request_iterator;
CHECK(request_iterator->first->specifier()->IsOneByteEqualTo("o"));
CHECK_EQ(1, request_iterator->first->import_assertions()->size());
CHECK(request_iterator->first->import_assertions()
->at(d_string)
.first->IsOneByteEqualTo(""));
++request_iterator;
CHECK(request_iterator->first->specifier()->IsOneByteEqualTo("p"));
CHECK_EQ(1, request_iterator->first->import_assertions()->size());
CHECK(request_iterator->first->import_assertions()
->at(z_string)
.first->IsOneByteEqualTo("c"));
++request_iterator;
CHECK(request_iterator->first->specifier()->IsOneByteEqualTo("p"));
CHECK_EQ(2, request_iterator->first->import_assertions()->size());
CHECK(request_iterator->first->import_assertions()
->at(a_string)
.first->IsOneByteEqualTo("c"));
CHECK(request_iterator->first->import_assertions()
->at(b_string)
.first->IsOneByteEqualTo("c"));
++request_iterator;
CHECK(request_iterator->first->specifier()->IsOneByteEqualTo("aa"));
++request_iterator;
CHECK(request_iterator->first->specifier()->IsOneByteEqualTo("foo"));
++request_iterator;
CHECK(request_iterator->first->specifier()->IsOneByteEqualTo("baaaaaar"));
}
TEST(DuplicateProtoError) {
const char* context_data[][2] = {

View File

@ -62,94 +62,95 @@ INSTANCE_TYPES = {
98: "FUNCTION_TEMPLATE_RARE_DATA_TYPE",
99: "INTERCEPTOR_INFO_TYPE",
100: "INTERPRETER_DATA_TYPE",
101: "PROMISE_CAPABILITY_TYPE",
102: "PROMISE_REACTION_TYPE",
103: "PROPERTY_DESCRIPTOR_OBJECT_TYPE",
104: "PROTOTYPE_INFO_TYPE",
105: "SCRIPT_TYPE",
106: "SOURCE_TEXT_MODULE_INFO_ENTRY_TYPE",
107: "STACK_FRAME_INFO_TYPE",
108: "STACK_TRACE_FRAME_TYPE",
109: "TEMPLATE_OBJECT_DESCRIPTION_TYPE",
110: "TUPLE2_TYPE",
111: "WASM_EXCEPTION_TAG_TYPE",
112: "WASM_EXPORTED_FUNCTION_DATA_TYPE",
113: "WASM_INDIRECT_FUNCTION_TABLE_TYPE",
114: "WASM_JS_FUNCTION_DATA_TYPE",
115: "WASM_VALUE_TYPE",
116: "FIXED_ARRAY_TYPE",
117: "HASH_TABLE_TYPE",
118: "EPHEMERON_HASH_TABLE_TYPE",
119: "GLOBAL_DICTIONARY_TYPE",
120: "NAME_DICTIONARY_TYPE",
121: "NUMBER_DICTIONARY_TYPE",
122: "ORDERED_HASH_MAP_TYPE",
123: "ORDERED_HASH_SET_TYPE",
124: "ORDERED_NAME_DICTIONARY_TYPE",
125: "SIMPLE_NUMBER_DICTIONARY_TYPE",
126: "CLOSURE_FEEDBACK_CELL_ARRAY_TYPE",
127: "OBJECT_BOILERPLATE_DESCRIPTION_TYPE",
128: "SCOPE_INFO_TYPE",
129: "SCRIPT_CONTEXT_TABLE_TYPE",
130: "BYTE_ARRAY_TYPE",
131: "BYTECODE_ARRAY_TYPE",
132: "FIXED_DOUBLE_ARRAY_TYPE",
133: "INTERNAL_CLASS_WITH_SMI_ELEMENTS_TYPE",
134: "SLOPPY_ARGUMENTS_ELEMENTS_TYPE",
135: "AWAIT_CONTEXT_TYPE",
136: "BLOCK_CONTEXT_TYPE",
137: "CATCH_CONTEXT_TYPE",
138: "DEBUG_EVALUATE_CONTEXT_TYPE",
139: "EVAL_CONTEXT_TYPE",
140: "FUNCTION_CONTEXT_TYPE",
141: "MODULE_CONTEXT_TYPE",
142: "NATIVE_CONTEXT_TYPE",
143: "SCRIPT_CONTEXT_TYPE",
144: "WITH_CONTEXT_TYPE",
145: "EXPORTED_SUB_CLASS_BASE_TYPE",
146: "EXPORTED_SUB_CLASS_TYPE",
147: "EXPORTED_SUB_CLASS2_TYPE",
148: "SMALL_ORDERED_HASH_MAP_TYPE",
149: "SMALL_ORDERED_HASH_SET_TYPE",
150: "SMALL_ORDERED_NAME_DICTIONARY_TYPE",
151: "DESCRIPTOR_ARRAY_TYPE",
152: "STRONG_DESCRIPTOR_ARRAY_TYPE",
153: "SOURCE_TEXT_MODULE_TYPE",
154: "SYNTHETIC_MODULE_TYPE",
155: "UNCOMPILED_DATA_WITH_PREPARSE_DATA_TYPE",
156: "UNCOMPILED_DATA_WITHOUT_PREPARSE_DATA_TYPE",
157: "WEAK_FIXED_ARRAY_TYPE",
158: "TRANSITION_ARRAY_TYPE",
159: "CELL_TYPE",
160: "CODE_TYPE",
161: "CODE_DATA_CONTAINER_TYPE",
162: "COVERAGE_INFO_TYPE",
163: "EMBEDDER_DATA_ARRAY_TYPE",
164: "FEEDBACK_METADATA_TYPE",
165: "FEEDBACK_VECTOR_TYPE",
166: "FILLER_TYPE",
167: "FREE_SPACE_TYPE",
168: "INTERNAL_CLASS_TYPE",
169: "INTERNAL_CLASS_WITH_STRUCT_ELEMENTS_TYPE",
170: "MAP_TYPE",
171: "ON_HEAP_BASIC_BLOCK_PROFILER_DATA_TYPE",
172: "PREPARSE_DATA_TYPE",
173: "PROPERTY_ARRAY_TYPE",
174: "PROPERTY_CELL_TYPE",
175: "SHARED_FUNCTION_INFO_TYPE",
176: "SMI_BOX_TYPE",
177: "SMI_PAIR_TYPE",
178: "SORT_STATE_TYPE",
179: "WASM_ARRAY_TYPE",
180: "WASM_CAPI_FUNCTION_DATA_TYPE",
181: "WASM_STRUCT_TYPE",
182: "WEAK_ARRAY_LIST_TYPE",
183: "WEAK_CELL_TYPE",
184: "JS_PROXY_TYPE",
101: "MODULE_REQUEST_TYPE",
102: "PROMISE_CAPABILITY_TYPE",
103: "PROMISE_REACTION_TYPE",
104: "PROPERTY_DESCRIPTOR_OBJECT_TYPE",
105: "PROTOTYPE_INFO_TYPE",
106: "SCRIPT_TYPE",
107: "SOURCE_TEXT_MODULE_INFO_ENTRY_TYPE",
108: "STACK_FRAME_INFO_TYPE",
109: "STACK_TRACE_FRAME_TYPE",
110: "TEMPLATE_OBJECT_DESCRIPTION_TYPE",
111: "TUPLE2_TYPE",
112: "WASM_EXCEPTION_TAG_TYPE",
113: "WASM_EXPORTED_FUNCTION_DATA_TYPE",
114: "WASM_INDIRECT_FUNCTION_TABLE_TYPE",
115: "WASM_JS_FUNCTION_DATA_TYPE",
116: "WASM_VALUE_TYPE",
117: "FIXED_ARRAY_TYPE",
118: "HASH_TABLE_TYPE",
119: "EPHEMERON_HASH_TABLE_TYPE",
120: "GLOBAL_DICTIONARY_TYPE",
121: "NAME_DICTIONARY_TYPE",
122: "NUMBER_DICTIONARY_TYPE",
123: "ORDERED_HASH_MAP_TYPE",
124: "ORDERED_HASH_SET_TYPE",
125: "ORDERED_NAME_DICTIONARY_TYPE",
126: "SIMPLE_NUMBER_DICTIONARY_TYPE",
127: "CLOSURE_FEEDBACK_CELL_ARRAY_TYPE",
128: "OBJECT_BOILERPLATE_DESCRIPTION_TYPE",
129: "SCOPE_INFO_TYPE",
130: "SCRIPT_CONTEXT_TABLE_TYPE",
131: "BYTE_ARRAY_TYPE",
132: "BYTECODE_ARRAY_TYPE",
133: "FIXED_DOUBLE_ARRAY_TYPE",
134: "INTERNAL_CLASS_WITH_SMI_ELEMENTS_TYPE",
135: "SLOPPY_ARGUMENTS_ELEMENTS_TYPE",
136: "AWAIT_CONTEXT_TYPE",
137: "BLOCK_CONTEXT_TYPE",
138: "CATCH_CONTEXT_TYPE",
139: "DEBUG_EVALUATE_CONTEXT_TYPE",
140: "EVAL_CONTEXT_TYPE",
141: "FUNCTION_CONTEXT_TYPE",
142: "MODULE_CONTEXT_TYPE",
143: "NATIVE_CONTEXT_TYPE",
144: "SCRIPT_CONTEXT_TYPE",
145: "WITH_CONTEXT_TYPE",
146: "EXPORTED_SUB_CLASS_BASE_TYPE",
147: "EXPORTED_SUB_CLASS_TYPE",
148: "EXPORTED_SUB_CLASS2_TYPE",
149: "SMALL_ORDERED_HASH_MAP_TYPE",
150: "SMALL_ORDERED_HASH_SET_TYPE",
151: "SMALL_ORDERED_NAME_DICTIONARY_TYPE",
152: "DESCRIPTOR_ARRAY_TYPE",
153: "STRONG_DESCRIPTOR_ARRAY_TYPE",
154: "SOURCE_TEXT_MODULE_TYPE",
155: "SYNTHETIC_MODULE_TYPE",
156: "UNCOMPILED_DATA_WITH_PREPARSE_DATA_TYPE",
157: "UNCOMPILED_DATA_WITHOUT_PREPARSE_DATA_TYPE",
158: "WEAK_FIXED_ARRAY_TYPE",
159: "TRANSITION_ARRAY_TYPE",
160: "CELL_TYPE",
161: "CODE_TYPE",
162: "CODE_DATA_CONTAINER_TYPE",
163: "COVERAGE_INFO_TYPE",
164: "EMBEDDER_DATA_ARRAY_TYPE",
165: "FEEDBACK_METADATA_TYPE",
166: "FEEDBACK_VECTOR_TYPE",
167: "FILLER_TYPE",
168: "FREE_SPACE_TYPE",
169: "INTERNAL_CLASS_TYPE",
170: "INTERNAL_CLASS_WITH_STRUCT_ELEMENTS_TYPE",
171: "MAP_TYPE",
172: "ON_HEAP_BASIC_BLOCK_PROFILER_DATA_TYPE",
173: "PREPARSE_DATA_TYPE",
174: "PROPERTY_ARRAY_TYPE",
175: "PROPERTY_CELL_TYPE",
176: "SHARED_FUNCTION_INFO_TYPE",
177: "SMI_BOX_TYPE",
178: "SMI_PAIR_TYPE",
179: "SORT_STATE_TYPE",
180: "WASM_ARRAY_TYPE",
181: "WASM_CAPI_FUNCTION_DATA_TYPE",
182: "WASM_STRUCT_TYPE",
183: "WEAK_ARRAY_LIST_TYPE",
184: "WEAK_CELL_TYPE",
185: "JS_PROXY_TYPE",
1057: "JS_OBJECT_TYPE",
185: "JS_GLOBAL_OBJECT_TYPE",
186: "JS_GLOBAL_PROXY_TYPE",
187: "JS_MODULE_NAMESPACE_TYPE",
186: "JS_GLOBAL_OBJECT_TYPE",
187: "JS_GLOBAL_PROXY_TYPE",
188: "JS_MODULE_NAMESPACE_TYPE",
1040: "JS_SPECIAL_API_OBJECT_TYPE",
1041: "JS_PRIMITIVE_WRAPPER_TYPE",
1042: "JS_MAP_KEY_ITERATOR_TYPE",
@ -206,78 +207,78 @@ INSTANCE_TYPES = {
# List of known V8 maps.
KNOWN_MAPS = {
("read_only_space", 0x02115): (170, "MetaMap"),
("read_only_space", 0x02115): (171, "MetaMap"),
("read_only_space", 0x0213d): (67, "NullMap"),
("read_only_space", 0x02165): (152, "StrongDescriptorArrayMap"),
("read_only_space", 0x0218d): (157, "WeakFixedArrayMap"),
("read_only_space", 0x02165): (153, "StrongDescriptorArrayMap"),
("read_only_space", 0x0218d): (158, "WeakFixedArrayMap"),
("read_only_space", 0x021cd): (96, "EnumCacheMap"),
("read_only_space", 0x02201): (116, "FixedArrayMap"),
("read_only_space", 0x02201): (117, "FixedArrayMap"),
("read_only_space", 0x0224d): (8, "OneByteInternalizedStringMap"),
("read_only_space", 0x02299): (167, "FreeSpaceMap"),
("read_only_space", 0x022c1): (166, "OnePointerFillerMap"),
("read_only_space", 0x022e9): (166, "TwoPointerFillerMap"),
("read_only_space", 0x02299): (168, "FreeSpaceMap"),
("read_only_space", 0x022c1): (167, "OnePointerFillerMap"),
("read_only_space", 0x022e9): (167, "TwoPointerFillerMap"),
("read_only_space", 0x02311): (67, "UninitializedMap"),
("read_only_space", 0x02389): (67, "UndefinedMap"),
("read_only_space", 0x023cd): (66, "HeapNumberMap"),
("read_only_space", 0x02401): (67, "TheHoleMap"),
("read_only_space", 0x02461): (67, "BooleanMap"),
("read_only_space", 0x02505): (130, "ByteArrayMap"),
("read_only_space", 0x0252d): (116, "FixedCOWArrayMap"),
("read_only_space", 0x02555): (117, "HashTableMap"),
("read_only_space", 0x02505): (131, "ByteArrayMap"),
("read_only_space", 0x0252d): (117, "FixedCOWArrayMap"),
("read_only_space", 0x02555): (118, "HashTableMap"),
("read_only_space", 0x0257d): (64, "SymbolMap"),
("read_only_space", 0x025a5): (40, "OneByteStringMap"),
("read_only_space", 0x025cd): (128, "ScopeInfoMap"),
("read_only_space", 0x025f5): (175, "SharedFunctionInfoMap"),
("read_only_space", 0x0261d): (160, "CodeMap"),
("read_only_space", 0x02645): (159, "CellMap"),
("read_only_space", 0x0266d): (174, "GlobalPropertyCellMap"),
("read_only_space", 0x025cd): (129, "ScopeInfoMap"),
("read_only_space", 0x025f5): (176, "SharedFunctionInfoMap"),
("read_only_space", 0x0261d): (161, "CodeMap"),
("read_only_space", 0x02645): (160, "CellMap"),
("read_only_space", 0x0266d): (175, "GlobalPropertyCellMap"),
("read_only_space", 0x02695): (70, "ForeignMap"),
("read_only_space", 0x026bd): (158, "TransitionArrayMap"),
("read_only_space", 0x026bd): (159, "TransitionArrayMap"),
("read_only_space", 0x026e5): (45, "ThinOneByteStringMap"),
("read_only_space", 0x0270d): (165, "FeedbackVectorMap"),
("read_only_space", 0x0270d): (166, "FeedbackVectorMap"),
("read_only_space", 0x0273d): (67, "ArgumentsMarkerMap"),
("read_only_space", 0x0279d): (67, "ExceptionMap"),
("read_only_space", 0x027f9): (67, "TerminationExceptionMap"),
("read_only_space", 0x02861): (67, "OptimizedOutMap"),
("read_only_space", 0x028c1): (67, "StaleRegisterMap"),
("read_only_space", 0x02921): (129, "ScriptContextTableMap"),
("read_only_space", 0x02949): (126, "ClosureFeedbackCellArrayMap"),
("read_only_space", 0x02971): (164, "FeedbackMetadataArrayMap"),
("read_only_space", 0x02999): (116, "ArrayListMap"),
("read_only_space", 0x02921): (130, "ScriptContextTableMap"),
("read_only_space", 0x02949): (127, "ClosureFeedbackCellArrayMap"),
("read_only_space", 0x02971): (165, "FeedbackMetadataArrayMap"),
("read_only_space", 0x02999): (117, "ArrayListMap"),
("read_only_space", 0x029c1): (65, "BigIntMap"),
("read_only_space", 0x029e9): (127, "ObjectBoilerplateDescriptionMap"),
("read_only_space", 0x02a11): (131, "BytecodeArrayMap"),
("read_only_space", 0x02a39): (161, "CodeDataContainerMap"),
("read_only_space", 0x02a61): (162, "CoverageInfoMap"),
("read_only_space", 0x02a89): (132, "FixedDoubleArrayMap"),
("read_only_space", 0x02ab1): (119, "GlobalDictionaryMap"),
("read_only_space", 0x029e9): (128, "ObjectBoilerplateDescriptionMap"),
("read_only_space", 0x02a11): (132, "BytecodeArrayMap"),
("read_only_space", 0x02a39): (162, "CodeDataContainerMap"),
("read_only_space", 0x02a61): (163, "CoverageInfoMap"),
("read_only_space", 0x02a89): (133, "FixedDoubleArrayMap"),
("read_only_space", 0x02ab1): (120, "GlobalDictionaryMap"),
("read_only_space", 0x02ad9): (97, "ManyClosuresCellMap"),
("read_only_space", 0x02b01): (116, "ModuleInfoMap"),
("read_only_space", 0x02b29): (120, "NameDictionaryMap"),
("read_only_space", 0x02b01): (117, "ModuleInfoMap"),
("read_only_space", 0x02b29): (121, "NameDictionaryMap"),
("read_only_space", 0x02b51): (97, "NoClosuresCellMap"),
("read_only_space", 0x02b79): (121, "NumberDictionaryMap"),
("read_only_space", 0x02b79): (122, "NumberDictionaryMap"),
("read_only_space", 0x02ba1): (97, "OneClosureCellMap"),
("read_only_space", 0x02bc9): (122, "OrderedHashMapMap"),
("read_only_space", 0x02bf1): (123, "OrderedHashSetMap"),
("read_only_space", 0x02c19): (124, "OrderedNameDictionaryMap"),
("read_only_space", 0x02c41): (172, "PreparseDataMap"),
("read_only_space", 0x02c69): (173, "PropertyArrayMap"),
("read_only_space", 0x02bc9): (123, "OrderedHashMapMap"),
("read_only_space", 0x02bf1): (124, "OrderedHashSetMap"),
("read_only_space", 0x02c19): (125, "OrderedNameDictionaryMap"),
("read_only_space", 0x02c41): (173, "PreparseDataMap"),
("read_only_space", 0x02c69): (174, "PropertyArrayMap"),
("read_only_space", 0x02c91): (93, "SideEffectCallHandlerInfoMap"),
("read_only_space", 0x02cb9): (93, "SideEffectFreeCallHandlerInfoMap"),
("read_only_space", 0x02ce1): (93, "NextCallSideEffectFreeCallHandlerInfoMap"),
("read_only_space", 0x02d09): (125, "SimpleNumberDictionaryMap"),
("read_only_space", 0x02d31): (148, "SmallOrderedHashMapMap"),
("read_only_space", 0x02d59): (149, "SmallOrderedHashSetMap"),
("read_only_space", 0x02d81): (150, "SmallOrderedNameDictionaryMap"),
("read_only_space", 0x02da9): (153, "SourceTextModuleMap"),
("read_only_space", 0x02dd1): (154, "SyntheticModuleMap"),
("read_only_space", 0x02df9): (156, "UncompiledDataWithoutPreparseDataMap"),
("read_only_space", 0x02e21): (155, "UncompiledDataWithPreparseDataMap"),
("read_only_space", 0x02d09): (126, "SimpleNumberDictionaryMap"),
("read_only_space", 0x02d31): (149, "SmallOrderedHashMapMap"),
("read_only_space", 0x02d59): (150, "SmallOrderedHashSetMap"),
("read_only_space", 0x02d81): (151, "SmallOrderedNameDictionaryMap"),
("read_only_space", 0x02da9): (154, "SourceTextModuleMap"),
("read_only_space", 0x02dd1): (155, "SyntheticModuleMap"),
("read_only_space", 0x02df9): (157, "UncompiledDataWithoutPreparseDataMap"),
("read_only_space", 0x02e21): (156, "UncompiledDataWithPreparseDataMap"),
("read_only_space", 0x02e49): (71, "WasmTypeInfoMap"),
("read_only_space", 0x02e71): (182, "WeakArrayListMap"),
("read_only_space", 0x02e99): (118, "EphemeronHashTableMap"),
("read_only_space", 0x02ec1): (163, "EmbedderDataArrayMap"),
("read_only_space", 0x02ee9): (183, "WeakCellMap"),
("read_only_space", 0x02e71): (183, "WeakArrayListMap"),
("read_only_space", 0x02e99): (119, "EphemeronHashTableMap"),
("read_only_space", 0x02ec1): (164, "EmbedderDataArrayMap"),
("read_only_space", 0x02ee9): (184, "WeakCellMap"),
("read_only_space", 0x02f11): (32, "StringMap"),
("read_only_space", 0x02f39): (41, "ConsOneByteStringMap"),
("read_only_space", 0x02f61): (33, "ConsStringMap"),
@ -318,51 +319,52 @@ KNOWN_MAPS = {
("read_only_space", 0x05699): (95, "DebugInfoMap"),
("read_only_space", 0x056c1): (98, "FunctionTemplateRareDataMap"),
("read_only_space", 0x056e9): (100, "InterpreterDataMap"),
("read_only_space", 0x05711): (101, "PromiseCapabilityMap"),
("read_only_space", 0x05739): (102, "PromiseReactionMap"),
("read_only_space", 0x05761): (103, "PropertyDescriptorObjectMap"),
("read_only_space", 0x05789): (104, "PrototypeInfoMap"),
("read_only_space", 0x057b1): (105, "ScriptMap"),
("read_only_space", 0x057d9): (106, "SourceTextModuleInfoEntryMap"),
("read_only_space", 0x05801): (107, "StackFrameInfoMap"),
("read_only_space", 0x05829): (108, "StackTraceFrameMap"),
("read_only_space", 0x05851): (109, "TemplateObjectDescriptionMap"),
("read_only_space", 0x05879): (110, "Tuple2Map"),
("read_only_space", 0x058a1): (111, "WasmExceptionTagMap"),
("read_only_space", 0x058c9): (112, "WasmExportedFunctionDataMap"),
("read_only_space", 0x058f1): (113, "WasmIndirectFunctionTableMap"),
("read_only_space", 0x05919): (114, "WasmJSFunctionDataMap"),
("read_only_space", 0x05941): (115, "WasmValueMap"),
("read_only_space", 0x05969): (134, "SloppyArgumentsElementsMap"),
("read_only_space", 0x05991): (151, "DescriptorArrayMap"),
("read_only_space", 0x059b9): (171, "OnHeapBasicBlockProfilerDataMap"),
("read_only_space", 0x059e1): (180, "WasmCapiFunctionDataMap"),
("read_only_space", 0x05a09): (168, "InternalClassMap"),
("read_only_space", 0x05a31): (177, "SmiPairMap"),
("read_only_space", 0x05a59): (176, "SmiBoxMap"),
("read_only_space", 0x05a81): (145, "ExportedSubClassBaseMap"),
("read_only_space", 0x05aa9): (146, "ExportedSubClassMap"),
("read_only_space", 0x05ad1): (68, "AbstractInternalClassSubclass1Map"),
("read_only_space", 0x05af9): (69, "AbstractInternalClassSubclass2Map"),
("read_only_space", 0x05b21): (133, "InternalClassWithSmiElementsMap"),
("read_only_space", 0x05b49): (169, "InternalClassWithStructElementsMap"),
("read_only_space", 0x05b71): (147, "ExportedSubClass2Map"),
("read_only_space", 0x05b99): (178, "SortStateMap"),
("read_only_space", 0x05bc1): (86, "AllocationSiteWithWeakNextMap"),
("read_only_space", 0x05be9): (86, "AllocationSiteWithoutWeakNextMap"),
("read_only_space", 0x05c11): (77, "LoadHandler1Map"),
("read_only_space", 0x05c39): (77, "LoadHandler2Map"),
("read_only_space", 0x05c61): (77, "LoadHandler3Map"),
("read_only_space", 0x05c89): (78, "StoreHandler0Map"),
("read_only_space", 0x05cb1): (78, "StoreHandler1Map"),
("read_only_space", 0x05cd9): (78, "StoreHandler2Map"),
("read_only_space", 0x05d01): (78, "StoreHandler3Map"),
("read_only_space", 0x05711): (101, "ModuleRequestMap"),
("read_only_space", 0x05739): (102, "PromiseCapabilityMap"),
("read_only_space", 0x05761): (103, "PromiseReactionMap"),
("read_only_space", 0x05789): (104, "PropertyDescriptorObjectMap"),
("read_only_space", 0x057b1): (105, "PrototypeInfoMap"),
("read_only_space", 0x057d9): (106, "ScriptMap"),
("read_only_space", 0x05801): (107, "SourceTextModuleInfoEntryMap"),
("read_only_space", 0x05829): (108, "StackFrameInfoMap"),
("read_only_space", 0x05851): (109, "StackTraceFrameMap"),
("read_only_space", 0x05879): (110, "TemplateObjectDescriptionMap"),
("read_only_space", 0x058a1): (111, "Tuple2Map"),
("read_only_space", 0x058c9): (112, "WasmExceptionTagMap"),
("read_only_space", 0x058f1): (113, "WasmExportedFunctionDataMap"),
("read_only_space", 0x05919): (114, "WasmIndirectFunctionTableMap"),
("read_only_space", 0x05941): (115, "WasmJSFunctionDataMap"),
("read_only_space", 0x05969): (116, "WasmValueMap"),
("read_only_space", 0x05991): (135, "SloppyArgumentsElementsMap"),
("read_only_space", 0x059b9): (152, "DescriptorArrayMap"),
("read_only_space", 0x059e1): (172, "OnHeapBasicBlockProfilerDataMap"),
("read_only_space", 0x05a09): (181, "WasmCapiFunctionDataMap"),
("read_only_space", 0x05a31): (169, "InternalClassMap"),
("read_only_space", 0x05a59): (178, "SmiPairMap"),
("read_only_space", 0x05a81): (177, "SmiBoxMap"),
("read_only_space", 0x05aa9): (146, "ExportedSubClassBaseMap"),
("read_only_space", 0x05ad1): (147, "ExportedSubClassMap"),
("read_only_space", 0x05af9): (68, "AbstractInternalClassSubclass1Map"),
("read_only_space", 0x05b21): (69, "AbstractInternalClassSubclass2Map"),
("read_only_space", 0x05b49): (134, "InternalClassWithSmiElementsMap"),
("read_only_space", 0x05b71): (170, "InternalClassWithStructElementsMap"),
("read_only_space", 0x05b99): (148, "ExportedSubClass2Map"),
("read_only_space", 0x05bc1): (179, "SortStateMap"),
("read_only_space", 0x05be9): (86, "AllocationSiteWithWeakNextMap"),
("read_only_space", 0x05c11): (86, "AllocationSiteWithoutWeakNextMap"),
("read_only_space", 0x05c39): (77, "LoadHandler1Map"),
("read_only_space", 0x05c61): (77, "LoadHandler2Map"),
("read_only_space", 0x05c89): (77, "LoadHandler3Map"),
("read_only_space", 0x05cb1): (78, "StoreHandler0Map"),
("read_only_space", 0x05cd9): (78, "StoreHandler1Map"),
("read_only_space", 0x05d01): (78, "StoreHandler2Map"),
("read_only_space", 0x05d29): (78, "StoreHandler3Map"),
("map_space", 0x02115): (1057, "ExternalMap"),
("map_space", 0x0213d): (1072, "JSMessageObjectMap"),
("map_space", 0x02165): (181, "WasmRttEqrefMap"),
("map_space", 0x0218d): (181, "WasmRttExternrefMap"),
("map_space", 0x021b5): (181, "WasmRttFuncrefMap"),
("map_space", 0x021dd): (181, "WasmRttI31refMap"),
("map_space", 0x02165): (182, "WasmRttEqrefMap"),
("map_space", 0x0218d): (182, "WasmRttExternrefMap"),
("map_space", 0x021b5): (182, "WasmRttFuncrefMap"),
("map_space", 0x021dd): (182, "WasmRttI31refMap"),
}
# List of known V8 objects.