| Index: src/runtime/runtime-debug.cc
|
| diff --git a/src/runtime/runtime-debug.cc b/src/runtime/runtime-debug.cc
|
| index b1bd85c34dae937c0a6b0e24e8a6a0280e34f806..297146ef56dcb0f6e7539580c620690155519592 100644
|
| --- a/src/runtime/runtime-debug.cc
|
| +++ b/src/runtime/runtime-debug.cc
|
| @@ -552,9 +552,11 @@ RUNTIME_FUNCTION(Runtime_GetFrameDetails) {
|
|
|
| // Add the function name.
|
| Handle<Object> wasm_instance(it.wasm_frame()->wasm_instance(), isolate);
|
| + Handle<wasm::WasmCompiledModule> compiled_module(
|
| + wasm::GetCompiledModule(*wasm_instance), isolate);
|
| int func_index = it.wasm_frame()->function_index();
|
| Handle<String> func_name =
|
| - wasm::GetWasmFunctionName(isolate, wasm_instance, func_index);
|
| + wasm::GetWasmFunctionName(isolate, compiled_module, func_index);
|
| details->set(kFrameDetailsFunctionIndex, *func_name);
|
|
|
| // Add the script wrapper
|
| @@ -569,8 +571,20 @@ RUNTIME_FUNCTION(Runtime_GetFrameDetails) {
|
| details->set(kFrameDetailsLocalCountIndex, Smi::kZero);
|
|
|
| // Add the source position.
|
| + // For wasm, it is function-local, so translate it to a module-relative
|
| + // position, such that together with the script it uniquely identifies the
|
| + // position.
|
| + Handle<Object> positionValue;
|
| if (position != kNoSourcePosition) {
|
| - details->set(kFrameDetailsSourcePositionIndex, Smi::FromInt(position));
|
| + int translated_position = position;
|
| + if (!wasm::WasmIsAsmJs(*wasm_instance, isolate)) {
|
| + Handle<wasm::WasmCompiledModule> compiled_module(
|
| + wasm::GetCompiledModule(JSObject::cast(*wasm_instance)), isolate);
|
| + translated_position +=
|
| + wasm::GetFunctionCodeOffset(compiled_module, func_index);
|
| + }
|
| + details->set(kFrameDetailsSourcePositionIndex,
|
| + Smi::FromInt(translated_position));
|
| }
|
|
|
| // Add the constructor information.
|
| @@ -1897,36 +1911,5 @@ RUNTIME_FUNCTION(Runtime_DebugBreakInOptimizedCode) {
|
| return NULL;
|
| }
|
|
|
| -// TODO(5530): Remove once uses in debug.js are gone.
|
| -RUNTIME_FUNCTION(Runtime_GetWasmFunctionOffsetTable) {
|
| - DCHECK(args.length() == 1);
|
| - HandleScope scope(isolate);
|
| - CONVERT_ARG_CHECKED(JSValue, script_val, 0);
|
| -
|
| - CHECK(script_val->value()->IsScript());
|
| - Handle<Script> script = Handle<Script>(Script::cast(script_val->value()));
|
| -
|
| - Handle<wasm::WasmDebugInfo> debug_info =
|
| - wasm::GetDebugInfo(handle(script->wasm_instance(), isolate));
|
| - Handle<FixedArray> elements = wasm::WasmDebugInfo::GetFunctionOffsetTable(
|
| - debug_info, script->wasm_function_index());
|
| - return *isolate->factory()->NewJSArrayWithElements(elements);
|
| -}
|
| -
|
| -// TODO(5530): Remove once uses in debug.js are gone.
|
| -RUNTIME_FUNCTION(Runtime_DisassembleWasmFunction) {
|
| - DCHECK(args.length() == 1);
|
| - HandleScope scope(isolate);
|
| - CONVERT_ARG_CHECKED(JSValue, script_val, 0);
|
| -
|
| - CHECK(script_val->value()->IsScript());
|
| - Handle<Script> script = Handle<Script>(Script::cast(script_val->value()));
|
| -
|
| - Handle<wasm::WasmDebugInfo> debug_info =
|
| - wasm::GetDebugInfo(handle(script->wasm_instance(), isolate));
|
| - return *wasm::WasmDebugInfo::DisassembleFunction(
|
| - debug_info, script->wasm_function_index());
|
| -}
|
| -
|
| } // namespace internal
|
| } // namespace v8
|
|
|