• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_ordinal: uint32: 30 bit;
10}
11
12extern class SourceTextModule extends Module {
13  // The code representing this module, or an abstraction thereof.
14  code: SharedFunctionInfo|JSFunction|JSGeneratorObject;
15
16  // Arrays of cells corresponding to regular exports and regular imports.
17  // A cell's position in the array is determined by the cell index of the
18  // associated module entry (which coincides with the variable index of the
19  // associated variable).
20  regular_exports: FixedArray;
21  regular_imports: FixedArray;
22
23  // Modules imported or re-exported by this module.
24  // Corresponds 1-to-1 to the module specifier strings in
25  // SourceTextModuleInfo::module_requests.
26  requested_modules: FixedArray;
27
28  // The value of import.meta inside of this module.
29  // Lazily initialized on first access. It's the hole before first access and
30  // a JSObject afterwards.
31  @cppAcquireLoad @cppReleaseStore import_meta: TheHole|JSObject;
32
33  // The first visited module of a cycle. For modules not in a cycle, this is
34  // the module itself. It's the hole before the module state transitions to
35  // kEvaluated.
36  cycle_root: SourceTextModule|TheHole;
37
38  async_parent_modules: ArrayList;
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
50extern class ModuleRequest extends Struct {
51  specifier: String;
52
53  // Import assertions are stored in this array in the form:
54  // [key1, value1, location1, key2, value2, location2, ...]
55  import_assertions: FixedArray;
56
57  // Source text position of the module request
58  position: Smi;
59}
60
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