| 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/api.h" | 8 #include "src/api.h" |
| 9 #include "src/handles.h" | 9 #include "src/handles.h" |
| 10 #include "src/wasm/wasm-opcodes.h" | 10 #include "src/wasm/wasm-opcodes.h" |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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<JSReceiver> ffi, | 227 static MaybeHandle<JSObject> Instantiate(Isolate* isolate, |
| 228 Handle<JSArrayBuffer> memory) const; | 228 Handle<FixedArray> compiled_module, |
| 229 Handle<JSReceiver> ffi, |
| 230 Handle<JSArrayBuffer> memory); |
| 229 | 231 |
| 230 Handle<FixedArray> CompileFunctions(Isolate* isolate) const; | 232 MaybeHandle<FixedArray> CompileFunctions(Isolate* isolate) const; |
| 231 | 233 |
| 232 uint32_t FunctionTableSize() const { | 234 uint32_t FunctionTableSize() const { |
| 233 if (indirect_table_size > 0) { | 235 if (indirect_table_size > 0) { |
| 234 return indirect_table_size; | 236 return indirect_table_size; |
| 235 } | 237 } |
| 236 DCHECK_LE(function_table.size(), UINT32_MAX); | 238 DCHECK_LE(function_table.size(), UINT32_MAX); |
| 237 return static_cast<uint32_t>(function_table.size()); | 239 return static_cast<uint32_t>(function_table.size()); |
| 238 } | 240 } |
| 239 }; | 241 }; |
| 240 | 242 |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 // given encoded module. The module should have no imports. | 374 // given encoded module. The module should have no imports. |
| 373 int32_t CompileAndRunWasmModule(Isolate* isolate, const byte* module_start, | 375 int32_t CompileAndRunWasmModule(Isolate* isolate, const byte* module_start, |
| 374 const byte* module_end, bool asm_js = false); | 376 const byte* module_end, bool asm_js = false); |
| 375 | 377 |
| 376 } // namespace testing | 378 } // namespace testing |
| 377 } // namespace wasm | 379 } // namespace wasm |
| 378 } // namespace internal | 380 } // namespace internal |
| 379 } // namespace v8 | 381 } // namespace v8 |
| 380 | 382 |
| 381 #endif // V8_WASM_MODULE_H_ | 383 #endif // V8_WASM_MODULE_H_ |
| OLD | NEW |