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 5@useParentTypeChecker 6type PodArrayOfWasmValueType extends ByteArray 7 constexpr 'PodArray<wasm::ValueType>'; 8@useParentTypeChecker 9type ManagedWasmNativeModule extends Foreign 10 constexpr 'Managed<wasm::NativeModule>'; 11type WasmValueType extends uint8 constexpr 'wasm::ValueType::Kind'; 12 13extern class WasmInstanceObject extends JSObject; 14 15extern class WasmExportedFunctionData extends Struct { 16 wrapper_code: Code; 17 instance: WasmInstanceObject; 18 jump_table_offset: Smi; 19 function_index: Smi; 20 signature: Foreign; 21 call_count: Smi; 22 // The remaining fields are for fast calling from C++. The contract is 23 // that they are lazily populated, and either all will be present or none. 24 c_wrapper_code: Object; 25 wasm_call_target: Smi|Foreign; 26 packed_args_size: Smi; 27} 28 29extern class WasmJSFunctionData extends Struct { 30 callable: JSReceiver; 31 wrapper_code: Code; 32 wasm_to_js_wrapper_code: Code; 33 serialized_return_count: Smi; 34 serialized_parameter_count: Smi; 35 serialized_signature: PodArrayOfWasmValueType; 36} 37 38@export 39class WasmCapiFunctionData extends HeapObject { 40 call_target: RawPtr; 41 embedder_data: Foreign; // Managed<wasm::FuncData> 42 wrapper_code: Code; 43 serialized_signature: PodArrayOfWasmValueType; 44} 45 46extern class WasmIndirectFunctionTable extends Struct { 47 size: uint32; 48 @if(TAGGED_SIZE_8_BYTES) optional_padding: uint32; 49 @ifnot(TAGGED_SIZE_8_BYTES) optional_padding: void; 50 sig_ids: RawPtr; 51 targets: RawPtr; 52 managed_native_allocations: Foreign|Undefined; 53 refs: FixedArray; 54} 55 56@generateCppClass 57extern class WasmExceptionTag extends Struct { 58 // Note that this index is only useful for debugging purposes and it is not 59 // unique across modules. The GC however does not allow objects without at 60 // least one field, hence this also serves as a padding field for now. 61 index: Smi; 62} 63 64extern class WasmModuleObject extends JSObject { 65 native_module: ManagedWasmNativeModule; 66 export_wrappers: FixedArray; 67 script: Script; 68} 69 70extern class WasmTableObject extends JSObject { 71 instance: WasmInstanceObject|Undefined; 72 entries: FixedArray; 73 current_length: Smi; 74 maximum_length: Smi|HeapNumber|Undefined; 75 dispatch_tables: FixedArray; 76 raw_type: Smi; 77} 78 79extern class WasmMemoryObject extends JSObject { 80 array_buffer: JSArrayBuffer; 81 maximum_pages: Smi; 82 instances: WeakArrayList|Undefined; 83} 84 85extern class WasmGlobalObject extends JSObject { 86 instance: WasmInstanceObject|Undefined; 87 untagged_buffer: JSArrayBuffer|Undefined; 88 tagged_buffer: FixedArray|Undefined; 89 offset: Smi; 90 raw_type: Smi; 91 is_mutable: Smi; 92} 93 94extern class WasmExceptionObject extends JSObject { 95 serialized_signature: PodArrayOfWasmValueType; 96 exception_tag: HeapObject; 97} 98 99type WasmExportedFunction extends JSFunction; 100 101extern class AsmWasmData extends Struct { 102 managed_native_module: ManagedWasmNativeModule; 103 export_wrappers: FixedArray; 104 uses_bitset: HeapNumber; 105} 106 107@generateCppClass 108extern class WasmTypeInfo extends Foreign { 109 parent: Map; 110 subtypes: ArrayList; 111} 112 113@generateCppClass 114extern class WasmStruct extends HeapObject { 115} 116 117@generateCppClass 118extern class WasmArray extends HeapObject { 119 length: uint32; 120 121 @if(TAGGED_SIZE_8_BYTES) optional_padding: uint32; 122 @ifnot(TAGGED_SIZE_8_BYTES) optional_padding: void; 123} 124