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 27 matching lines...) Expand all Loading... |
38 DECLARE_ACCESSORS(name, type) | 38 DECLARE_ACCESSORS(name, type) |
39 | 39 |
40 #define DECLARE_OPTIONAL_GETTER(name, type) \ | 40 #define DECLARE_OPTIONAL_GETTER(name, type) \ |
41 bool has_##name(); \ | 41 bool has_##name(); \ |
42 DECLARE_GETTER(name, type) | 42 DECLARE_GETTER(name, type) |
43 | 43 |
44 // Representation of a WebAssembly.Module JavaScript-level object. | 44 // Representation of a WebAssembly.Module JavaScript-level object. |
45 class WasmModuleObject : public JSObject { | 45 class WasmModuleObject : public JSObject { |
46 public: | 46 public: |
47 // If a second field is added, we need a kWrapperTracerHeader field as well. | 47 // If a second field is added, we need a kWrapperTracerHeader field as well. |
48 // TODO(titzer): add the brand as an internal field instead of a property. | 48 // TODO(titzer): add the brand as an embedder field instead of a property. |
49 enum Fields { kCompiledModule, kFieldCount }; | 49 enum Fields { kCompiledModule, kFieldCount }; |
50 | 50 |
51 DECLARE_CASTS(WasmModuleObject); | 51 DECLARE_CASTS(WasmModuleObject); |
52 | 52 |
53 WasmCompiledModule* compiled_module(); | 53 WasmCompiledModule* compiled_module(); |
54 | 54 |
55 static Handle<WasmModuleObject> New( | 55 static Handle<WasmModuleObject> New( |
56 Isolate* isolate, Handle<WasmCompiledModule> compiled_module); | 56 Isolate* isolate, Handle<WasmCompiledModule> compiled_module); |
57 }; | 57 }; |
58 | 58 |
59 // Representation of a WebAssembly.Table JavaScript-level object. | 59 // Representation of a WebAssembly.Table JavaScript-level object. |
60 class WasmTableObject : public JSObject { | 60 class WasmTableObject : public JSObject { |
61 public: | 61 public: |
62 // The 0-th field is used by the Blink Wrapper Tracer. | 62 // The 0-th field is used by the Blink Wrapper Tracer. |
63 // TODO(titzer): add the brand as an internal field instead of a property. | 63 // TODO(titzer): add the brand as an embedder field instead of a property. |
64 enum Fields { | 64 enum Fields { |
65 kWrapperTracerHeader, | 65 kWrapperTracerHeader, |
66 kFunctions, | 66 kFunctions, |
67 kMaximum, | 67 kMaximum, |
68 kDispatchTables, | 68 kDispatchTables, |
69 kFieldCount | 69 kFieldCount |
70 }; | 70 }; |
71 | 71 |
72 DECLARE_CASTS(WasmTableObject); | 72 DECLARE_CASTS(WasmTableObject); |
73 DECLARE_ACCESSORS(functions, FixedArray); | 73 DECLARE_ACCESSORS(functions, FixedArray); |
(...skipping 11 matching lines...) Expand all Loading... |
85 static Handle<FixedArray> AddDispatchTable( | 85 static Handle<FixedArray> AddDispatchTable( |
86 Isolate* isolate, Handle<WasmTableObject> table, | 86 Isolate* isolate, Handle<WasmTableObject> table, |
87 Handle<WasmInstanceObject> instance, int table_index, | 87 Handle<WasmInstanceObject> instance, int table_index, |
88 Handle<FixedArray> function_table, Handle<FixedArray> signature_table); | 88 Handle<FixedArray> function_table, Handle<FixedArray> signature_table); |
89 }; | 89 }; |
90 | 90 |
91 // Representation of a WebAssembly.Memory JavaScript-level object. | 91 // Representation of a WebAssembly.Memory JavaScript-level object. |
92 class WasmMemoryObject : public JSObject { | 92 class WasmMemoryObject : public JSObject { |
93 public: | 93 public: |
94 // The 0-th field is used by the Blink Wrapper Tracer. | 94 // The 0-th field is used by the Blink Wrapper Tracer. |
95 // TODO(titzer): add the brand as an internal field instead of a property. | 95 // TODO(titzer): add the brand as an embedder field instead of a property. |
96 enum Fields : uint8_t { | 96 enum Fields : uint8_t { |
97 kWrapperTracerHeader, | 97 kWrapperTracerHeader, |
98 kArrayBuffer, | 98 kArrayBuffer, |
99 kMaximum, | 99 kMaximum, |
100 kInstancesLink, | 100 kInstancesLink, |
101 kFieldCount | 101 kFieldCount |
102 }; | 102 }; |
103 | 103 |
104 DECLARE_CASTS(WasmMemoryObject); | 104 DECLARE_CASTS(WasmMemoryObject); |
105 DECLARE_ACCESSORS(buffer, JSArrayBuffer); | 105 DECLARE_ACCESSORS(buffer, JSArrayBuffer); |
(...skipping 10 matching lines...) Expand all Loading... |
116 int32_t maximum); | 116 int32_t maximum); |
117 | 117 |
118 static bool Grow(Isolate* isolate, Handle<WasmMemoryObject> memory, | 118 static bool Grow(Isolate* isolate, Handle<WasmMemoryObject> memory, |
119 uint32_t count); | 119 uint32_t count); |
120 }; | 120 }; |
121 | 121 |
122 // Representation of a WebAssembly.Instance JavaScript-level object. | 122 // Representation of a WebAssembly.Instance JavaScript-level object. |
123 class WasmInstanceObject : public JSObject { | 123 class WasmInstanceObject : public JSObject { |
124 public: | 124 public: |
125 // The 0-th field is used by the Blink Wrapper Tracer. | 125 // The 0-th field is used by the Blink Wrapper Tracer. |
126 // TODO(titzer): add the brand as an internal field instead of a property. | 126 // TODO(titzer): add the brand as an embedder field instead of a property. |
127 enum Fields { | 127 enum Fields { |
128 kWrapperTracerHeader, | 128 kWrapperTracerHeader, |
129 kCompiledModule, | 129 kCompiledModule, |
130 kMemoryObject, | 130 kMemoryObject, |
131 kMemoryArrayBuffer, | 131 kMemoryArrayBuffer, |
132 kGlobalsArrayBuffer, | 132 kGlobalsArrayBuffer, |
133 kDebugInfo, | 133 kDebugInfo, |
134 kWasmMemInstanceWrapper, | 134 kWasmMemInstanceWrapper, |
135 kFieldCount | 135 kFieldCount |
136 }; | 136 }; |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
523 }; | 523 }; |
524 }; | 524 }; |
525 | 525 |
526 #undef DECLARE_ACCESSORS | 526 #undef DECLARE_ACCESSORS |
527 #undef DECLARE_OPTIONAL_ACCESSORS | 527 #undef DECLARE_OPTIONAL_ACCESSORS |
528 | 528 |
529 } // namespace internal | 529 } // namespace internal |
530 } // namespace v8 | 530 } // namespace v8 |
531 | 531 |
532 #endif // V8_WASM_OBJECTS_H_ | 532 #endif // V8_WASM_OBJECTS_H_ |
OLD | NEW |