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" |
11 #include "src/wasm/managed.h" | 11 #include "src/wasm/managed.h" |
| 12 #include "src/wasm/wasm-limits.h" |
12 | 13 |
13 namespace v8 { | 14 namespace v8 { |
14 namespace internal { | 15 namespace internal { |
15 namespace wasm { | 16 namespace wasm { |
16 struct WasmModule; | 17 struct WasmModule; |
17 } | 18 } |
18 | 19 |
19 class WasmCompiledModule; | 20 class WasmCompiledModule; |
20 class WasmDebugInfo; | 21 class WasmDebugInfo; |
21 class WasmInstanceObject; | 22 class WasmInstanceObject; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 class WasmTableObject : public JSObject { | 54 class WasmTableObject : public JSObject { |
54 public: | 55 public: |
55 // TODO(titzer): add the brand as an internal field instead of a property. | 56 // TODO(titzer): add the brand as an internal field instead of a property. |
56 enum Fields { kFunctions, kMaximum, kDispatchTables, kFieldCount }; | 57 enum Fields { kFunctions, kMaximum, kDispatchTables, kFieldCount }; |
57 | 58 |
58 DECLARE_CASTS(WasmTableObject); | 59 DECLARE_CASTS(WasmTableObject); |
59 DECLARE_ACCESSORS(functions, FixedArray); | 60 DECLARE_ACCESSORS(functions, FixedArray); |
60 | 61 |
61 FixedArray* dispatch_tables(); | 62 FixedArray* dispatch_tables(); |
62 uint32_t current_length(); | 63 uint32_t current_length(); |
63 uint32_t maximum_length(); | 64 bool has_maximum_length(); |
| 65 int64_t maximum_length(); // Returns < 0 if no maximum. |
64 | 66 |
65 static Handle<WasmTableObject> New(Isolate* isolate, uint32_t initial, | 67 static Handle<WasmTableObject> New(Isolate* isolate, uint32_t initial, |
66 uint32_t maximum, | 68 int64_t maximum, |
67 Handle<FixedArray>* js_functions); | 69 Handle<FixedArray>* js_functions); |
68 static void Grow(Isolate* isolate, Handle<WasmTableObject> table, | 70 static void Grow(Isolate* isolate, Handle<WasmTableObject> table, |
69 uint32_t count); | 71 uint32_t count); |
70 static Handle<FixedArray> AddDispatchTable( | 72 static Handle<FixedArray> AddDispatchTable( |
71 Isolate* isolate, Handle<WasmTableObject> table, | 73 Isolate* isolate, Handle<WasmTableObject> table, |
72 Handle<WasmInstanceObject> instance, int table_index, | 74 Handle<WasmInstanceObject> instance, int table_index, |
73 Handle<FixedArray> function_table, Handle<FixedArray> signature_table); | 75 Handle<FixedArray> function_table, Handle<FixedArray> signature_table); |
74 }; | 76 }; |
75 | 77 |
76 // Representation of a WebAssembly.Memory JavaScript-level object. | 78 // Representation of a WebAssembly.Memory JavaScript-level object. |
77 class WasmMemoryObject : public JSObject { | 79 class WasmMemoryObject : public JSObject { |
78 public: | 80 public: |
79 // TODO(titzer): add the brand as an internal field instead of a property. | 81 // TODO(titzer): add the brand as an internal field instead of a property. |
80 enum Fields : uint8_t { kArrayBuffer, kMaximum, kInstancesLink, kFieldCount }; | 82 enum Fields : uint8_t { kArrayBuffer, kMaximum, kInstancesLink, kFieldCount }; |
81 | 83 |
82 DECLARE_CASTS(WasmMemoryObject); | 84 DECLARE_CASTS(WasmMemoryObject); |
83 DECLARE_ACCESSORS(buffer, JSArrayBuffer); | 85 DECLARE_ACCESSORS(buffer, JSArrayBuffer); |
84 DECLARE_OPTIONAL_ACCESSORS(instances_link, WasmInstanceWrapper); | 86 DECLARE_OPTIONAL_ACCESSORS(instances_link, WasmInstanceWrapper); |
85 | 87 |
86 void AddInstance(Isolate* isolate, Handle<WasmInstanceObject> object); | 88 void AddInstance(Isolate* isolate, Handle<WasmInstanceObject> object); |
87 void ResetInstancesLink(Isolate* isolate); | 89 void ResetInstancesLink(Isolate* isolate); |
88 uint32_t current_pages(); | 90 uint32_t current_pages(); |
89 int32_t maximum_pages(); // returns < 0 if there is no maximum | 91 bool has_maximum_pages(); |
| 92 int32_t maximum_pages(); // Returns < 0 if there is no maximum. |
90 | 93 |
91 static Handle<WasmMemoryObject> New(Isolate* isolate, | 94 static Handle<WasmMemoryObject> New(Isolate* isolate, |
92 Handle<JSArrayBuffer> buffer, | 95 Handle<JSArrayBuffer> buffer, |
93 int maximum); | 96 int32_t maximum); |
94 | 97 |
95 static bool Grow(Isolate* isolate, Handle<WasmMemoryObject> memory, | 98 static bool Grow(Isolate* isolate, Handle<WasmMemoryObject> memory, |
96 uint32_t count); | 99 uint32_t count); |
97 }; | 100 }; |
98 | 101 |
99 // Representation of a WebAssembly.Instance JavaScript-level object. | 102 // Representation of a WebAssembly.Instance JavaScript-level object. |
100 class WasmInstanceObject : public JSObject { | 103 class WasmInstanceObject : public JSObject { |
101 public: | 104 public: |
102 // TODO(titzer): add the brand as an internal field instead of a property. | 105 // TODO(titzer): add the brand as an internal field instead of a property. |
103 enum Fields { | 106 enum Fields { |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 }; | 457 }; |
455 }; | 458 }; |
456 | 459 |
457 #undef DECLARE_ACCESSORS | 460 #undef DECLARE_ACCESSORS |
458 #undef DECLARE_OPTIONAL_ACCESSORS | 461 #undef DECLARE_OPTIONAL_ACCESSORS |
459 | 462 |
460 } // namespace internal | 463 } // namespace internal |
461 } // namespace v8 | 464 } // namespace v8 |
462 | 465 |
463 #endif // V8_WASM_OBJECTS_H_ | 466 #endif // V8_WASM_OBJECTS_H_ |
OLD | NEW |