| Index: src/wasm/wasm-module.h
|
| diff --git a/src/wasm/wasm-module.h b/src/wasm/wasm-module.h
|
| index a9d61fd71fead418ee80aef288cd2f5ee6f0a718..388a7ee832ddec92a232e62fc20e85e5d2d7563a 100644
|
| --- a/src/wasm/wasm-module.h
|
| +++ b/src/wasm/wasm-module.h
|
| @@ -400,11 +400,13 @@ class WasmCompiledModule : public FixedArray {
|
| #define CORE_WCM_PROPERTY_TABLE(MACRO) \
|
| MACRO(OBJECT, FixedArray, code_table) \
|
| MACRO(OBJECT, Foreign, module_wrapper) \
|
| + /* For debugging: */ \
|
| MACRO(OBJECT, SeqOneByteString, module_bytes) \
|
| - MACRO(OBJECT, Script, asm_js_script) \
|
| + MACRO(OBJECT, Script, script) \
|
| + MACRO(OBJECT, ByteArray, asm_js_offset_tables) \
|
| + /* End of debugging stuff. */ \
|
| MACRO(OBJECT, FixedArray, function_tables) \
|
| MACRO(OBJECT, FixedArray, empty_function_tables) \
|
| - MACRO(OBJECT, ByteArray, asm_js_offset_tables) \
|
| MACRO(OBJECT, JSArrayBuffer, memory) \
|
| MACRO(SMALL_NUMBER, uint32_t, min_mem_pages) \
|
| MACRO(SMALL_NUMBER, uint32_t, max_mem_pages) \
|
| @@ -455,6 +457,10 @@ class WasmCompiledModule : public FixedArray {
|
| return min_mem_pages() * WasmModule::kPageSize;
|
| }
|
|
|
| + WasmModule* cpp_module() const {
|
| + return Handle<WasmModuleWrapper>::cast(module_wrapper())->get();
|
| + }
|
| +
|
| #define DECLARATION(KIND, TYPE, NAME) WCM_##KIND(TYPE, NAME)
|
| WCM_PROPERTY_TABLE(DECLARATION)
|
| #undef DECLARATION
|
| @@ -472,17 +478,20 @@ class WasmCompiledModule : public FixedArray {
|
| DISALLOW_IMPLICIT_CONSTRUCTORS(WasmCompiledModule);
|
| };
|
|
|
| -// Extract a function name from the given wasm object.
|
| -// Returns "<WASM UNNAMED>" if the function is unnamed or the name is not a
|
| -// valid UTF-8 string.
|
| -Handle<String> GetWasmFunctionName(Isolate* isolate, Handle<Object> wasm,
|
| +// Extract a function name from the given compiled wasm module.
|
| +// Returns "<WASM UNNAMED>" if no compiled module is passed, the function is
|
| +// unnamed or the name is not a valid UTF-8 string.
|
| +// TODO(5620): Fix interface once we always get a compiled module.
|
| +Handle<String> GetWasmFunctionName(Isolate* isolate,
|
| + Handle<Object> compiled_module_or_undef,
|
| uint32_t func_index);
|
|
|
| -// Extract a function name from the given wasm object.
|
| +// Extract a function name from the given compiled wasm module.
|
| // Returns a null handle if the function is unnamed or the name is not a valid
|
| // UTF-8 string.
|
| -Handle<Object> GetWasmFunctionNameOrNull(Isolate* isolate, Handle<Object> wasm,
|
| - uint32_t func_index);
|
| +Handle<Object> GetWasmFunctionNameOrNull(
|
| + Isolate* isolate, Handle<WasmCompiledModule> compiled_module,
|
| + uint32_t func_index);
|
|
|
| // Return the binary source bytes of a wasm module.
|
| Handle<SeqOneByteString> GetWasmBytes(Handle<JSObject> wasm);
|
| @@ -514,8 +523,10 @@ WasmCompiledModule* GetCompiledModule(Object* wasm_instance);
|
| // Check whether the wasm module was generated from asm.js code.
|
| bool WasmIsAsmJs(Object* instance, Isolate* isolate);
|
|
|
| -// Get the script for the asm.js origin of the wasm module.
|
| -Handle<Script> GetAsmWasmScript(Handle<JSObject> instance);
|
| +// Get the script of the wasm module. If the origin of the module is asm.js, the
|
| +// returned Script will be a JavaScript Script of Script::TYPE_NORMAL, otherwise
|
| +// it's of type TYPE_WASM.
|
| +Handle<Script> GetScript(Handle<JSObject> instance);
|
|
|
| // Get the asm.js source position for the given byte offset in the given
|
| // function.
|
| @@ -546,8 +557,14 @@ V8_EXPORT_PRIVATE bool ValidateModuleBytes(Isolate* isolate, const byte* start,
|
| ErrorThrower* thrower,
|
| ModuleOrigin origin);
|
|
|
| -// Get the number of imported functions for a WASM instance.
|
| -int GetNumImportedFunctions(Handle<JSObject> instance);
|
| +// Get the offset of the code of a function within a module.
|
| +int GetFunctionCodeOffset(Handle<WasmCompiledModule> compiled_module,
|
| + int func_index);
|
| +
|
| +// Translate from byte offset in the module to function number and byte offset
|
| +// within that function, encoded as line and column in the position info.
|
| +bool GetPositionInfo(Handle<WasmCompiledModule> compiled_module,
|
| + uint32_t position, Script::PositionInfo* info);
|
|
|
| // Assumed to be called with a code object associated to a wasm module instance.
|
| // Intended to be called from runtime functions.
|
|
|