summaryrefslogtreecommitdiff
path: root/deps/v8/src/objects/source-text-module.tq
blob: a3d565c908f6d5f97fac823224addd47fea51409 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// Copyright 2019 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

type SourceTextModuleInfo extends FixedArray;

bitfield struct SourceTextModuleFlags extends uint31 {
  async: bool: 1 bit;
  async_evaluating_ordinal: uint32: 30 bit;
}

@generateCppClass
extern class SourceTextModule extends Module {
  // The code representing this module, or an abstraction thereof.
  code: SharedFunctionInfo|JSFunction|JSGeneratorObject;

  // Arrays of cells corresponding to regular exports and regular imports.
  // A cell's position in the array is determined by the cell index of the
  // associated module entry (which coincides with the variable index of the
  // associated variable).
  regular_exports: FixedArray;
  regular_imports: FixedArray;

  // Modules imported or re-exported by this module.
  // Corresponds 1-to-1 to the module specifier strings in
  // SourceTextModuleInfo::module_requests.
  requested_modules: FixedArray;

  // The value of import.meta inside of this module.
  // Lazily initialized on first access. It's the hole before first access and
  // a JSObject afterwards.
  @cppAcquireLoad @cppReleaseStore import_meta: TheHole|JSObject;

  // The first visited module of a cycle. For modules not in a cycle, this is
  // the module itself. It's the hole before the module state transitions to
  // kEvaluated.
  cycle_root: SourceTextModule|TheHole;

  async_parent_modules: ArrayList;

  // TODO(neis): Don't store those in the module object?
  dfs_index: Smi;
  dfs_ancestor_index: Smi;

  // The number of currently evaluating async dependencies of this module.
  pending_async_dependencies: Smi;

  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;

  // Source text position of the module request
  position: Smi;
}

@generateCppClass
extern class SourceTextModuleInfoEntry extends Struct {
  export_name: String|Undefined;
  local_name: String|Undefined;
  import_name: String|Undefined;
  module_request: Smi;
  cell_index: Smi;
  beg_pos: Smi;
  end_pos: Smi;
}