| // 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. |
| |
| @useParentTypeChecker |
| type PodArrayOfWasmValueType extends ByteArray |
| constexpr 'PodArray<wasm::ValueType>'; |
| @useParentTypeChecker |
| type ManagedWasmNativeModule extends Foreign |
| constexpr 'Managed<wasm::NativeModule>'; |
| |
| extern class WasmInstanceObject extends JSObject; |
| |
| @generateCppClass |
| extern class WasmFunctionData extends Foreign { |
| // This is the "reference" value that must be passed along in the "instance" |
| // register when calling the given function. It is either the target instance, |
| // or a pair holding the target instance and the callable; currently the |
| // latter is the case when the function being called is defined in JavaScript |
| // or via the C-API. |
| // For imported functions, this value equals the respective entry in |
| // the module's imported_function_refs array. |
| ref: WasmInstanceObject|Tuple2; |
| } |
| |
| extern class WasmExportedFunctionData extends WasmFunctionData { |
| wrapper_code: Code; |
| instance: WasmInstanceObject; |
| function_index: Smi; |
| signature: Foreign; |
| wrapper_budget: Smi; |
| // The remaining fields are for fast calling from C++. The contract is |
| // that they are lazily populated, and either all will be present or none. |
| c_wrapper_code: Object; |
| packed_args_size: Smi; |
| } |
| |
| extern class WasmJSFunctionData extends WasmFunctionData { |
| wrapper_code: Code; |
| wasm_to_js_wrapper_code: Code; |
| serialized_return_count: Smi; |
| serialized_parameter_count: Smi; |
| serialized_signature: PodArrayOfWasmValueType; |
| } |
| |
| // TODO(jkummerow): Derive from WasmFunctionData. |
| @export |
| class WasmCapiFunctionData extends HeapObject { |
| call_target: RawPtr; |
| embedder_data: Foreign; // Managed<wasm::FuncData> |
| wrapper_code: Code; |
| serialized_signature: PodArrayOfWasmValueType; |
| } |
| |
| extern class WasmIndirectFunctionTable extends Struct { |
| size: uint32; |
| @if(TAGGED_SIZE_8_BYTES) optional_padding: uint32; |
| @ifnot(TAGGED_SIZE_8_BYTES) optional_padding: void; |
| sig_ids: RawPtr; |
| targets: RawPtr; |
| managed_native_allocations: Foreign|Undefined; |
| refs: FixedArray; |
| } |
| |
| @generateCppClass |
| extern class WasmExceptionTag extends Struct { |
| // Note that this index is only useful for debugging purposes and it is not |
| // unique across modules. The GC however does not allow objects without at |
| // least one field, hence this also serves as a padding field for now. |
| index: Smi; |
| } |
| |
| extern class WasmModuleObject extends JSObject { |
| native_module: ManagedWasmNativeModule; |
| export_wrappers: FixedArray; |
| script: Script; |
| } |
| |
| extern class WasmTableObject extends JSObject { |
| instance: WasmInstanceObject|Undefined; |
| entries: FixedArray; |
| current_length: Smi; |
| maximum_length: Smi|HeapNumber|Undefined; |
| dispatch_tables: FixedArray; |
| raw_type: Smi; |
| } |
| |
| extern class WasmMemoryObject extends JSObject { |
| array_buffer: JSArrayBuffer; |
| maximum_pages: Smi; |
| instances: WeakArrayList|Undefined; |
| } |
| |
| extern class WasmGlobalObject extends JSObject { |
| instance: WasmInstanceObject|Undefined; |
| untagged_buffer: JSArrayBuffer|Undefined; |
| tagged_buffer: FixedArray|Undefined; |
| offset: Smi; |
| raw_type: Smi; |
| is_mutable: Smi; |
| } |
| |
| extern class WasmExceptionObject extends JSObject { |
| serialized_signature: PodArrayOfWasmValueType; |
| exception_tag: HeapObject; |
| } |
| |
| type WasmExportedFunction extends JSFunction; |
| |
| extern class AsmWasmData extends Struct { |
| managed_native_module: ManagedWasmNativeModule; |
| export_wrappers: FixedArray; |
| uses_bitset: HeapNumber; |
| } |
| |
| @generateCppClass |
| extern class WasmTypeInfo extends Foreign { |
| supertypes: FixedArray; |
| subtypes: ArrayList; |
| // In bytes, used for struct allocation. |
| instance_size: Smi; |
| } |
| |
| @generateCppClass |
| extern class WasmStruct extends HeapObject { |
| } |
| |
| @generateCppClass |
| extern class WasmArray extends HeapObject { |
| length: uint32; |
| |
| @if(TAGGED_SIZE_8_BYTES) optional_padding: uint32; |
| @ifnot(TAGGED_SIZE_8_BYTES) optional_padding: void; |
| } |