| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_WASM_OBJECTS_H_ | 5 #ifndef V8_WASM_OBJECTS_H_ |
| 6 #define V8_WASM_OBJECTS_H_ | 6 #define V8_WASM_OBJECTS_H_ |
| 7 | 7 |
| 8 #include "src/debug/debug.h" | 8 #include "src/debug/debug.h" |
| 9 #include "src/debug/interface-types.h" | 9 #include "src/debug/interface-types.h" |
| 10 #include "src/objects.h" | 10 #include "src/objects.h" |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 | 187 |
| 188 static int32_t GrowMemory(Isolate*, Handle<WasmInstanceObject>, | 188 static int32_t GrowMemory(Isolate*, Handle<WasmInstanceObject>, |
| 189 uint32_t pages); | 189 uint32_t pages); |
| 190 | 190 |
| 191 uint32_t GetMaxMemoryPages(); | 191 uint32_t GetMaxMemoryPages(); |
| 192 }; | 192 }; |
| 193 | 193 |
| 194 // A WASM function that is wrapped and exported to JavaScript. | 194 // A WASM function that is wrapped and exported to JavaScript. |
| 195 class WasmExportedFunction : public JSFunction { | 195 class WasmExportedFunction : public JSFunction { |
| 196 public: | 196 public: |
| 197 DECL_OOL_QUERY(WasmExportedFunction) | 197 WasmInstanceObject* instance(); |
| 198 DECL_OOL_CAST(WasmExportedFunction) | 198 int function_index(); |
| 199 | 199 |
| 200 DECL_ACCESSORS(instance, WasmInstanceObject) | 200 static WasmExportedFunction* cast(Object* object); |
| 201 DECL_INT_ACCESSORS(function_index) | 201 static bool IsWasmExportedFunction(Object* object); |
| 202 | |
| 203 enum { // -- | |
| 204 kInstanceIndex, | |
| 205 kFunctionIndexIndex, | |
| 206 kFieldCount | |
| 207 }; | |
| 208 | |
| 209 static const int kSize = JSFunction::kSize + kFieldCount * kPointerSize; | |
| 210 DEF_OFFSET(Instance) | |
| 211 DEF_OFFSET(FunctionIndex) | |
| 212 | 202 |
| 213 static Handle<WasmExportedFunction> New(Isolate* isolate, | 203 static Handle<WasmExportedFunction> New(Isolate* isolate, |
| 214 Handle<WasmInstanceObject> instance, | 204 Handle<WasmInstanceObject> instance, |
| 215 MaybeHandle<String> maybe_name, | 205 MaybeHandle<String> maybe_name, |
| 216 int func_index, int arity, | 206 int func_index, int arity, |
| 217 Handle<Code> export_wrapper); | 207 Handle<Code> export_wrapper); |
| 218 }; | 208 }; |
| 219 | 209 |
| 220 // Information shared by all WasmCompiledModule objects for the same module. | 210 // Information shared by all WasmCompiledModule objects for the same module. |
| 221 class WasmSharedModuleData : public FixedArray { | 211 class WasmSharedModuleData : public FixedArray { |
| (...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 kCompiledModuleOffset) | 682 kCompiledModuleOffset) |
| 693 ACCESSORS(WasmInstanceObject, memory_object, WasmMemoryObject, | 683 ACCESSORS(WasmInstanceObject, memory_object, WasmMemoryObject, |
| 694 kMemoryObjectOffset) | 684 kMemoryObjectOffset) |
| 695 ACCESSORS(WasmInstanceObject, memory_buffer, JSArrayBuffer, kMemoryBufferOffset) | 685 ACCESSORS(WasmInstanceObject, memory_buffer, JSArrayBuffer, kMemoryBufferOffset) |
| 696 ACCESSORS(WasmInstanceObject, globals_buffer, JSArrayBuffer, | 686 ACCESSORS(WasmInstanceObject, globals_buffer, JSArrayBuffer, |
| 697 kGlobalsBufferOffset) | 687 kGlobalsBufferOffset) |
| 698 ACCESSORS(WasmInstanceObject, debug_info, WasmDebugInfo, kDebugInfoOffset) | 688 ACCESSORS(WasmInstanceObject, debug_info, WasmDebugInfo, kDebugInfoOffset) |
| 699 ACCESSORS(WasmInstanceObject, directly_called_instances, FixedArray, | 689 ACCESSORS(WasmInstanceObject, directly_called_instances, FixedArray, |
| 700 kDirectlyCalledInstancesOffset) | 690 kDirectlyCalledInstancesOffset) |
| 701 | 691 |
| 702 // WasmExportedFunction | |
| 703 ACCESSORS(WasmExportedFunction, instance, WasmInstanceObject, kInstanceOffset) | |
| 704 SMI_ACCESSORS(WasmExportedFunction, function_index, kFunctionIndexOffset) | |
| 705 | |
| 706 // WasmSharedModuleData | 692 // WasmSharedModuleData |
| 707 ACCESSORS(WasmSharedModuleData, module_bytes, SeqOneByteString, | 693 ACCESSORS(WasmSharedModuleData, module_bytes, SeqOneByteString, |
| 708 kModuleBytesOffset) | 694 kModuleBytesOffset) |
| 709 ACCESSORS(WasmSharedModuleData, script, Script, kScriptOffset) | 695 ACCESSORS(WasmSharedModuleData, script, Script, kScriptOffset) |
| 710 ACCESSORS(WasmSharedModuleData, asm_js_offset_table, ByteArray, | 696 ACCESSORS(WasmSharedModuleData, asm_js_offset_table, ByteArray, |
| 711 kAsmJsOffsetTableOffset) | 697 kAsmJsOffsetTableOffset) |
| 712 ACCESSORS(WasmSharedModuleData, breakpoint_infos, FixedArray, | 698 ACCESSORS(WasmSharedModuleData, breakpoint_infos, FixedArray, |
| 713 kBreakPointInfosOffset) | 699 kBreakPointInfosOffset) |
| 714 | 700 |
| 715 #define OPTIONAL_ACCESSOR(holder, name, offset) \ | 701 #define OPTIONAL_ACCESSOR(holder, name, offset) \ |
| (...skipping 23 matching lines...) Expand all Loading... |
| 739 #undef DECL_GETTER | 725 #undef DECL_GETTER |
| 740 #undef DECL_OPTIONAL_ACCESSORS | 726 #undef DECL_OPTIONAL_ACCESSORS |
| 741 #undef DECL_OPTIONAL_GETTER | 727 #undef DECL_OPTIONAL_GETTER |
| 742 | 728 |
| 743 #include "src/objects/object-macros-undef.h" | 729 #include "src/objects/object-macros-undef.h" |
| 744 | 730 |
| 745 } // namespace internal | 731 } // namespace internal |
| 746 } // namespace v8 | 732 } // namespace v8 |
| 747 | 733 |
| 748 #endif // V8_WASM_OBJECTS_H_ | 734 #endif // V8_WASM_OBJECTS_H_ |
| OLD | NEW |