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 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 Handle<Object> GetWasmFunctionNameOrNull(Isolate* isolate, Handle<Object> wasm, | 349 Handle<Object> GetWasmFunctionNameOrNull(Isolate* isolate, Handle<Object> wasm, |
350 uint32_t func_index); | 350 uint32_t func_index); |
351 | 351 |
352 // Return the binary source bytes of a wasm module. | 352 // Return the binary source bytes of a wasm module. |
353 SeqOneByteString* GetWasmBytes(JSObject* wasm); | 353 SeqOneByteString* GetWasmBytes(JSObject* wasm); |
354 | 354 |
355 // Get the debug info associated with the given wasm object. | 355 // Get the debug info associated with the given wasm object. |
356 // If no debug info exists yet, it is created automatically. | 356 // If no debug info exists yet, it is created automatically. |
357 WasmDebugInfo* GetDebugInfo(JSObject* wasm); | 357 WasmDebugInfo* GetDebugInfo(JSObject* wasm); |
358 | 358 |
| 359 // Return the number of functions in the given wasm object. |
| 360 int GetNumberOfFunctions(JSObject* wasm); |
| 361 |
359 // Check whether the given object is a wasm object. | 362 // Check whether the given object is a wasm object. |
360 // This checks the number and type of internal fields, so it's not 100 percent | 363 // This checks the number and type of internal fields, so it's not 100 percent |
361 // secure. If it turns out that we need more complete checks, we could add a | 364 // secure. If it turns out that we need more complete checks, we could add a |
362 // special marker as internal field, which will definitely never occur anywhere | 365 // special marker as internal field, which will definitely never occur anywhere |
363 // else. | 366 // else. |
364 bool IsWasmObject(Object* object); | 367 bool IsWasmObject(Object* object); |
365 | 368 |
366 // Update memory references of code objects associated with the module | 369 // Update memory references of code objects associated with the module |
367 bool UpdateWasmModuleMemory(JSObject* object, Address old_start, | 370 bool UpdateWasmModuleMemory(JSObject* object, Address old_start, |
368 Address new_start, uint32_t old_size, | 371 Address new_start, uint32_t old_size, |
369 uint32_t new_size); | 372 uint32_t new_size); |
370 | 373 |
371 namespace testing { | 374 namespace testing { |
372 | 375 |
373 // Decode, verify, and run the function labeled "main" in the | 376 // Decode, verify, and run the function labeled "main" in the |
374 // given encoded module. The module should have no imports. | 377 // given encoded module. The module should have no imports. |
375 int32_t CompileAndRunWasmModule(Isolate* isolate, const byte* module_start, | 378 int32_t CompileAndRunWasmModule(Isolate* isolate, const byte* module_start, |
376 const byte* module_end, bool asm_js = false); | 379 const byte* module_end, bool asm_js = false); |
377 | 380 |
378 } // namespace testing | 381 } // namespace testing |
379 } // namespace wasm | 382 } // namespace wasm |
380 } // namespace internal | 383 } // namespace internal |
381 } // namespace v8 | 384 } // namespace v8 |
382 | 385 |
383 #endif // V8_WASM_MODULE_H_ | 386 #endif // V8_WASM_MODULE_H_ |
OLD | NEW |