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/interface-types.h" | 8 #include "src/debug/interface-types.h" |
9 #include "src/objects-inl.h" | 9 #include "src/objects-inl.h" |
10 #include "src/trap-handler/trap-handler.h" | 10 #include "src/trap-handler/trap-handler.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 uint32_t current_length(); | 62 uint32_t current_length(); |
63 uint32_t maximum_length(); | 63 uint32_t maximum_length(); |
64 | 64 |
65 static Handle<WasmTableObject> New(Isolate* isolate, uint32_t initial, | 65 static Handle<WasmTableObject> New(Isolate* isolate, uint32_t initial, |
66 uint32_t maximum, | 66 uint32_t maximum, |
67 Handle<FixedArray>* js_functions); | 67 Handle<FixedArray>* js_functions); |
68 static bool Grow(Handle<WasmTableObject> table, uint32_t count); | 68 static bool Grow(Handle<WasmTableObject> table, uint32_t count); |
69 static Handle<FixedArray> AddDispatchTable( | 69 static Handle<FixedArray> AddDispatchTable( |
70 Isolate* isolate, Handle<WasmTableObject> table, | 70 Isolate* isolate, Handle<WasmTableObject> table, |
71 Handle<WasmInstanceObject> instance, int table_index, | 71 Handle<WasmInstanceObject> instance, int table_index, |
72 Handle<FixedArray> dispatch_table); | 72 Handle<FixedArray> function_table, Handle<FixedArray> signature_table); |
73 }; | 73 }; |
74 | 74 |
75 // Representation of a WebAssembly.Memory JavaScript-level object. | 75 // Representation of a WebAssembly.Memory JavaScript-level object. |
76 class WasmMemoryObject : public JSObject { | 76 class WasmMemoryObject : public JSObject { |
77 public: | 77 public: |
78 // TODO(titzer): add the brand as an internal field instead of a property. | 78 // TODO(titzer): add the brand as an internal field instead of a property. |
79 enum Fields : uint8_t { kArrayBuffer, kMaximum, kInstancesLink, kFieldCount }; | 79 enum Fields : uint8_t { kArrayBuffer, kMaximum, kInstancesLink, kFieldCount }; |
80 | 80 |
81 DECLARE_CASTS(WasmMemoryObject); | 81 DECLARE_CASTS(WasmMemoryObject); |
82 DECLARE_ACCESSORS(buffer, JSArrayBuffer); | 82 DECLARE_ACCESSORS(buffer, JSArrayBuffer); |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 WCM_OBJECT_OR_WEAK(WeakCell, weak_##NAME, kID_##NAME, obj->IsWeakCell()); \ | 232 WCM_OBJECT_OR_WEAK(WeakCell, weak_##NAME, kID_##NAME, obj->IsWeakCell()); \ |
233 \ | 233 \ |
234 Handle<TYPE> NAME() const { \ | 234 Handle<TYPE> NAME() const { \ |
235 return handle(TYPE::cast(weak_##NAME()->value())); \ | 235 return handle(TYPE::cast(weak_##NAME()->value())); \ |
236 } | 236 } |
237 | 237 |
238 #define CORE_WCM_PROPERTY_TABLE(MACRO) \ | 238 #define CORE_WCM_PROPERTY_TABLE(MACRO) \ |
239 MACRO(WASM_OBJECT, WasmSharedModuleData, shared) \ | 239 MACRO(WASM_OBJECT, WasmSharedModuleData, shared) \ |
240 MACRO(OBJECT, FixedArray, code_table) \ | 240 MACRO(OBJECT, FixedArray, code_table) \ |
241 MACRO(OBJECT, FixedArray, function_tables) \ | 241 MACRO(OBJECT, FixedArray, function_tables) \ |
| 242 MACRO(OBJECT, FixedArray, signature_tables) \ |
242 MACRO(OBJECT, FixedArray, empty_function_tables) \ | 243 MACRO(OBJECT, FixedArray, empty_function_tables) \ |
243 MACRO(OBJECT, JSArrayBuffer, memory) \ | 244 MACRO(OBJECT, JSArrayBuffer, memory) \ |
244 MACRO(SMALL_NUMBER, uint32_t, min_mem_pages) \ | 245 MACRO(SMALL_NUMBER, uint32_t, min_mem_pages) \ |
245 MACRO(SMALL_NUMBER, uint32_t, max_mem_pages) \ | 246 MACRO(SMALL_NUMBER, uint32_t, max_mem_pages) \ |
246 MACRO(WEAK_LINK, WasmCompiledModule, next_instance) \ | 247 MACRO(WEAK_LINK, WasmCompiledModule, next_instance) \ |
247 MACRO(WEAK_LINK, WasmCompiledModule, prev_instance) \ | 248 MACRO(WEAK_LINK, WasmCompiledModule, prev_instance) \ |
248 MACRO(WEAK_LINK, JSObject, owning_instance) \ | 249 MACRO(WEAK_LINK, JSObject, owning_instance) \ |
249 MACRO(WEAK_LINK, WasmModuleObject, wasm_module) | 250 MACRO(WEAK_LINK, WasmModuleObject, wasm_module) |
250 | 251 |
251 #if DEBUG | 252 #if DEBUG |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 }; | 441 }; |
441 }; | 442 }; |
442 | 443 |
443 #undef DECLARE_ACCESSORS | 444 #undef DECLARE_ACCESSORS |
444 #undef DECLARE_OPTIONAL_ACCESSORS | 445 #undef DECLARE_OPTIONAL_ACCESSORS |
445 | 446 |
446 } // namespace internal | 447 } // namespace internal |
447 } // namespace v8 | 448 } // namespace v8 |
448 | 449 |
449 #endif // V8_WASM_OBJECTS_H_ | 450 #endif // V8_WASM_OBJECTS_H_ |
OLD | NEW |