| 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 <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "src/api.h" | 10 #include "src/api.h" |
| (...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 Handle<String> GetWasmFunctionName(Isolate* isolate, Handle<Object> wasm, | 471 Handle<String> GetWasmFunctionName(Isolate* isolate, Handle<Object> wasm, |
| 472 uint32_t func_index); | 472 uint32_t func_index); |
| 473 | 473 |
| 474 // Extract a function name from the given wasm object. | 474 // Extract a function name from the given wasm object. |
| 475 // Returns a null handle if the function is unnamed or the name is not a valid | 475 // Returns a null handle if the function is unnamed or the name is not a valid |
| 476 // UTF-8 string. | 476 // UTF-8 string. |
| 477 Handle<Object> GetWasmFunctionNameOrNull(Isolate* isolate, Handle<Object> wasm, | 477 Handle<Object> GetWasmFunctionNameOrNull(Isolate* isolate, Handle<Object> wasm, |
| 478 uint32_t func_index); | 478 uint32_t func_index); |
| 479 | 479 |
| 480 // Return the binary source bytes of a wasm module. | 480 // Return the binary source bytes of a wasm module. |
| 481 SeqOneByteString* GetWasmBytes(JSObject* wasm); | 481 Handle<SeqOneByteString> GetWasmBytes(Handle<JSObject> wasm); |
| 482 | 482 |
| 483 // Get the debug info associated with the given wasm object. | 483 // Get the debug info associated with the given wasm object. |
| 484 // If no debug info exists yet, it is created automatically. | 484 // If no debug info exists yet, it is created automatically. |
| 485 Handle<WasmDebugInfo> GetDebugInfo(Handle<JSObject> wasm); | 485 Handle<WasmDebugInfo> GetDebugInfo(Handle<JSObject> wasm); |
| 486 | 486 |
| 487 // Return the number of functions in the given wasm object. | 487 // Return the number of functions in the given wasm object. |
| 488 int GetNumberOfFunctions(JSObject* wasm); | 488 int GetNumberOfFunctions(Handle<JSObject> wasm); |
| 489 | 489 |
| 490 // Create and export JSFunction | 490 // Create and export JSFunction |
| 491 Handle<JSFunction> WrapExportCodeAsJSFunction(Isolate* isolate, | 491 Handle<JSFunction> WrapExportCodeAsJSFunction(Isolate* isolate, |
| 492 Handle<Code> export_code, | 492 Handle<Code> export_code, |
| 493 Handle<String> name, int arity, | 493 Handle<String> name, int arity, |
| 494 MaybeHandle<ByteArray> signature, | 494 MaybeHandle<ByteArray> signature, |
| 495 Handle<JSObject> module_instance); | 495 Handle<JSObject> module_instance); |
| 496 | 496 |
| 497 // Check whether the given object is a wasm object. | 497 // Check whether the given object is a wasm object. |
| 498 // This checks the number and type of internal fields, so it's not 100 percent | 498 // This checks the number and type of internal fields, so it's not 100 percent |
| (...skipping 24 matching lines...) Expand all Loading... |
| 523 V8_EXPORT_PRIVATE MaybeHandle<JSObject> CreateModuleObjectFromBytes( | 523 V8_EXPORT_PRIVATE MaybeHandle<JSObject> CreateModuleObjectFromBytes( |
| 524 Isolate* isolate, const byte* start, const byte* end, ErrorThrower* thrower, | 524 Isolate* isolate, const byte* start, const byte* end, ErrorThrower* thrower, |
| 525 ModuleOrigin origin); | 525 ModuleOrigin origin); |
| 526 | 526 |
| 527 V8_EXPORT_PRIVATE bool ValidateModuleBytes(Isolate* isolate, const byte* start, | 527 V8_EXPORT_PRIVATE bool ValidateModuleBytes(Isolate* isolate, const byte* start, |
| 528 const byte* end, | 528 const byte* end, |
| 529 ErrorThrower* thrower, | 529 ErrorThrower* thrower, |
| 530 ModuleOrigin origin); | 530 ModuleOrigin origin); |
| 531 | 531 |
| 532 // Get the number of imported functions for a WASM instance. | 532 // Get the number of imported functions for a WASM instance. |
| 533 uint32_t GetNumImportedFunctions(Handle<JSObject> wasm_object); | 533 int GetNumImportedFunctions(Handle<JSObject> wasm_object); |
| 534 | 534 |
| 535 // Assumed to be called with a code object associated to a wasm module instance. | 535 // Assumed to be called with a code object associated to a wasm module instance. |
| 536 // Intended to be called from runtime functions. | 536 // Intended to be called from runtime functions. |
| 537 // Returns nullptr on failing to get owning instance. | 537 // Returns nullptr on failing to get owning instance. |
| 538 Object* GetOwningWasmInstance(Code* code); | 538 Object* GetOwningWasmInstance(Code* code); |
| 539 | 539 |
| 540 int32_t GetInstanceMemorySize(Isolate* isolate, Handle<JSObject> instance); | 540 int32_t GetInstanceMemorySize(Isolate* isolate, Handle<JSObject> instance); |
| 541 | 541 |
| 542 int32_t GrowInstanceMemory(Isolate* isolate, Handle<JSObject> instance, | 542 int32_t GrowInstanceMemory(Isolate* isolate, Handle<JSObject> instance, |
| 543 uint32_t pages); | 543 uint32_t pages); |
| 544 | 544 |
| 545 namespace testing { | 545 namespace testing { |
| 546 | 546 |
| 547 void ValidateInstancesChain(Isolate* isolate, Handle<JSObject> module_obj, | 547 void ValidateInstancesChain(Isolate* isolate, Handle<JSObject> module_obj, |
| 548 int instance_count); | 548 int instance_count); |
| 549 void ValidateModuleState(Isolate* isolate, Handle<JSObject> module_obj); | 549 void ValidateModuleState(Isolate* isolate, Handle<JSObject> module_obj); |
| 550 void ValidateOrphanedInstance(Isolate* isolate, Handle<JSObject> instance); | 550 void ValidateOrphanedInstance(Isolate* isolate, Handle<JSObject> instance); |
| 551 | 551 |
| 552 } // namespace testing | 552 } // namespace testing |
| 553 } // namespace wasm | 553 } // namespace wasm |
| 554 } // namespace internal | 554 } // namespace internal |
| 555 } // namespace v8 | 555 } // namespace v8 |
| 556 | 556 |
| 557 #endif // V8_WASM_MODULE_H_ | 557 #endif // V8_WASM_MODULE_H_ |
| OLD | NEW |