summaryrefslogtreecommitdiff
path: root/chromium/v8/src/objects/script.tq
blob: cac5ceb3ba46f94e1b84dfe8e0fc5007cbbf4c58 (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
// 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 CompilationType extends int32 constexpr 'Script::CompilationType';
type CompilationState extends int32 constexpr 'Script::CompilationState';

bitfield struct ScriptFlags extends uint31 {
  compilation_type: CompilationType: 1 bit;
  compilation_state: CompilationState: 1 bit;
  is_repl_mode: bool: 1 bit;
  origin_options: int32: 4 bit;
}

@generateCppClass
extern class Script extends Struct {
  // [source]: the script source.
  source: String|Undefined;

  // [name]: the script name.
  name: Object;

  // [line_offset]: script line offset in resource from where it was extracted.
  line_offset: Smi;

  // [column_offset]: script column offset in resource from where it was
  // extracted.
  column_offset: Smi;

  // [context_data]: context data for the context this script was compiled in.
  context_data: Smi|Undefined|Symbol;

  script_type: Smi;

  // [line_ends]: FixedArray of line ends positions.
  line_ends: FixedArray|Undefined;

  // [id]: the script id.
  id: Smi;

  eval_from_shared_or_wrapped_arguments: SharedFunctionInfo|FixedArray|
      Undefined;
  eval_from_position: Smi|Foreign;  // Smi or Managed<wasm::NativeModule>
  shared_function_infos: WeakFixedArray|WeakArrayList;

  // [flags]: Holds an exciting bitfield.
  flags: SmiTagged<ScriptFlags>;

  // [source_url]: sourceURL from magic comment
  source_url: String|Undefined;

  // [source_mapping_url]: sourceMappingURL magic comment
  source_mapping_url: Object;

  // [host_defined_options]: Options defined by the embedder.
  host_defined_options: FixedArray;
}