5 #ifndef V8_OBJECTS_MODULE_INL_H_ 6 #define V8_OBJECTS_MODULE_INL_H_ 8 #include "src/objects/module.h" 10 #include "src/objects-inl.h" 11 #include "src/objects/scope-info.h" 14 #include "src/objects/object-macros.h" 20 ACCESSORS(Module, code, Object, kCodeOffset)
21 ACCESSORS2(Module, exports, ObjectHashTable, kExportsOffset)
22 ACCESSORS2(Module, regular_exports, FixedArray, kRegularExportsOffset)
23 ACCESSORS2(Module, regular_imports, FixedArray, kRegularImportsOffset)
24 ACCESSORS(Module, module_namespace, HeapObject, kModuleNamespaceOffset)
25 ACCESSORS2(Module, requested_modules, FixedArray, kRequestedModulesOffset)
26 ACCESSORS(Module, script, Script, kScriptOffset)
27 ACCESSORS(Module, exception, Object, kExceptionOffset)
28 ACCESSORS(Module, import_meta, Object, kImportMetaOffset)
29 SMI_ACCESSORS(Module, status, kStatusOffset)
30 SMI_ACCESSORS(Module, dfs_index, kDfsIndexOffset)
31 SMI_ACCESSORS(Module, dfs_ancestor_index, kDfsAncestorIndexOffset)
32 SMI_ACCESSORS(Module, hash, kHashOffset)
34 ModuleInfo Module::info()
const {
35 return (status() >= kEvaluating)
36 ? ModuleInfo::cast(code())
37 : GetSharedFunctionInfo()->scope_info()->ModuleDescriptorInfo();
40 CAST_ACCESSOR(JSModuleNamespace)
41 ACCESSORS(JSModuleNamespace, module, Module, kModuleOffset)
43 CAST_ACCESSOR(ModuleInfoEntry)
44 ACCESSORS(ModuleInfoEntry, export_name, Object, kExportNameOffset)
45 ACCESSORS(ModuleInfoEntry, local_name, Object, kLocalNameOffset)
46 ACCESSORS(ModuleInfoEntry, import_name, Object, kImportNameOffset)
47 SMI_ACCESSORS(ModuleInfoEntry, module_request, kModuleRequestOffset)
48 SMI_ACCESSORS(ModuleInfoEntry, cell_index, kCellIndexOffset)
49 SMI_ACCESSORS(ModuleInfoEntry, beg_pos, kBegPosOffset)
50 SMI_ACCESSORS(ModuleInfoEntry, end_pos, kEndPosOffset)
52 OBJECT_CONSTRUCTORS_IMPL(ModuleInfo, FixedArray)
53 CAST_ACCESSOR2(ModuleInfo)
55 FixedArray ModuleInfo::module_requests()
const {
56 return FixedArray::cast(
get(kModuleRequestsIndex));
59 FixedArray ModuleInfo::special_exports()
const {
60 return FixedArray::cast(
get(kSpecialExportsIndex));
63 FixedArray ModuleInfo::regular_exports()
const {
64 return FixedArray::cast(
get(kRegularExportsIndex));
67 FixedArray ModuleInfo::regular_imports()
const {
68 return FixedArray::cast(
get(kRegularImportsIndex));
71 FixedArray ModuleInfo::namespace_imports()
const {
72 return FixedArray::cast(
get(kNamespaceImportsIndex));
75 FixedArray ModuleInfo::module_request_positions()
const {
76 return FixedArray::cast(
get(kModuleRequestPositionsIndex));
80 bool ModuleInfo::Equals(ModuleInfo other)
const {
81 return regular_exports() == other->regular_exports() &&
82 regular_imports() == other->regular_imports() &&
83 special_exports() == other->special_exports() &&
84 namespace_imports() == other->namespace_imports() &&
85 module_requests() == other->module_requests() &&
86 module_request_positions() == other->module_request_positions();
93 #include "src/objects/object-macros-undef.h" 95 #endif // V8_OBJECTS_MODULE_INL_H_