5 #ifndef V8_OBJECTS_MODULE_H_ 6 #define V8_OBJECTS_MODULE_H_ 8 #include "src/objects.h" 9 #include "src/objects/fixed-array.h" 10 #include "src/objects/js-objects.h" 13 #include "src/objects/object-macros.h" 21 class JSModuleNamespace;
22 class ModuleDescriptor;
24 class ModuleInfoEntry;
39 DECL_ACCESSORS(code,
Object)
53 DECL_INT_ACCESSORS(hash)
56 DECL_INT_ACCESSORS(status)
84 DECL_ACCESSORS(script,
Script)
89 DECL_ACCESSORS(import_meta,
Object)
98 static V8_WARN_UNUSED_RESULT
bool Instantiate(
100 v8::Module::ResolveCallback callback);
106 Cell* GetCell(
int cell_index);
112 static int ImportIndex(
int cell_index);
113 static int ExportIndex(
int cell_index);
126 static const int kCodeOffset = HeapObject::kHeaderSize;
127 static const int kExportsOffset = kCodeOffset + kPointerSize;
128 static const int kRegularExportsOffset = kExportsOffset + kPointerSize;
129 static const int kRegularImportsOffset = kRegularExportsOffset + kPointerSize;
130 static const int kHashOffset = kRegularImportsOffset + kPointerSize;
131 static const int kModuleNamespaceOffset = kHashOffset + kPointerSize;
132 static const int kRequestedModulesOffset =
133 kModuleNamespaceOffset + kPointerSize;
134 static const int kStatusOffset = kRequestedModulesOffset + kPointerSize;
135 static const int kDfsIndexOffset = kStatusOffset + kPointerSize;
136 static const int kDfsAncestorIndexOffset = kDfsIndexOffset + kPointerSize;
137 static const int kExceptionOffset = kDfsAncestorIndexOffset + kPointerSize;
138 static const int kScriptOffset = kExceptionOffset + kPointerSize;
139 static const int kImportMetaOffset = kScriptOffset + kPointerSize;
140 static const int kSize = kImportMetaOffset + kPointerSize;
145 DECL_ACCESSORS(exception,
Object)
148 DECL_INT_ACCESSORS(dfs_index)
149 DECL_INT_ACCESSORS(dfs_ancestor_index)
182 static V8_WARN_UNUSED_RESULT
bool PrepareInstantiate(
184 v8::Module::ResolveCallback callback);
185 static V8_WARN_UNUSED_RESULT
bool FinishInstantiate(
188 static V8_WARN_UNUSED_RESULT
bool RunInitializationCode(
195 static V8_WARN_UNUSED_RESULT
bool MaybeTransitionComponent(
205 void SetStatus(Status status);
206 void RecordError(
Isolate* isolate);
210 void PrintStatusTransition(Status new_status);
213 DISALLOW_IMPLICIT_CONSTRUCTORS(
Module);
226 DECL_ACCESSORS(module,
Module)
242 kToStringTagFieldIndex,
246 static const int kModuleOffset = JSObject::kHeaderSize;
247 static const int kHeaderSize = kModuleOffset + kPointerSize;
249 static const int kSize = kHeaderSize + kPointerSize * kInObjectFieldCount;
268 inline FixedArray module_request_positions()
const;
271 int RegularExportCount()
const;
272 String RegularExportLocalName(
int i)
const;
273 int RegularExportCellIndex(
int i)
const;
284 kModuleRequestsIndex,
285 kSpecialExportsIndex,
286 kRegularExportsIndex,
287 kNamespaceImportsIndex,
288 kRegularImportsIndex,
289 kModuleRequestPositionsIndex,
293 kRegularExportLocalNameOffset,
294 kRegularExportCellIndexOffset,
295 kRegularExportExportNamesOffset,
307 DECL_ACCESSORS(export_name,
Object)
308 DECL_ACCESSORS(local_name,
Object)
309 DECL_ACCESSORS(import_name,
Object)
310 DECL_INT_ACCESSORS(module_request)
311 DECL_INT_ACCESSORS(cell_index)
312 DECL_INT_ACCESSORS(beg_pos)
313 DECL_INT_ACCESSORS(end_pos)
319 int module_request,
int cell_index,
320 int beg_pos,
int end_pos);
322 static const int kExportNameOffset = HeapObject::kHeaderSize;
323 static const int kLocalNameOffset = kExportNameOffset + kPointerSize;
324 static const int kImportNameOffset = kLocalNameOffset + kPointerSize;
325 static const int kModuleRequestOffset = kImportNameOffset + kPointerSize;
326 static const int kCellIndexOffset = kModuleRequestOffset + kPointerSize;
327 static const int kBegPosOffset = kCellIndexOffset + kPointerSize;
328 static const int kEndPosOffset = kBegPosOffset + kPointerSize;
329 static const int kSize = kEndPosOffset + kPointerSize;
338 #include "src/objects/object-macros-undef.h" 340 #endif // V8_OBJECTS_MODULE_H_