Commit 808e90a9 authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

[wasm] Clean up accessor definitions

Rename OPTIONAL_ACCESSOR to OPTIONAL_ACCESSORS (to be in line with
ACCESSORS and DECL_OPTIONAL_ACCESSORS), and make OPTIONAL_ACCESSORS also
define the ACCESSORS (to be in line with DECL_OPTIONAL_ACCESSORS).

Drive-by: Remove DECL_OPTIONAL_GETTER; just define the setter too.

R=titzer@chromium.org

Change-Id: Id41a652153d7a1e2a15a5f69c6f52b96298f9dc1
Reviewed-on: https://chromium-review.googlesource.com/598868Reviewed-by: 's avatarBen Titzer <titzer@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#47111}
parent c772d8d9
...@@ -605,10 +605,6 @@ Handle<WasmSharedModuleData> WasmSharedModuleData::New( ...@@ -605,10 +605,6 @@ Handle<WasmSharedModuleData> WasmSharedModuleData::New(
return Handle<WasmSharedModuleData>::cast(arr); return Handle<WasmSharedModuleData>::cast(arr);
} }
Foreign* WasmSharedModuleData::lazy_compilation_orchestrator() {
return Foreign::cast(get(kLazyCompilationOrchestratorIndex));
}
bool WasmSharedModuleData::is_asm_js() { bool WasmSharedModuleData::is_asm_js() {
bool asm_js = module()->is_asm_js(); bool asm_js = module()->is_asm_js();
DCHECK_EQ(asm_js, script()->IsUserJavaScript()); DCHECK_EQ(asm_js, script()->IsUserJavaScript());
...@@ -784,7 +780,7 @@ void WasmSharedModuleData::PrepareForLazyCompilation( ...@@ -784,7 +780,7 @@ void WasmSharedModuleData::PrepareForLazyCompilation(
LazyCompilationOrchestrator* orch = new LazyCompilationOrchestrator(); LazyCompilationOrchestrator* orch = new LazyCompilationOrchestrator();
Handle<Managed<LazyCompilationOrchestrator>> orch_handle = Handle<Managed<LazyCompilationOrchestrator>> orch_handle =
Managed<LazyCompilationOrchestrator>::New(isolate, orch); Managed<LazyCompilationOrchestrator>::New(isolate, orch);
shared->set(kLazyCompilationOrchestratorIndex, *orch_handle); shared->set_lazy_compilation_orchestrator(*orch_handle);
} }
Handle<WasmCompiledModule> WasmCompiledModule::New( Handle<WasmCompiledModule> WasmCompiledModule::New(
......
...@@ -39,10 +39,6 @@ class WasmInstanceObject; ...@@ -39,10 +39,6 @@ class WasmInstanceObject;
INLINE(bool has_##name()); \ INLINE(bool has_##name()); \
DECL_ACCESSORS(name, type) DECL_ACCESSORS(name, type)
#define DECL_OPTIONAL_GETTER(name, type) \
INLINE(bool has_##name()); \
DECL_GETTER(name, type)
#define DEF_SIZE(parent) \ #define DEF_SIZE(parent) \
static const int kSize = parent::kHeaderSize + kFieldCount * kPointerSize; \ static const int kSize = parent::kHeaderSize + kFieldCount * kPointerSize; \
static const int kParentSize = parent::kHeaderSize; \ static const int kParentSize = parent::kHeaderSize; \
...@@ -257,7 +253,7 @@ class WasmSharedModuleData : public FixedArray { ...@@ -257,7 +253,7 @@ class WasmSharedModuleData : public FixedArray {
Handle<ByteArray> asm_js_offset_table); Handle<ByteArray> asm_js_offset_table);
private: private:
DECL_OPTIONAL_GETTER(lazy_compilation_orchestrator, Foreign) DECL_OPTIONAL_ACCESSORS(lazy_compilation_orchestrator, Foreign)
friend class WasmCompiledModule; friend class WasmCompiledModule;
}; };
...@@ -669,6 +665,12 @@ CAST_ACCESSOR(WasmMemoryObject) ...@@ -669,6 +665,12 @@ CAST_ACCESSOR(WasmMemoryObject)
CAST_ACCESSOR(WasmModuleObject) CAST_ACCESSOR(WasmModuleObject)
CAST_ACCESSOR(WasmTableObject) CAST_ACCESSOR(WasmTableObject)
#define OPTIONAL_ACCESSORS(holder, name, type, offset) \
bool holder::has_##name() { \
return !READ_FIELD(this, offset)->IsUndefined(GetIsolate()); \
} \
ACCESSORS(holder, name, type, offset)
// WasmModuleObject // WasmModuleObject
ACCESSORS(WasmModuleObject, compiled_module, WasmCompiledModule, ACCESSORS(WasmModuleObject, compiled_module, WasmCompiledModule,
kCompiledModuleOffset) kCompiledModuleOffset)
...@@ -681,17 +683,20 @@ ACCESSORS(WasmTableObject, dispatch_tables, FixedArray, kDispatchTablesOffset) ...@@ -681,17 +683,20 @@ ACCESSORS(WasmTableObject, dispatch_tables, FixedArray, kDispatchTablesOffset)
// WasmMemoryObject // WasmMemoryObject
ACCESSORS(WasmMemoryObject, array_buffer, JSArrayBuffer, kArrayBufferOffset) ACCESSORS(WasmMemoryObject, array_buffer, JSArrayBuffer, kArrayBufferOffset)
SMI_ACCESSORS(WasmMemoryObject, maximum_pages, kMaximumPagesOffset) SMI_ACCESSORS(WasmMemoryObject, maximum_pages, kMaximumPagesOffset)
ACCESSORS(WasmMemoryObject, instances, WeakFixedArray, kInstancesOffset) OPTIONAL_ACCESSORS(WasmMemoryObject, instances, WeakFixedArray,
kInstancesOffset)
// WasmInstanceObject // WasmInstanceObject
ACCESSORS(WasmInstanceObject, compiled_module, WasmCompiledModule, ACCESSORS(WasmInstanceObject, compiled_module, WasmCompiledModule,
kCompiledModuleOffset) kCompiledModuleOffset)
ACCESSORS(WasmInstanceObject, memory_object, WasmMemoryObject, OPTIONAL_ACCESSORS(WasmInstanceObject, memory_object, WasmMemoryObject,
kMemoryObjectOffset) kMemoryObjectOffset)
ACCESSORS(WasmInstanceObject, memory_buffer, JSArrayBuffer, kMemoryBufferOffset) OPTIONAL_ACCESSORS(WasmInstanceObject, memory_buffer, JSArrayBuffer,
kMemoryBufferOffset)
ACCESSORS(WasmInstanceObject, globals_buffer, JSArrayBuffer, ACCESSORS(WasmInstanceObject, globals_buffer, JSArrayBuffer,
kGlobalsBufferOffset) kGlobalsBufferOffset)
ACCESSORS(WasmInstanceObject, debug_info, WasmDebugInfo, kDebugInfoOffset) OPTIONAL_ACCESSORS(WasmInstanceObject, debug_info, WasmDebugInfo,
kDebugInfoOffset)
ACCESSORS(WasmInstanceObject, directly_called_instances, FixedArray, ACCESSORS(WasmInstanceObject, directly_called_instances, FixedArray,
kDirectlyCalledInstancesOffset) kDirectlyCalledInstancesOffset)
...@@ -699,38 +704,21 @@ ACCESSORS(WasmInstanceObject, directly_called_instances, FixedArray, ...@@ -699,38 +704,21 @@ ACCESSORS(WasmInstanceObject, directly_called_instances, FixedArray,
ACCESSORS(WasmSharedModuleData, module_bytes, SeqOneByteString, ACCESSORS(WasmSharedModuleData, module_bytes, SeqOneByteString,
kModuleBytesOffset) kModuleBytesOffset)
ACCESSORS(WasmSharedModuleData, script, Script, kScriptOffset) ACCESSORS(WasmSharedModuleData, script, Script, kScriptOffset)
ACCESSORS(WasmSharedModuleData, asm_js_offset_table, ByteArray, OPTIONAL_ACCESSORS(WasmSharedModuleData, asm_js_offset_table, ByteArray,
kAsmJsOffsetTableOffset) kAsmJsOffsetTableOffset)
ACCESSORS(WasmSharedModuleData, breakpoint_infos, FixedArray, OPTIONAL_ACCESSORS(WasmSharedModuleData, breakpoint_infos, FixedArray,
kBreakPointInfosOffset) 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(WasmMemoryObject, instances, kInstancesOffset)
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_ACCESSORS(WasmSharedModuleData, lazy_compilation_orchestrator, Foreign,
kLazyCompilationOrchestratorOffset)
OPTIONAL_ACCESSOR(WasmDebugInfo, locals_names, kLocalsNamesOffset) OPTIONAL_ACCESSORS(WasmDebugInfo, locals_names, FixedArray, kLocalsNamesOffset)
#undef OPTIONAL_ACCESSORS
#undef DECL_OOL_QUERY #undef DECL_OOL_QUERY
#undef DECL_OOL_CAST #undef DECL_OOL_CAST
#undef DECL_GETTER #undef DECL_GETTER
#undef DECL_OPTIONAL_ACCESSORS #undef DECL_OPTIONAL_ACCESSORS
#undef DECL_OPTIONAL_GETTER
#include "src/objects/object-macros-undef.h" #include "src/objects/object-macros-undef.h"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment