summaryrefslogtreecommitdiff
path: root/deps/v8/src/wasm/wasm-objects.h
diff options
context:
space:
mode:
authorMichaël Zasso <targos@protonmail.com>2019-08-16 11:32:46 +0200
committerMichaël Zasso <targos@protonmail.com>2019-08-19 09:25:23 +0200
commite31f0a7d25668d3c1531294d2ef44a9f3bde4ef4 (patch)
tree6c6bed9804be9df6162b2483f0a56f371f66464d /deps/v8/src/wasm/wasm-objects.h
parentec16fdae540adaf710b1a86c620170b2880088f0 (diff)
downloadandroid-node-v8-e31f0a7d25668d3c1531294d2ef44a9f3bde4ef4.tar.gz
android-node-v8-e31f0a7d25668d3c1531294d2ef44a9f3bde4ef4.tar.bz2
android-node-v8-e31f0a7d25668d3c1531294d2ef44a9f3bde4ef4.zip
deps: update V8 to 7.7.299.4
PR-URL: https://github.com/nodejs/node/pull/28918 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'deps/v8/src/wasm/wasm-objects.h')
-rw-r--r--deps/v8/src/wasm/wasm-objects.h117
1 files changed, 87 insertions, 30 deletions
diff --git a/deps/v8/src/wasm/wasm-objects.h b/deps/v8/src/wasm/wasm-objects.h
index 1e6ced0b76..1200f7040a 100644
--- a/deps/v8/src/wasm/wasm-objects.h
+++ b/deps/v8/src/wasm/wasm-objects.h
@@ -40,15 +40,17 @@ class SeqOneByteString;
class WasmCapiFunction;
class WasmDebugInfo;
class WasmExceptionTag;
+class WasmExportedFunction;
class WasmInstanceObject;
+class WasmJSFunction;
class WasmModuleObject;
-class WasmExportedFunction;
+class WasmIndirectFunctionTable;
template <class CppType>
class Managed;
#define DECL_OPTIONAL_ACCESSORS(name, type) \
- V8_INLINE bool has_##name(); \
+ DECL_GETTER(has_##name, bool) \
DECL_ACCESSORS(name, type)
// A helper for an entry in an indirect function table (IFT).
@@ -60,7 +62,11 @@ class Managed;
// - target = entrypoint to Wasm code or import wrapper code
class IndirectFunctionTableEntry {
public:
- inline IndirectFunctionTableEntry(Handle<WasmInstanceObject>, int index);
+ inline IndirectFunctionTableEntry(Handle<WasmInstanceObject>, int table_index,
+ int entry_index);
+
+ inline IndirectFunctionTableEntry(Handle<WasmIndirectFunctionTable> table,
+ int entry_index);
void clear();
V8_EXPORT_PRIVATE void Set(int sig_id,
@@ -68,14 +74,13 @@ class IndirectFunctionTableEntry {
int target_func_index);
void Set(int sig_id, Address call_target, Object ref);
- void CopyFrom(const IndirectFunctionTableEntry& that);
-
- Object object_ref();
- int sig_id();
- Address target();
+ Object object_ref() const;
+ int sig_id() const;
+ Address target() const;
private:
Handle<WasmInstanceObject> const instance_;
+ Handle<WasmIndirectFunctionTable> const table_;
int const index_;
};
@@ -292,6 +297,7 @@ class V8_EXPORT_PRIVATE WasmTableObject : public JSObject {
static void Fill(Isolate* isolate, Handle<WasmTableObject> table,
uint32_t start, Handle<Object> entry, uint32_t count);
+ // TODO(mstarzinger): Unify these three methods into one.
static void UpdateDispatchTables(Isolate* isolate,
Handle<WasmTableObject> table,
int entry_index, wasm::FunctionSig* sig,
@@ -300,6 +306,10 @@ class V8_EXPORT_PRIVATE WasmTableObject : public JSObject {
static void UpdateDispatchTables(Isolate* isolate,
Handle<WasmTableObject> table,
int entry_index,
+ Handle<WasmJSFunction> function);
+ static void UpdateDispatchTables(Isolate* isolate,
+ Handle<WasmTableObject> table,
+ int entry_index,
Handle<WasmCapiFunction> capi_function);
static void ClearDispatchTables(Isolate* isolate,
@@ -312,14 +322,12 @@ class V8_EXPORT_PRIVATE WasmTableObject : public JSObject {
int func_index);
// This function reads the content of a function table entry and returns it
- // through the out parameters {is_valid}, {is_null}, {instance}, and
- // {function_index}.
- static void GetFunctionTableEntry(Isolate* isolate,
- Handle<WasmTableObject> table,
- int entry_index, bool* is_valid,
- bool* is_null,
- MaybeHandle<WasmInstanceObject>* instance,
- int* function_index);
+ // through the out parameters {is_valid}, {is_null}, {instance},
+ // {function_index}, and {maybe_js_function}.
+ static void GetFunctionTableEntry(
+ Isolate* isolate, Handle<WasmTableObject> table, int entry_index,
+ bool* is_valid, bool* is_null, MaybeHandle<WasmInstanceObject>* instance,
+ int* function_index, MaybeHandle<WasmJSFunction>* maybe_js_function);
OBJECT_CONSTRUCTORS(WasmTableObject, JSObject);
};
@@ -406,7 +414,7 @@ class WasmGlobalObject : public JSObject {
inline void SetF32(float value);
inline void SetF64(double value);
inline void SetAnyRef(Handle<Object> value);
- inline bool SetAnyFunc(Isolate* isolate, Handle<Object> value);
+ inline bool SetFuncRef(Isolate* isolate, Handle<Object> value);
private:
// This function returns the address of the global's data in the
@@ -431,12 +439,11 @@ class WasmInstanceObject : public JSObject {
DECL_OPTIONAL_ACCESSORS(imported_mutable_globals_buffers, FixedArray)
DECL_OPTIONAL_ACCESSORS(debug_info, WasmDebugInfo)
DECL_OPTIONAL_ACCESSORS(tables, FixedArray)
+ DECL_OPTIONAL_ACCESSORS(indirect_function_tables, FixedArray)
DECL_ACCESSORS(imported_function_refs, FixedArray)
DECL_OPTIONAL_ACCESSORS(indirect_function_table_refs, FixedArray)
DECL_OPTIONAL_ACCESSORS(managed_native_allocations, Foreign)
DECL_OPTIONAL_ACCESSORS(exceptions_table, FixedArray)
- DECL_ACCESSORS(undefined_value, Oddball)
- DECL_ACCESSORS(null_value, Oddball)
DECL_ACCESSORS(centry_stub, Code)
DECL_OPTIONAL_ACCESSORS(wasm_exported_functions, FixedArray)
DECL_PRIMITIVE_ACCESSORS(memory_start, byte*)
@@ -482,7 +489,6 @@ class WasmInstanceObject : public JSObject {
V(kOptionalPaddingOffset, POINTER_SIZE_PADDING(kOptionalPaddingOffset)) \
V(kGlobalsStartOffset, kSystemPointerSize) \
V(kImportedMutableGlobalsOffset, kSystemPointerSize) \
- V(kUndefinedValueOffset, kTaggedSize) \
V(kIsolateRootOffset, kSystemPointerSize) \
V(kJumpTableStartOffset, kSystemPointerSize) \
/* End of often-accessed fields. */ \
@@ -495,9 +501,9 @@ class WasmInstanceObject : public JSObject {
V(kImportedMutableGlobalsBuffersOffset, kTaggedSize) \
V(kDebugInfoOffset, kTaggedSize) \
V(kTablesOffset, kTaggedSize) \
+ V(kIndirectFunctionTablesOffset, kTaggedSize) \
V(kManagedNativeAllocationsOffset, kTaggedSize) \
V(kExceptionsTableOffset, kTaggedSize) \
- V(kNullValueOffset, kTaggedSize) \
V(kCEntryStubOffset, kTaggedSize) \
V(kWasmExportedFunctionsOffset, kTaggedSize) \
V(kRealStackLimitAddressOffset, kSystemPointerSize) \
@@ -526,7 +532,6 @@ class WasmInstanceObject : public JSObject {
static constexpr uint16_t kTaggedFieldOffsets[] = {
kImportedFunctionRefsOffset,
kIndirectFunctionTableRefsOffset,
- kUndefinedValueOffset,
kModuleObjectOffset,
kExportsObjectOffset,
kNativeContextOffset,
@@ -536,18 +541,17 @@ class WasmInstanceObject : public JSObject {
kImportedMutableGlobalsBuffersOffset,
kDebugInfoOffset,
kTablesOffset,
+ kIndirectFunctionTablesOffset,
kManagedNativeAllocationsOffset,
kExceptionsTableOffset,
- kNullValueOffset,
kCEntryStubOffset,
kWasmExportedFunctionsOffset};
V8_EXPORT_PRIVATE const wasm::WasmModule* module();
V8_EXPORT_PRIVATE static bool EnsureIndirectFunctionTableWithMinimumSize(
- Handle<WasmInstanceObject> instance, uint32_t minimum_size);
-
- bool has_indirect_function_table();
+ Handle<WasmInstanceObject> instance, int table_index,
+ uint32_t minimum_size);
V8_EXPORT_PRIVATE void SetRawMemory(byte* mem_start, size_t mem_size);
@@ -561,11 +565,15 @@ class WasmInstanceObject : public JSObject {
Address GetCallTarget(uint32_t func_index);
+ static int IndirectFunctionTableSize(Isolate* isolate,
+ Handle<WasmInstanceObject> instance,
+ uint32_t table_index);
+
// Copies table entries. Returns {false} if the ranges are out-of-bounds.
static bool CopyTableEntries(Isolate* isolate,
Handle<WasmInstanceObject> instance,
- uint32_t table_src_index,
- uint32_t table_dst_index, uint32_t dst,
+ uint32_t table_dst_index,
+ uint32_t table_src_index, uint32_t dst,
uint32_t src,
uint32_t count) V8_WARN_UNUSED_RESULT;
@@ -597,6 +605,14 @@ class WasmInstanceObject : public JSObject {
int index,
Handle<WasmExportedFunction> val);
+ // Imports a constructed {WasmJSFunction} into the indirect function table of
+ // this instance. Note that this might trigger wrapper compilation, since a
+ // {WasmJSFunction} is instance-independent and just wraps a JS callable.
+ static void ImportWasmJSFunctionIntoTable(Isolate* isolate,
+ Handle<WasmInstanceObject> instance,
+ int table_index, int entry_index,
+ Handle<WasmJSFunction> js_function);
+
OBJECT_CONSTRUCTORS(WasmInstanceObject, JSObject);
private:
@@ -681,6 +697,12 @@ class WasmJSFunction : public JSFunction {
static Handle<WasmJSFunction> New(Isolate* isolate, wasm::FunctionSig* sig,
Handle<JSReceiver> callable);
+ JSReceiver GetCallable() const;
+ // Deserializes the signature of this function using the provided zone. Note
+ // that lifetime of the signature is hence directly coupled to the zone.
+ wasm::FunctionSig* GetSignature(Zone* zone);
+ bool MatchesSignature(wasm::FunctionSig* sig);
+
DECL_CAST(WasmJSFunction)
OBJECT_CONSTRUCTORS(WasmJSFunction, JSFunction);
};
@@ -704,6 +726,34 @@ class WasmCapiFunction : public JSFunction {
OBJECT_CONSTRUCTORS(WasmCapiFunction, JSFunction);
};
+class WasmIndirectFunctionTable : public Struct {
+ public:
+ DECL_PRIMITIVE_ACCESSORS(size, uint32_t)
+ DECL_PRIMITIVE_ACCESSORS(sig_ids, uint32_t*)
+ DECL_PRIMITIVE_ACCESSORS(targets, Address*)
+ DECL_OPTIONAL_ACCESSORS(managed_native_allocations, Foreign)
+ DECL_ACCESSORS(refs, FixedArray)
+
+ V8_EXPORT_PRIVATE static Handle<WasmIndirectFunctionTable> New(
+ Isolate* isolate, uint32_t size);
+ static void Resize(Isolate* isolate, Handle<WasmIndirectFunctionTable> table,
+ uint32_t new_size);
+
+ DECL_CAST(WasmIndirectFunctionTable)
+
+ DECL_PRINTER(WasmIndirectFunctionTable)
+ DECL_VERIFIER(WasmIndirectFunctionTable)
+
+ DEFINE_FIELD_OFFSET_CONSTANTS(
+ HeapObject::kHeaderSize,
+ TORQUE_GENERATED_WASM_INDIRECT_FUNCTION_TABLE_FIELDS)
+
+ STATIC_ASSERT(kStartOfStrongFieldsOffset == kManagedNativeAllocationsOffset);
+ using BodyDescriptor = FlexibleBodyDescriptor<kStartOfStrongFieldsOffset>;
+
+ OBJECT_CONSTRUCTORS(WasmIndirectFunctionTable, Struct);
+};
+
class WasmCapiFunctionData : public Struct {
public:
DECL_PRIMITIVE_ACCESSORS(call_target, Address)
@@ -734,6 +784,9 @@ class WasmExportedFunctionData : public Struct {
DECL_ACCESSORS(instance, WasmInstanceObject)
DECL_INT_ACCESSORS(jump_table_offset)
DECL_INT_ACCESSORS(function_index)
+ DECL_ACCESSORS(c_wrapper_code, Object)
+ DECL_ACCESSORS(wasm_call_target, Smi)
+ DECL_INT_ACCESSORS(packed_args_size)
DECL_CAST(WasmExportedFunctionData)
@@ -754,6 +807,10 @@ class WasmExportedFunctionData : public Struct {
// {SharedFunctionInfo::HasWasmJSFunctionData} predicate.
class WasmJSFunctionData : public Struct {
public:
+ DECL_INT_ACCESSORS(serialized_return_count)
+ DECL_INT_ACCESSORS(serialized_parameter_count)
+ DECL_ACCESSORS(serialized_signature, PodArray<wasm::ValueType>)
+ DECL_ACCESSORS(callable, JSReceiver)
DECL_ACCESSORS(wrapper_code, Code)
DECL_CAST(WasmJSFunctionData)
@@ -847,8 +904,8 @@ class WasmDebugInfo : public Struct {
Address frame_pointer,
int frame_index);
- V8_EXPORT_PRIVATE static Handle<JSFunction> GetCWasmEntry(
- Handle<WasmDebugInfo>, wasm::FunctionSig*);
+ V8_EXPORT_PRIVATE static Handle<Code> GetCWasmEntry(Handle<WasmDebugInfo>,
+ wasm::FunctionSig*);
OBJECT_CONSTRUCTORS(WasmDebugInfo, Struct);
};