1// Copyright 2019 the V8 project authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5type SourceTextModuleInfo extends FixedArray; 6 7bitfield struct SourceTextModuleFlags extends uint31 { 8 async: bool: 1 bit; 9 async_evaluating: bool: 1 bit; 10} 11 12@generateCppClass 13extern class SourceTextModule extends Module { 14 // The code representing this module, or an abstraction thereof. 15 code: SharedFunctionInfo|JSFunction|JSGeneratorObject|SourceTextModuleInfo; 16 17 // Arrays of cells corresponding to regular exports and regular imports. 18 // A cell's position in the array is determined by the cell index of the 19 // associated module entry (which coincides with the variable index of the 20 // associated variable). 21 regular_exports: FixedArray; 22 regular_imports: FixedArray; 23 24 // Modules imported or re-exported by this module. 25 // Corresponds 1-to-1 to the module specifier strings in 26 // SourceTextModuleInfo::module_requests. 27 requested_modules: FixedArray; 28 29 // Script from which the module originates. 30 script: Script; 31 32 // The value of import.meta inside of this module. 33 // Lazily initialized on first access. It's the hole before first access and 34 // a JSObject afterwards. 35 import_meta: TheHole|JSObject; 36 37 async_parent_modules: ArrayList; 38 top_level_capability: JSPromise|Undefined; 39 40 // TODO(neis): Don't store those in the module object? 41 dfs_index: Smi; 42 dfs_ancestor_index: Smi; 43 44 // The number of currently evaluating async dependencies of this module. 45 pending_async_dependencies: Smi; 46 47 flags: SmiTagged<SourceTextModuleFlags>; 48} 49 50@generateCppClass 51@generatePrint 52extern class ModuleRequest extends Struct { 53 specifier: String; 54 55 // Import assertions are stored in this array in the form: 56 // [key1, value1, location1, key2, value2, location2, ...] 57 import_assertions: FixedArray; 58} 59 60@generateCppClass 61extern class SourceTextModuleInfoEntry extends Struct { 62 export_name: String|Undefined; 63 local_name: String|Undefined; 64 import_name: String|Undefined; 65 module_request: Smi; 66 cell_index: Smi; 67 beg_pos: Smi; 68 end_pos: Smi; 69} 70