Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1014)

Unified Diff: src/runtime/runtime-debug.cc

Issue 2493823003: [wasm] Allocate a single script per wasm module (Closed)
Patch Set: Fix signed/unsigned issues Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698