| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 DECLARE_CASTS(WasmTableObject); | 58 DECLARE_CASTS(WasmTableObject); |
| 59 DECLARE_ACCESSORS(functions, FixedArray); | 59 DECLARE_ACCESSORS(functions, FixedArray); |
| 60 | 60 |
| 61 FixedArray* dispatch_tables(); | 61 FixedArray* dispatch_tables(); |
| 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 void Grow(Isolate* isolate, Handle<WasmTableObject> table, |
| 69 uint32_t count); |
| 69 static Handle<FixedArray> AddDispatchTable( | 70 static Handle<FixedArray> AddDispatchTable( |
| 70 Isolate* isolate, Handle<WasmTableObject> table, | 71 Isolate* isolate, Handle<WasmTableObject> table, |
| 71 Handle<WasmInstanceObject> instance, int table_index, | 72 Handle<WasmInstanceObject> instance, int table_index, |
| 72 Handle<FixedArray> function_table, Handle<FixedArray> signature_table); | 73 Handle<FixedArray> function_table, Handle<FixedArray> signature_table); |
| 73 }; | 74 }; |
| 74 | 75 |
| 75 // Representation of a WebAssembly.Memory JavaScript-level object. | 76 // Representation of a WebAssembly.Memory JavaScript-level object. |
| 76 class WasmMemoryObject : public JSObject { | 77 class WasmMemoryObject : public JSObject { |
| 77 public: | 78 public: |
| 78 // TODO(titzer): add the brand as an internal field instead of a property. | 79 // TODO(titzer): add the brand as an internal field instead of a property. |
| 79 enum Fields : uint8_t { kArrayBuffer, kMaximum, kInstancesLink, kFieldCount }; | 80 enum Fields : uint8_t { kArrayBuffer, kMaximum, kInstancesLink, kFieldCount }; |
| 80 | 81 |
| 81 DECLARE_CASTS(WasmMemoryObject); | 82 DECLARE_CASTS(WasmMemoryObject); |
| 82 DECLARE_ACCESSORS(buffer, JSArrayBuffer); | 83 DECLARE_ACCESSORS(buffer, JSArrayBuffer); |
| 83 DECLARE_OPTIONAL_ACCESSORS(instances_link, WasmInstanceWrapper); | 84 DECLARE_OPTIONAL_ACCESSORS(instances_link, WasmInstanceWrapper); |
| 84 | 85 |
| 85 void AddInstance(Isolate* isolate, Handle<WasmInstanceObject> object); | 86 void AddInstance(Isolate* isolate, Handle<WasmInstanceObject> object); |
| 86 void ResetInstancesLink(Isolate* isolate); | 87 void ResetInstancesLink(Isolate* isolate); |
| 87 uint32_t current_pages(); | 88 uint32_t current_pages(); |
| 88 int32_t maximum_pages(); // returns < 0 if there is no maximum | 89 int32_t maximum_pages(); // returns < 0 if there is no maximum |
| 89 | 90 |
| 90 static Handle<WasmMemoryObject> New(Isolate* isolate, | 91 static Handle<WasmMemoryObject> New(Isolate* isolate, |
| 91 Handle<JSArrayBuffer> buffer, | 92 Handle<JSArrayBuffer> buffer, |
| 92 int maximum); | 93 int maximum); |
| 93 | 94 |
| 94 static bool Grow(Handle<WasmMemoryObject> memory, uint32_t count); | 95 static bool Grow(Isolate* isolate, Handle<WasmMemoryObject> memory, |
| 96 uint32_t count); |
| 95 }; | 97 }; |
| 96 | 98 |
| 97 // Representation of a WebAssembly.Instance JavaScript-level object. | 99 // Representation of a WebAssembly.Instance JavaScript-level object. |
| 98 class WasmInstanceObject : public JSObject { | 100 class WasmInstanceObject : public JSObject { |
| 99 public: | 101 public: |
| 100 // TODO(titzer): add the brand as an internal field instead of a property. | 102 // TODO(titzer): add the brand as an internal field instead of a property. |
| 101 enum Fields { | 103 enum Fields { |
| 102 kCompiledModule, | 104 kCompiledModule, |
| 103 kMemoryObject, | 105 kMemoryObject, |
| 104 kMemoryArrayBuffer, | 106 kMemoryArrayBuffer, |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 }; | 454 }; |
| 453 }; | 455 }; |
| 454 | 456 |
| 455 #undef DECLARE_ACCESSORS | 457 #undef DECLARE_ACCESSORS |
| 456 #undef DECLARE_OPTIONAL_ACCESSORS | 458 #undef DECLARE_OPTIONAL_ACCESSORS |
| 457 | 459 |
| 458 } // namespace internal | 460 } // namespace internal |
| 459 } // namespace v8 | 461 } // namespace v8 |
| 460 | 462 |
| 461 #endif // V8_WASM_OBJECTS_H_ | 463 #endif // V8_WASM_OBJECTS_H_ |
| OLD | NEW |