2019-11-11 14:13:20 +00:00
|
|
|
// 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.
|
|
|
|
|
2020-10-21 19:33:52 +00:00
|
|
|
@useParentTypeChecker
|
2020-09-15 15:24:50 +00:00
|
|
|
type PodArrayOfWasmValueType extends ByteArray
|
2020-10-21 19:33:52 +00:00
|
|
|
constexpr 'PodArray<wasm::ValueType>';
|
|
|
|
@useParentTypeChecker
|
2020-09-15 15:24:50 +00:00
|
|
|
type ManagedWasmNativeModule extends Foreign
|
2020-10-21 19:33:52 +00:00
|
|
|
constexpr 'Managed<wasm::NativeModule>';
|
2020-09-15 15:24:50 +00:00
|
|
|
type WasmValueType extends uint8 constexpr 'wasm::ValueType::Kind';
|
|
|
|
|
2019-11-11 14:13:20 +00:00
|
|
|
extern class WasmInstanceObject extends JSObject;
|
|
|
|
|
|
|
|
extern class WasmExportedFunctionData extends Struct {
|
|
|
|
wrapper_code: Code;
|
|
|
|
instance: WasmInstanceObject;
|
|
|
|
jump_table_offset: Smi;
|
|
|
|
function_index: Smi;
|
2020-10-06 11:48:17 +00:00
|
|
|
signature: Foreign;
|
2020-11-11 17:23:19 +00:00
|
|
|
wrapper_budget: Smi;
|
2019-11-11 14:13:20 +00:00
|
|
|
// 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;
|
|
|
|
wasm_call_target: Smi|Foreign;
|
|
|
|
packed_args_size: Smi;
|
|
|
|
}
|
|
|
|
|
|
|
|
extern class WasmJSFunctionData extends Struct {
|
|
|
|
callable: JSReceiver;
|
|
|
|
wrapper_code: Code;
|
2020-10-09 08:12:25 +00:00
|
|
|
wasm_to_js_wrapper_code: Code;
|
2019-11-11 14:13:20 +00:00
|
|
|
serialized_return_count: Smi;
|
|
|
|
serialized_parameter_count: Smi;
|
2020-09-15 15:24:50 +00:00
|
|
|
serialized_signature: PodArrayOfWasmValueType;
|
2019-11-11 14:13:20 +00:00
|
|
|
}
|
|
|
|
|
2020-11-02 09:55:53 +00:00
|
|
|
@export
|
|
|
|
class WasmCapiFunctionData extends HeapObject {
|
2019-11-11 14:13:20 +00:00
|
|
|
call_target: RawPtr;
|
|
|
|
embedder_data: Foreign; // Managed<wasm::FuncData>
|
|
|
|
wrapper_code: Code;
|
2020-09-15 15:24:50 +00:00
|
|
|
serialized_signature: PodArrayOfWasmValueType;
|
2019-11-11 14:13:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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 {
|
2020-03-17 17:14:51 +00:00
|
|
|
// 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.
|
2019-11-11 14:13:20 +00:00
|
|
|
index: Smi;
|
|
|
|
}
|
|
|
|
|
|
|
|
extern class WasmModuleObject extends JSObject {
|
2020-09-15 15:24:50 +00:00
|
|
|
native_module: ManagedWasmNativeModule;
|
2019-11-11 14:13:20 +00:00
|
|
|
export_wrappers: FixedArray;
|
|
|
|
script: Script;
|
|
|
|
}
|
|
|
|
|
|
|
|
extern class WasmTableObject extends JSObject {
|
2020-09-18 15:22:35 +00:00
|
|
|
instance: WasmInstanceObject|Undefined;
|
2019-11-11 14:13:20 +00:00
|
|
|
entries: FixedArray;
|
2019-11-27 11:58:26 +00:00
|
|
|
current_length: Smi;
|
2019-11-11 14:13:20 +00:00
|
|
|
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 {
|
2020-09-14 08:05:52 +00:00
|
|
|
instance: WasmInstanceObject|Undefined;
|
2019-11-11 14:13:20 +00:00
|
|
|
untagged_buffer: JSArrayBuffer|Undefined;
|
|
|
|
tagged_buffer: FixedArray|Undefined;
|
|
|
|
offset: Smi;
|
[wasm-gc] Change ValueType representation to account for new types
Motivation:
Changes to the typed function references and gc proposals solidified
the notion of heap type, clarified nullable vs. non-nullable reference
types, and introduced rtts, which contain an integer depth field in
addition to a heap type. This required us to overhaul our ValueType
representation, which results in extensive changes.
To keep this CL "small", we do not try to implement the binary encoding
as described in the proposals, but rather devise a simpler one of our
own (see below). Also, we do not try to implement additional
functionality for the new types.
Changes:
- Introduce HeapType. Move heap types from ValueType to HeapType.
- Introduce Nullability for reference types.
- Rework ValueType helper methods.
- Introduce rtts in ValueType with an integer depth field. Include depth
in the ValueType encoding.
- Make the constructor of ValueType private, instead expose static
functions which explicitly state what they create.
- Change every switch statement on ValueType::Kind. Sometimes, we need
nested switches.
- Introduce temporary constants in ValueTypeCode for nullable types,
use them for decoding.
- In WasmGlobalObject, split 'flags' into 'raw_type' and 'is_mutable'.
- Change IsSubtypeOfRef to IsSubtypeOfHeap and implement changes in
subtyping.
- kWasmFuncRef initializers are now non-nullable. Initializers are
only required to be subtypes of the declared global type.
- Change tests and fuzzers as needed.
Bug: v8:7748
Change-Id: If41f783bd4128443b07e94188cea7dd53ab0bfa5
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2247657
Commit-Queue: Manos Koukoutos <manoskouk@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68408}
2020-06-18 11:24:07 +00:00
|
|
|
raw_type: Smi;
|
|
|
|
is_mutable: Smi;
|
2019-11-11 14:13:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
extern class WasmExceptionObject extends JSObject {
|
2020-09-15 15:24:50 +00:00
|
|
|
serialized_signature: PodArrayOfWasmValueType;
|
2019-11-11 14:13:20 +00:00
|
|
|
exception_tag: HeapObject;
|
|
|
|
}
|
|
|
|
|
|
|
|
type WasmExportedFunction extends JSFunction;
|
|
|
|
|
|
|
|
extern class AsmWasmData extends Struct {
|
2020-09-15 15:24:50 +00:00
|
|
|
managed_native_module: ManagedWasmNativeModule;
|
2019-11-11 14:13:20 +00:00
|
|
|
export_wrappers: FixedArray;
|
|
|
|
uses_bitset: HeapNumber;
|
|
|
|
}
|
2020-04-21 10:30:18 +00:00
|
|
|
|
2020-06-29 14:15:41 +00:00
|
|
|
@generateCppClass
|
|
|
|
extern class WasmTypeInfo extends Foreign {
|
Revert "[wasm-gc] Remove abstract rtts"
This reverts commit b77deeca4bd65b006a3a6c7344c2bbabd4514122.
Reason for revert: MSVC compile fails: https://ci.chromium.org/ui/p/v8/builders/ci/V8%20Win64%20-%20msvc/16535/overview
Original change's description:
> [wasm-gc] Remove abstract rtts
>
> In the latest wasm-gc spec, rtts of abstract types are no longer
> allowed. Consequently, canonical rtts of concrete types always have
> a depth of 0.
>
> Changes:
> - Change the immediate argument of rtts to a type index over a heap
> type. Abstract it with TypeIndexImmediate in function body decoding.
> This affects:
> value_type.h, read_value_type(), decoding of relevant opcodes,
> wasm subtyping, WasmInitExpr, consume_init_expr(), and
> wasm-module-builder.cc.
> - In function-body-decoder-impl.h, update rtt.canon to always produce
> an rtt of depth 0.
> - Pass a unit32_t type index over a HeapType to all rtt-related
> utilities.
> - Remove infrastructure for abstract-type rtts from the wasm compilers,
> setup-heap-internal.cc, roots.h, and module-instantiate.cc.
> - Remove ObjectReferenceKnowledge::rtt_is_i31. Remove related branches
> from ref.test, ref.cast and br_on_cast implementations in the wasm
> compilers.
> - Remove unused 'parent' field from WasmTypeInfo.
> - Make the parent argument optional in NewWasmTypeInfo, CreateStructMap,
> and CreateArrayMap.
> - Use more convenient arguments in IsHeapSubtypeOf.
> - Update tests.
>
> Bug: v8:7748
> Change-Id: Ib45efe0741e6558c9b291fc8b4a75ae303146bdc
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2642248
> Commit-Queue: Manos Koukoutos <manoskouk@chromium.org>
> Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
> Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#72321}
TBR=ulan@chromium.org,jkummerow@chromium.org,manoskouk@chromium.org
Change-Id: I2f0d97f1a34f7c81c5a97d7c37925cb84c66eea3
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: v8:7748
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2650206
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#72322}
2021-01-26 14:46:14 +00:00
|
|
|
parent: Map;
|
2020-11-11 16:09:47 +00:00
|
|
|
supertypes: FixedArray;
|
2020-07-07 12:36:00 +00:00
|
|
|
subtypes: ArrayList;
|
2020-06-29 14:15:41 +00:00
|
|
|
}
|
|
|
|
|
2020-04-21 10:30:18 +00:00
|
|
|
@generateCppClass
|
|
|
|
extern class WasmStruct extends HeapObject {
|
|
|
|
}
|
2020-05-07 14:55:58 +00:00
|
|
|
|
|
|
|
@generateCppClass
|
|
|
|
extern class WasmArray extends HeapObject {
|
|
|
|
length: uint32;
|
|
|
|
|
|
|
|
@if(TAGGED_SIZE_8_BYTES) optional_padding: uint32;
|
|
|
|
@ifnot(TAGGED_SIZE_8_BYTES) optional_padding: void;
|
|
|
|
}
|