OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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_MODULE_H_ | 5 #ifndef V8_WASM_MODULE_H_ |
6 #define V8_WASM_MODULE_H_ | 6 #define V8_WASM_MODULE_H_ |
7 | 7 |
8 #include "src/wasm/wasm-opcodes.h" | 8 #include "src/wasm/wasm-opcodes.h" |
9 #include "src/wasm/wasm-result.h" | 9 #include "src/wasm/wasm-result.h" |
10 | 10 |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 return GetNameOrNull(function->name_offset, function->name_length); | 214 return GetNameOrNull(function->name_offset, function->name_length); |
215 } | 215 } |
216 | 216 |
217 // Checks the given offset range is contained within the module bytes. | 217 // Checks the given offset range is contained within the module bytes. |
218 bool BoundsCheck(uint32_t start, uint32_t end) const { | 218 bool BoundsCheck(uint32_t start, uint32_t end) const { |
219 size_t size = module_end - module_start; | 219 size_t size = module_end - module_start; |
220 return start <= size && end <= size; | 220 return start <= size && end <= size; |
221 } | 221 } |
222 | 222 |
223 // Creates a new instantiation of the module in the given isolate. | 223 // Creates a new instantiation of the module in the given isolate. |
224 MaybeHandle<JSObject> Instantiate(Isolate* isolate, Handle<JSObject> ffi, | 224 MaybeHandle<JSObject> Instantiate(Isolate* isolate, Handle<JSReceiver> ffi, |
225 Handle<JSArrayBuffer> memory); | 225 Handle<JSArrayBuffer> memory); |
226 }; | 226 }; |
227 | 227 |
228 // An instantiated WASM module, including memory, function table, etc. | 228 // An instantiated WASM module, including memory, function table, etc. |
229 struct WasmModuleInstance { | 229 struct WasmModuleInstance { |
230 WasmModule* module; // static representation of the module. | 230 WasmModule* module; // static representation of the module. |
231 // -- Heap allocated -------------------------------------------------------- | 231 // -- Heap allocated -------------------------------------------------------- |
232 Handle<JSObject> js_object; // JavaScript module object. | 232 Handle<JSObject> js_object; // JavaScript module object. |
233 Handle<Context> context; // JavaScript native context. | 233 Handle<Context> context; // JavaScript native context. |
234 Handle<JSArrayBuffer> mem_buffer; // Handle to array buffer of memory. | 234 Handle<JSArrayBuffer> mem_buffer; // Handle to array buffer of memory. |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 // Extract a function name from the given wasm object. | 334 // Extract a function name from the given wasm object. |
335 // Returns undefined if the function is unnamed or the function index is | 335 // Returns undefined if the function is unnamed or the function index is |
336 // invalid. | 336 // invalid. |
337 Handle<Object> GetWasmFunctionName(Handle<JSObject> wasm, uint32_t func_index); | 337 Handle<Object> GetWasmFunctionName(Handle<JSObject> wasm, uint32_t func_index); |
338 | 338 |
339 } // namespace wasm | 339 } // namespace wasm |
340 } // namespace internal | 340 } // namespace internal |
341 } // namespace v8 | 341 } // namespace v8 |
342 | 342 |
343 #endif // V8_WASM_MODULE_H_ | 343 #endif // V8_WASM_MODULE_H_ |
OLD | NEW |