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