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 CompilationType extends int32 constexpr 'Script::CompilationType'; 6type CompilationState extends int32 constexpr 'Script::CompilationState'; 7 8bitfield struct ScriptFlags extends uint31 { 9 compilation_type: CompilationType: 1 bit; 10 compilation_state: CompilationState: 1 bit; 11 is_repl_mode: bool: 1 bit; 12 origin_options: int32: 4 bit; 13 // Whether an instrumentation breakpoint is set for this script (wasm only). 14 break_on_entry: bool: 1 bit; 15} 16 17extern class Script extends Struct { 18 // [source]: the script source. 19 source: String|Undefined; 20 21 // [name]: the script name. 22 name: Object; 23 24 // [line_offset]: script line offset in resource from where it was extracted. 25 line_offset: Smi; 26 27 // [column_offset]: script column offset in resource from where it was 28 // extracted. 29 column_offset: Smi; 30 31 // [context_data]: context data for the context this script was compiled in. 32 context_data: Smi|Undefined|Symbol; 33 34 script_type: Smi; 35 36 // [line_ends]: FixedArray of line ends positions. 37 line_ends: FixedArray|Undefined; 38 39 // [id]: the script id. 40 id: Smi; 41 42 // For scripts originating from eval: the SharedFunctionInfo contains the SFI 43 // for the script. For scripts wrapped as functions: the FixedArray contains 44 // the arguments. For web snapshots: the ObjectHashTable maps function start 45 // position to SFI index in shared_function_infos. 46 eval_from_shared_or_wrapped_arguments_or_sfi_table: SharedFunctionInfo| 47 FixedArray|ObjectHashTable|Undefined; 48 eval_from_position: Smi|Foreign; // Smi or Managed<wasm::NativeModule> 49 shared_function_infos: WeakFixedArray|WeakArrayList; 50 51 // [flags]: Holds an exciting bitfield. 52 flags: SmiTagged<ScriptFlags>; 53 54 // [source_url]: sourceURL from magic comment 55 source_url: String|Undefined; 56 57 // [source_mapping_url]: sourceMappingURL magic comment 58 source_mapping_url: Object; 59 60 // [host_defined_options]: Options defined by the embedder. 61 host_defined_options: FixedArray; 62 63 // TODO(cbruni, v8:12302): remove once module callback API is updated. 64 // Used to make sure we are backwards compatible with node to gaurantee 65 // the same lifetime for ScriptOrModule as the Script they originated. 66 @if(V8_SCRIPTORMODULE_LEGACY_LIFETIME) script_or_modules: ArrayList; 67} 68