| 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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 213   } | 213   } | 
| 214 | 214 | 
| 215   // Get a string stored in the module bytes representing a function name. | 215   // Get a string stored in the module bytes representing a function name. | 
| 216   WasmName GetNameOrNull(WasmFunction* function) const { | 216   WasmName GetNameOrNull(WasmFunction* function) const { | 
| 217     return GetNameOrNull(function->name_offset, function->name_length); | 217     return GetNameOrNull(function->name_offset, function->name_length); | 
| 218   } | 218   } | 
| 219 | 219 | 
| 220   // Checks the given offset range is contained within the module bytes. | 220   // Checks the given offset range is contained within the module bytes. | 
| 221   bool BoundsCheck(uint32_t start, uint32_t end) const { | 221   bool BoundsCheck(uint32_t start, uint32_t end) const { | 
| 222     size_t size = module_end - module_start; | 222     size_t size = module_end - module_start; | 
| 223     return start < size && end < size; | 223     return start <= size && end <= size; | 
| 224   } | 224   } | 
| 225 | 225 | 
| 226   // Creates a new instantiation of the module in the given isolate. | 226   // Creates a new instantiation of the module in the given isolate. | 
| 227   MaybeHandle<JSObject> Instantiate(Isolate* isolate, Handle<JSObject> ffi, | 227   MaybeHandle<JSObject> Instantiate(Isolate* isolate, Handle<JSObject> ffi, | 
| 228                                     Handle<JSArrayBuffer> memory); | 228                                     Handle<JSArrayBuffer> memory); | 
| 229 }; | 229 }; | 
| 230 | 230 | 
| 231 // An instantiated WASM module, including memory, function table, etc. | 231 // An instantiated WASM module, including memory, function table, etc. | 
| 232 struct WasmModuleInstance { | 232 struct WasmModuleInstance { | 
| 233   WasmModule* module;  // static representation of the module. | 233   WasmModule* module;  // static representation of the module. | 
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 337 // Extract a function name from the given wasm object. | 337 // Extract a function name from the given wasm object. | 
| 338 // Returns undefined if the function is unnamed or the function index is | 338 // Returns undefined if the function is unnamed or the function index is | 
| 339 // invalid. | 339 // invalid. | 
| 340 Handle<Object> GetWasmFunctionName(Handle<JSObject> wasm, uint32_t func_index); | 340 Handle<Object> GetWasmFunctionName(Handle<JSObject> wasm, uint32_t func_index); | 
| 341 | 341 | 
| 342 }  // namespace wasm | 342 }  // namespace wasm | 
| 343 }  // namespace internal | 343 }  // namespace internal | 
| 344 }  // namespace v8 | 344 }  // namespace v8 | 
| 345 | 345 | 
| 346 #endif  // V8_WASM_MODULE_H_ | 346 #endif  // V8_WASM_MODULE_H_ | 
| OLD | NEW | 
|---|