script.tq 1.68 KB
Newer Older
Tobias Tebbi's avatar
Tobias Tebbi committed
1 2 3 4
// 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.

5 6 7 8 9 10 11 12 13 14 15
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
Tobias Tebbi's avatar
Tobias Tebbi committed
16
extern class Script extends Struct {
17 18 19 20
  // [source]: the script source.
  source: String|Undefined;

  // [name]: the script name.
Tobias Tebbi's avatar
Tobias Tebbi committed
21
  name: Object;
22 23

  // [line_offset]: script line offset in resource from where it was extracted.
Tobias Tebbi's avatar
Tobias Tebbi committed
24
  line_offset: Smi;
25 26 27

  // [column_offset]: script column offset in resource from where it was
  // extracted.
Tobias Tebbi's avatar
Tobias Tebbi committed
28
  column_offset: Smi;
29 30 31 32

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

Tobias Tebbi's avatar
Tobias Tebbi committed
33
  script_type: Smi;
34 35 36 37 38

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

  // [id]: the script id.
Tobias Tebbi's avatar
Tobias Tebbi committed
39
  id: Smi;
40 41 42

  eval_from_shared_or_wrapped_arguments: SharedFunctionInfo|FixedArray|
      Undefined;
Tobias Tebbi's avatar
Tobias Tebbi committed
43
  eval_from_position: Smi|Foreign;  // Smi or Managed<wasm::NativeModule>
44 45 46 47 48 49 50 51 52
  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
Tobias Tebbi's avatar
Tobias Tebbi committed
53
  source_mapping_url: Object;
54 55 56

  // [host_defined_options]: Options defined by the embedder.
  host_defined_options: FixedArray;
Tobias Tebbi's avatar
Tobias Tebbi committed
57
}