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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 int32_t CompileAndRunWasmModule(Isolate* isolate, const byte* module_start, | 370 int32_t CompileAndRunWasmModule(Isolate* isolate, const byte* module_start, |
369 const byte* module_end, bool asm_js = false); | 371 const byte* module_end, bool asm_js = false); |
370 | 372 |
371 } // namespace testing | 373 } // namespace testing |
372 | 374 |
373 } // namespace wasm | 375 } // namespace wasm |
374 } // namespace internal | 376 } // namespace internal |
375 } // namespace v8 | 377 } // namespace v8 |
376 | 378 |
377 #endif // V8_WASM_MODULE_H_ | 379 #endif // V8_WASM_MODULE_H_ |
OLD | NEW |