| Index: src/wasm/wasm-objects.h
|
| diff --git a/src/wasm/wasm-objects.h b/src/wasm/wasm-objects.h
|
| index bc4e4c2070d0e378e8f5124615335526eeaea745..d87a8dc755cb84d99c94de3cd28dd98faf956af0 100644
|
| --- a/src/wasm/wasm-objects.h
|
| +++ b/src/wasm/wasm-objects.h
|
| @@ -13,6 +13,12 @@
|
| #include "src/wasm/wasm-limits.h"
|
| #include "src/wasm/wasm-module.h"
|
|
|
| +#include "src/heap/heap-inl.h"
|
| +#include "src/heap/heap.h"
|
| +
|
| +// Has to be the last include (doesn't have include guards)
|
| +#include "src/objects/object-macros.h"
|
| +
|
| namespace v8 {
|
| namespace internal {
|
| namespace wasm {
|
| @@ -25,34 +31,42 @@ class WasmDebugInfo;
|
| class WasmInstanceObject;
|
| class WasmInstanceWrapper;
|
|
|
| -#define DECLARE_CASTS(name) \
|
| - static bool Is##name(Object* object); \
|
| - static name* cast(Object* object)
|
| +#define DECL_OOL_QUERY(type) static bool Is##type(Object* object);
|
| +#define DECL_OOL_CAST(type) static type* cast(Object* object);
|
|
|
| -#define DECLARE_GETTER(name, type) type* name()
|
| +#define DECL_GETTER(name, type) type* name();
|
|
|
| -#define DECLARE_ACCESSORS(name, type) \
|
| - void set_##name(type* value); \
|
| - DECLARE_GETTER(name, type)
|
| +#define DECL_OPTIONAL_ACCESSORS(name, type) \
|
| + INLINE(bool has_##name()); \
|
| + DECL_ACCESSORS(name, type)
|
|
|
| -#define DECLARE_OPTIONAL_ACCESSORS(name, type) \
|
| - bool has_##name(); \
|
| - DECLARE_ACCESSORS(name, type)
|
| +#define DECL_OPTIONAL_GETTER(name, type) \
|
| + INLINE(bool has_##name()); \
|
| + DECL_GETTER(name, type)
|
|
|
| -#define DECLARE_OPTIONAL_GETTER(name, type) \
|
| - bool has_##name(); \
|
| - DECLARE_GETTER(name, type)
|
| +#define DEF_SIZE(parent) \
|
| + static const int kSize = parent::kHeaderSize + kFieldCount * kPointerSize; \
|
| + static const int kParentSize = parent::kHeaderSize; \
|
| + static const int kHeaderSize = kSize;
|
| +#define DEF_OFFSET(name) \
|
| + static const int k##name##Offset = \
|
| + kSize + (k##name##Index - kFieldCount) * kPointerSize;
|
|
|
| // Representation of a WebAssembly.Module JavaScript-level object.
|
| class WasmModuleObject : public JSObject {
|
| public:
|
| - // If a second field is added, we need a kWrapperTracerHeader field as well.
|
| - // TODO(titzer): add the brand as an embedder field instead of a property.
|
| - enum Fields { kCompiledModule, kFieldCount };
|
| + DECL_CAST(WasmModuleObject)
|
|
|
| - DECLARE_CASTS(WasmModuleObject);
|
| + // Shared compiled code between multiple WebAssembly.Module objects.
|
| + DECL_ACCESSORS(compiled_module, WasmCompiledModule)
|
|
|
| - WasmCompiledModule* compiled_module();
|
| + enum { // --
|
| + kCompiledModuleIndex,
|
| + kFieldCount
|
| + };
|
| +
|
| + DEF_SIZE(JSObject)
|
| + DEF_OFFSET(CompiledModule)
|
|
|
| static Handle<WasmModuleObject> New(
|
| Isolate* isolate, Handle<WasmCompiledModule> compiled_module);
|
| @@ -61,23 +75,26 @@ class WasmModuleObject : public JSObject {
|
| // Representation of a WebAssembly.Table JavaScript-level object.
|
| class WasmTableObject : public JSObject {
|
| public:
|
| - // The 0-th field is used by the Blink Wrapper Tracer.
|
| - // TODO(titzer): add the brand as an embedder field instead of a property.
|
| - enum Fields {
|
| - kWrapperTracerHeader,
|
| - kFunctions,
|
| - kMaximum,
|
| - kDispatchTables,
|
| + DECL_CAST(WasmTableObject)
|
| +
|
| + DECL_ACCESSORS(functions, FixedArray)
|
| + DECL_INT_ACCESSORS(maximum_length)
|
| + DECL_ACCESSORS(dispatch_tables, FixedArray)
|
| +
|
| + enum { // --
|
| + kFunctionsIndex,
|
| + kMaximumLengthIndex,
|
| + kDispatchTablesIndex,
|
| kFieldCount
|
| };
|
|
|
| - DECLARE_CASTS(WasmTableObject);
|
| - DECLARE_ACCESSORS(functions, FixedArray);
|
| - DECLARE_GETTER(dispatch_tables, FixedArray);
|
| + DEF_SIZE(JSObject)
|
| + DEF_OFFSET(Functions)
|
| + DEF_OFFSET(MaximumLength)
|
| + DEF_OFFSET(DispatchTables)
|
|
|
| - uint32_t current_length();
|
| - bool has_maximum_length();
|
| - int64_t maximum_length(); // Returns < 0 if no maximum.
|
| + inline uint32_t current_length() { return functions()->length(); }
|
| + inline bool has_maximum_length() { return maximum_length() >= 0; }
|
| void grow(Isolate* isolate, uint32_t count);
|
|
|
| static Handle<WasmTableObject> New(Isolate* isolate, uint32_t initial,
|
| @@ -92,25 +109,28 @@ class WasmTableObject : public JSObject {
|
| // Representation of a WebAssembly.Memory JavaScript-level object.
|
| class WasmMemoryObject : public JSObject {
|
| public:
|
| - // The 0-th field is used by the Blink Wrapper Tracer.
|
| - // TODO(titzer): add the brand as an embedder field instead of a property.
|
| - enum Fields : uint8_t {
|
| - kWrapperTracerHeader,
|
| - kArrayBuffer,
|
| - kMaximum,
|
| - kInstancesLink,
|
| + DECL_CAST(WasmMemoryObject)
|
| +
|
| + DECL_ACCESSORS(array_buffer, JSArrayBuffer)
|
| + DECL_INT_ACCESSORS(maximum_pages)
|
| + DECL_OPTIONAL_ACCESSORS(instances_link, WasmInstanceWrapper)
|
| +
|
| + enum { // --
|
| + kArrayBufferIndex,
|
| + kMaximumPagesIndex,
|
| + kInstancesLinkIndex,
|
| kFieldCount
|
| };
|
|
|
| - DECLARE_CASTS(WasmMemoryObject);
|
| - DECLARE_ACCESSORS(buffer, JSArrayBuffer);
|
| - DECLARE_OPTIONAL_ACCESSORS(instances_link, WasmInstanceWrapper);
|
| + DEF_SIZE(JSObject)
|
| + DEF_OFFSET(ArrayBuffer)
|
| + DEF_OFFSET(MaximumPages)
|
| + DEF_OFFSET(InstancesLink)
|
|
|
| void AddInstance(Isolate* isolate, Handle<WasmInstanceObject> object);
|
| - void ResetInstancesLink(Isolate* isolate);
|
| + inline void ResetInstancesLink(Isolate* isolate);
|
| uint32_t current_pages();
|
| - bool has_maximum_pages();
|
| - int32_t maximum_pages(); // Returns < 0 if there is no maximum.
|
| + inline bool has_maximum_pages() { return maximum_pages() >= 0; }
|
|
|
| static Handle<WasmMemoryObject> New(Isolate* isolate,
|
| Handle<JSArrayBuffer> buffer,
|
| @@ -119,33 +139,39 @@ class WasmMemoryObject : public JSObject {
|
| static int32_t Grow(Isolate*, Handle<WasmMemoryObject>, uint32_t pages);
|
| };
|
|
|
| -// Representation of a WebAssembly.Instance JavaScript-level object.
|
| +// A WebAssembly.Instance JavaScript-level object.
|
| class WasmInstanceObject : public JSObject {
|
| public:
|
| - // The 0-th field is used by the Blink Wrapper Tracer.
|
| - // TODO(titzer): add the brand as an embedder field instead of a property.
|
| - enum Fields {
|
| - kWrapperTracerHeader,
|
| - kCompiledModule,
|
| - kMemoryObject,
|
| - kMemoryArrayBuffer,
|
| - kGlobalsArrayBuffer,
|
| - kDebugInfo,
|
| - kWasmMemInstanceWrapper,
|
| - // FixedArray of wasm instances whose code we imported (to keep them alive).
|
| - kDirectlyCalledInstances,
|
| + DECL_CAST(WasmInstanceObject)
|
| +
|
| + DECL_ACCESSORS(compiled_module, WasmCompiledModule)
|
| + DECL_OPTIONAL_ACCESSORS(memory_object, WasmMemoryObject)
|
| + DECL_OPTIONAL_ACCESSORS(memory_buffer, JSArrayBuffer)
|
| + DECL_OPTIONAL_ACCESSORS(globals_buffer, JSArrayBuffer)
|
| + DECL_OPTIONAL_ACCESSORS(debug_info, WasmDebugInfo)
|
| + DECL_OPTIONAL_ACCESSORS(instance_wrapper, WasmInstanceWrapper)
|
| + // FixedArray of all instances whose code was imported
|
| + DECL_OPTIONAL_ACCESSORS(directly_called_instances, FixedArray)
|
| +
|
| + enum { // --
|
| + kCompiledModuleIndex,
|
| + kMemoryObjectIndex,
|
| + kMemoryBufferIndex,
|
| + kGlobalsBufferIndex,
|
| + kDebugInfoIndex,
|
| + kInstanceWrapperIndex,
|
| + kDirectlyCalledInstancesIndex,
|
| kFieldCount
|
| };
|
|
|
| - DECLARE_CASTS(WasmInstanceObject);
|
| -
|
| - DECLARE_ACCESSORS(compiled_module, WasmCompiledModule);
|
| - DECLARE_OPTIONAL_ACCESSORS(globals_buffer, JSArrayBuffer);
|
| - DECLARE_OPTIONAL_ACCESSORS(memory_buffer, JSArrayBuffer);
|
| - DECLARE_OPTIONAL_ACCESSORS(memory_object, WasmMemoryObject);
|
| - DECLARE_OPTIONAL_ACCESSORS(debug_info, WasmDebugInfo);
|
| - DECLARE_OPTIONAL_ACCESSORS(instance_wrapper, WasmInstanceWrapper);
|
| - DECLARE_OPTIONAL_ACCESSORS(directly_called_instances, FixedArray);
|
| + DEF_SIZE(JSObject)
|
| + DEF_OFFSET(CompiledModule)
|
| + DEF_OFFSET(MemoryObject)
|
| + DEF_OFFSET(MemoryBuffer)
|
| + DEF_OFFSET(GlobalsBuffer)
|
| + DEF_OFFSET(DebugInfo)
|
| + DEF_OFFSET(InstanceWrapper)
|
| + DEF_OFFSET(DirectlyCalledInstances)
|
|
|
| WasmModuleObject* module_object();
|
| V8_EXPORT_PRIVATE wasm::WasmModule* module();
|
| @@ -164,16 +190,24 @@ class WasmInstanceObject : public JSObject {
|
| uint32_t GetMaxMemoryPages();
|
| };
|
|
|
| -// Representation of an exported wasm function.
|
| +// A WASM function that is wrapped and exported to JavaScript.
|
| class WasmExportedFunction : public JSFunction {
|
| public:
|
| - // The 0-th field is used by the Blink Wrapper Tracer.
|
| - enum Fields { kWrapperTracerHeader, kInstance, kIndex, kFieldCount };
|
| + DECL_OOL_QUERY(WasmExportedFunction)
|
| + DECL_OOL_CAST(WasmExportedFunction)
|
|
|
| - DECLARE_CASTS(WasmExportedFunction);
|
| + DECL_ACCESSORS(instance, WasmInstanceObject)
|
| + DECL_INT_ACCESSORS(function_index)
|
|
|
| - WasmInstanceObject* instance();
|
| - int function_index();
|
| + enum { // --
|
| + kInstanceIndex,
|
| + kFunctionIndexIndex,
|
| + kFieldCount
|
| + };
|
| +
|
| + static const int kSize = JSFunction::kSize + kFieldCount * kPointerSize;
|
| + DEF_OFFSET(Instance)
|
| + DEF_OFFSET(FunctionIndex)
|
|
|
| static Handle<WasmExportedFunction> New(Isolate* isolate,
|
| Handle<WasmInstanceObject> instance,
|
| @@ -184,31 +218,33 @@ class WasmExportedFunction : public JSFunction {
|
|
|
| // Information shared by all WasmCompiledModule objects for the same module.
|
| class WasmSharedModuleData : public FixedArray {
|
| - // The 0-th field is used by the Blink Wrapper Tracer.
|
| - enum Fields {
|
| - kWrapperTracerHeader,
|
| - kModuleWrapper,
|
| - kModuleBytes,
|
| - kScript,
|
| - kAsmJsOffsetTable,
|
| - kBreakPointInfos,
|
| - kLazyCompilationOrchestrator,
|
| + public:
|
| + DECL_OOL_QUERY(WasmSharedModuleData)
|
| + DECL_OOL_CAST(WasmSharedModuleData)
|
| +
|
| + DECL_GETTER(module, wasm::WasmModule)
|
| + DECL_OPTIONAL_ACCESSORS(module_bytes, SeqOneByteString)
|
| + DECL_ACCESSORS(script, Script)
|
| + DECL_OPTIONAL_ACCESSORS(asm_js_offset_table, ByteArray)
|
| + DECL_OPTIONAL_ACCESSORS(breakpoint_infos, FixedArray)
|
| +
|
| + enum { // --
|
| + kModuleWrapperIndex,
|
| + kModuleBytesIndex,
|
| + kScriptIndex,
|
| + kAsmJsOffsetTableIndex,
|
| + kBreakPointInfosIndex,
|
| + kLazyCompilationOrchestratorIndex,
|
| kFieldCount
|
| };
|
|
|
| - public:
|
| - DECLARE_CASTS(WasmSharedModuleData);
|
| -
|
| - DECLARE_GETTER(module, wasm::WasmModule);
|
| - DECLARE_OPTIONAL_ACCESSORS(module_bytes, SeqOneByteString);
|
| - DECLARE_GETTER(script, Script);
|
| - DECLARE_OPTIONAL_ACCESSORS(asm_js_offset_table, ByteArray);
|
| - DECLARE_OPTIONAL_GETTER(breakpoint_infos, FixedArray);
|
| -
|
| - static Handle<WasmSharedModuleData> New(
|
| - Isolate* isolate, Handle<Foreign> module_wrapper,
|
| - Handle<SeqOneByteString> module_bytes, Handle<Script> script,
|
| - Handle<ByteArray> asm_js_offset_table);
|
| + DEF_SIZE(FixedArray)
|
| + DEF_OFFSET(ModuleWrapper)
|
| + DEF_OFFSET(ModuleBytes)
|
| + DEF_OFFSET(Script)
|
| + DEF_OFFSET(AsmJsOffsetTable)
|
| + DEF_OFFSET(BreakPointInfos)
|
| + DEF_OFFSET(LazyCompilationOrchestrator)
|
|
|
| // Check whether this module was generated from asm.js source.
|
| bool is_asm_js();
|
| @@ -224,8 +260,13 @@ class WasmSharedModuleData : public FixedArray {
|
|
|
| static void PrepareForLazyCompilation(Handle<WasmSharedModuleData>);
|
|
|
| + static Handle<WasmSharedModuleData> New(
|
| + Isolate* isolate, Handle<Foreign> module_wrapper,
|
| + Handle<SeqOneByteString> module_bytes, Handle<Script> script,
|
| + Handle<ByteArray> asm_js_offset_table);
|
| +
|
| private:
|
| - DECLARE_OPTIONAL_GETTER(lazy_compilation_orchestrator, Foreign);
|
| + DECL_OPTIONAL_GETTER(lazy_compilation_orchestrator, Foreign)
|
| friend class WasmCompiledModule;
|
| };
|
|
|
| @@ -255,7 +296,9 @@ class WasmSharedModuleData : public FixedArray {
|
| // we embed them as objects, and they may move.
|
| class WasmCompiledModule : public FixedArray {
|
| public:
|
| - enum Fields { kFieldCount };
|
| + enum { // --
|
| + kFieldCount
|
| + };
|
|
|
| static WasmCompiledModule* cast(Object* fixed_array) {
|
| SLOW_DCHECK(IsWasmCompiledModule(fixed_array));
|
| @@ -544,18 +587,25 @@ class WasmCompiledModule : public FixedArray {
|
|
|
| class WasmDebugInfo : public FixedArray {
|
| public:
|
| - // The 0-th field is used by the Blink Wrapper Tracer.
|
| - enum Fields {
|
| - kWrapperTracerHeader,
|
| - kInstance,
|
| - kInterpreterHandle,
|
| - kInterpretedFunctions,
|
| - // FixedArray of FixedArray of <undefined|String>.
|
| - kLocalsNames,
|
| + DECL_OOL_QUERY(WasmDebugInfo)
|
| + DECL_OOL_CAST(WasmDebugInfo)
|
| +
|
| + DECL_GETTER(wasm_instance, WasmInstanceObject)
|
| + DECL_OPTIONAL_ACCESSORS(locals_names, FixedArray)
|
| +
|
| + enum { // --
|
| + kInstanceIndex,
|
| + kInterpreterHandleIndex,
|
| + kInterpretedFunctionsIndex,
|
| + kLocalsNamesIndex,
|
| kFieldCount
|
| };
|
|
|
| - DECLARE_OPTIONAL_ACCESSORS(locals_names, FixedArray);
|
| + DEF_SIZE(FixedArray)
|
| + DEF_OFFSET(Instance)
|
| + DEF_OFFSET(InterpreterHandle)
|
| + DEF_OFFSET(InterpretedFunctions)
|
| + DEF_OFFSET(LocalsNames)
|
|
|
| static Handle<WasmDebugInfo> New(Handle<WasmInstanceObject>);
|
|
|
| @@ -566,9 +616,6 @@ class WasmDebugInfo : public FixedArray {
|
| V8_EXPORT_PRIVATE static wasm::WasmInterpreter* SetupForTesting(
|
| Handle<WasmInstanceObject>, wasm::WasmInstance*);
|
|
|
| - static bool IsDebugInfo(Object*);
|
| - static WasmDebugInfo* cast(Object*);
|
| -
|
| // Set a breakpoint in the given function at the given byte offset within that
|
| // function. This will redirect all future calls to this function to the
|
| // interpreter and will always pause at the given offset.
|
| @@ -605,8 +652,6 @@ class WasmDebugInfo : public FixedArray {
|
| // Returns the number of calls / function frames executed in the interpreter.
|
| uint64_t NumInterpretedCalls();
|
|
|
| - DECLARE_GETTER(wasm_instance, WasmInstanceObject);
|
| -
|
| // Update the memory view of the interpreter after executing GrowMemory in
|
| // compiled code.
|
| void UpdateMemory(JSArrayBuffer* new_memory);
|
| @@ -625,63 +670,145 @@ class WasmDebugInfo : public FixedArray {
|
|
|
| class WasmInstanceWrapper : public FixedArray {
|
| public:
|
| - static Handle<WasmInstanceWrapper> New(Isolate* isolate,
|
| - Handle<WasmInstanceObject> instance);
|
| + enum { // --
|
| + kWrapperInstanceObjectIndex,
|
| + kNextInstanceWrapperIndex,
|
| + kPreviousInstanceWrapperIndex,
|
| + kFieldCount
|
| + };
|
| +
|
| static WasmInstanceWrapper* cast(Object* fixed_array) {
|
| SLOW_DCHECK(IsWasmInstanceWrapper(fixed_array));
|
| return reinterpret_cast<WasmInstanceWrapper*>(fixed_array);
|
| }
|
| static bool IsWasmInstanceWrapper(Object* obj);
|
| - bool has_instance() { return get(kWrapperInstanceObject)->IsWeakCell(); }
|
| + bool has_instance() { return get(kWrapperInstanceObjectIndex)->IsWeakCell(); }
|
| Handle<WasmInstanceObject> instance_object() {
|
| - Object* obj = get(kWrapperInstanceObject);
|
| + Object* obj = get(kWrapperInstanceObjectIndex);
|
| DCHECK(obj->IsWeakCell());
|
| WeakCell* cell = WeakCell::cast(obj);
|
| DCHECK(cell->value()->IsJSObject());
|
| return handle(WasmInstanceObject::cast(cell->value()));
|
| }
|
| - bool has_next() { return IsWasmInstanceWrapper(get(kNextInstanceWrapper)); }
|
| + bool has_next() {
|
| + return IsWasmInstanceWrapper(get(kNextInstanceWrapperIndex));
|
| + }
|
| bool has_previous() {
|
| - return IsWasmInstanceWrapper(get(kPreviousInstanceWrapper));
|
| + return IsWasmInstanceWrapper(get(kPreviousInstanceWrapperIndex));
|
| }
|
| void set_next_wrapper(Object* obj) {
|
| DCHECK(IsWasmInstanceWrapper(obj));
|
| - set(kNextInstanceWrapper, obj);
|
| + set(kNextInstanceWrapperIndex, obj);
|
| }
|
| void set_previous_wrapper(Object* obj) {
|
| DCHECK(IsWasmInstanceWrapper(obj));
|
| - set(kPreviousInstanceWrapper, obj);
|
| + set(kPreviousInstanceWrapperIndex, obj);
|
| }
|
| Handle<WasmInstanceWrapper> next_wrapper() {
|
| - Object* obj = get(kNextInstanceWrapper);
|
| + Object* obj = get(kNextInstanceWrapperIndex);
|
| DCHECK(IsWasmInstanceWrapper(obj));
|
| return handle(WasmInstanceWrapper::cast(obj));
|
| }
|
| Handle<WasmInstanceWrapper> previous_wrapper() {
|
| - Object* obj = get(kPreviousInstanceWrapper);
|
| + Object* obj = get(kPreviousInstanceWrapperIndex);
|
| DCHECK(IsWasmInstanceWrapper(obj));
|
| return handle(WasmInstanceWrapper::cast(obj));
|
| }
|
| - void reset_next_wrapper() { set_undefined(kNextInstanceWrapper); }
|
| - void reset_previous_wrapper() { set_undefined(kPreviousInstanceWrapper); }
|
| + void reset_next_wrapper() { set_undefined(kNextInstanceWrapperIndex); }
|
| + void reset_previous_wrapper() {
|
| + set_undefined(kPreviousInstanceWrapperIndex);
|
| + }
|
| void reset() {
|
| - for (int kID = 0; kID < kWrapperPropertyCount; kID++) set_undefined(kID);
|
| + for (int kID = 0; kID < kFieldCount; kID++) set_undefined(kID);
|
| }
|
|
|
| - private:
|
| - enum {
|
| - kWrapperInstanceObject,
|
| - kNextInstanceWrapper,
|
| - kPreviousInstanceWrapper,
|
| - kWrapperPropertyCount
|
| - };
|
| + static Handle<WasmInstanceWrapper> New(Isolate* isolate,
|
| + Handle<WasmInstanceObject> instance);
|
| };
|
|
|
| -#undef DECLARE_CASTS
|
| -#undef DECLARE_GETTER
|
| -#undef DECLARE_ACCESSORS
|
| -#undef DECLARE_OPTIONAL_ACCESSORS
|
| -#undef DECLARE_OPTIONAL_GETTER
|
| +// TODO(titzer): these should be moved to wasm-objects-inl.h
|
| +CAST_ACCESSOR(WasmInstanceObject)
|
| +CAST_ACCESSOR(WasmMemoryObject)
|
| +CAST_ACCESSOR(WasmModuleObject)
|
| +CAST_ACCESSOR(WasmTableObject)
|
| +
|
| +// WasmModuleObject
|
| +ACCESSORS(WasmModuleObject, compiled_module, WasmCompiledModule,
|
| + kCompiledModuleOffset)
|
| +
|
| +// WasmTableObject
|
| +ACCESSORS(WasmTableObject, functions, FixedArray, kFunctionsOffset)
|
| +SMI_ACCESSORS(WasmTableObject, maximum_length, kMaximumLengthOffset)
|
| +ACCESSORS(WasmTableObject, dispatch_tables, FixedArray, kDispatchTablesOffset)
|
| +
|
| +// WasmMemoryObject
|
| +ACCESSORS(WasmMemoryObject, array_buffer, JSArrayBuffer, kArrayBufferOffset)
|
| +SMI_ACCESSORS(WasmMemoryObject, maximum_pages, kMaximumPagesOffset)
|
| +ACCESSORS(WasmMemoryObject, instances_link, WasmInstanceWrapper,
|
| + kInstancesLinkOffset)
|
| +
|
| +// WasmInstanceObject
|
| +ACCESSORS(WasmInstanceObject, compiled_module, WasmCompiledModule,
|
| + kCompiledModuleOffset)
|
| +ACCESSORS(WasmInstanceObject, memory_object, WasmMemoryObject,
|
| + kMemoryObjectOffset)
|
| +ACCESSORS(WasmInstanceObject, memory_buffer, JSArrayBuffer, kMemoryBufferOffset)
|
| +ACCESSORS(WasmInstanceObject, globals_buffer, JSArrayBuffer,
|
| + kGlobalsBufferOffset)
|
| +ACCESSORS(WasmInstanceObject, debug_info, WasmDebugInfo, kDebugInfoOffset)
|
| +ACCESSORS(WasmInstanceObject, instance_wrapper, WasmInstanceWrapper,
|
| + kInstanceWrapperOffset)
|
| +ACCESSORS(WasmInstanceObject, directly_called_instances, FixedArray,
|
| + kDirectlyCalledInstancesOffset)
|
| +
|
| +// WasmExportedFunction
|
| +ACCESSORS(WasmExportedFunction, instance, WasmInstanceObject, kInstanceOffset)
|
| +SMI_ACCESSORS(WasmExportedFunction, function_index, kFunctionIndexOffset)
|
| +
|
| +// WasmSharedModuleData
|
| +ACCESSORS(WasmSharedModuleData, module_bytes, SeqOneByteString,
|
| + kModuleBytesOffset)
|
| +ACCESSORS(WasmSharedModuleData, script, Script, kScriptOffset)
|
| +ACCESSORS(WasmSharedModuleData, asm_js_offset_table, ByteArray,
|
| + kAsmJsOffsetTableOffset)
|
| +ACCESSORS(WasmSharedModuleData, breakpoint_infos, FixedArray,
|
| + kBreakPointInfosOffset)
|
| +
|
| +#define OPTIONAL_ACCESSOR(holder, name, offset) \
|
| + bool holder::has_##name() { \
|
| + return !READ_FIELD(this, offset)->IsUndefined(GetIsolate()); \
|
| + }
|
| +
|
| +OPTIONAL_ACCESSOR(WasmInstanceObject, debug_info, kDebugInfoOffset)
|
| +OPTIONAL_ACCESSOR(WasmInstanceObject, memory_buffer, kMemoryBufferOffset)
|
| +OPTIONAL_ACCESSOR(WasmInstanceObject, memory_object, kMemoryObjectOffset)
|
| +OPTIONAL_ACCESSOR(WasmInstanceObject, instance_wrapper, kInstanceWrapperOffset)
|
| +
|
| +OPTIONAL_ACCESSOR(WasmMemoryObject, instances_link, kInstancesLinkOffset)
|
| +
|
| +OPTIONAL_ACCESSOR(WasmSharedModuleData, breakpoint_infos,
|
| + kBreakPointInfosOffset)
|
| +OPTIONAL_ACCESSOR(WasmSharedModuleData, asm_js_offset_table,
|
| + kAsmJsOffsetTableOffset)
|
| +OPTIONAL_ACCESSOR(WasmSharedModuleData, lazy_compilation_orchestrator,
|
| + kLazyCompilationOrchestratorOffset)
|
| +
|
| +ACCESSORS(WasmDebugInfo, locals_names, FixedArray, kLocalsNamesOffset)
|
| +
|
| +OPTIONAL_ACCESSOR(WasmDebugInfo, locals_names, kLocalsNamesOffset)
|
| +
|
| +inline void WasmMemoryObject::ResetInstancesLink(Isolate* isolate) {
|
| + // This has to be a raw access to bypass typechecking.
|
| + WRITE_FIELD(this, kInstancesLinkOffset, isolate->heap()->undefined_value());
|
| +}
|
| +
|
| +#undef DECL_OOL_QUERY
|
| +#undef DECL_OOL_CAST
|
| +#undef DECL_GETTER
|
| +#undef DECL_OPTIONAL_ACCESSORS
|
| +#undef DECL_OPTIONAL_GETTER
|
| +
|
| +#include "src/objects/object-macros-undef.h"
|
|
|
| } // namespace internal
|
| } // namespace v8
|
|
|