Commit a7a201b2 authored by Clemens Backes's avatar Clemens Backes Committed by Commit Bot

[wasm][debug][cleanup] Remove redundant Isolate parameter

The Isolate is only used to access the wasm engine, and the accounting
allocating. The latter is also linked directly from the wasm engine, and
the engine is linked from the native module, to which the DebugInfoImpl
already has access.
Hence, this CL removes the redundant Isolate pointers, and just accesses
the engine and the allocator via the NativeModule.

R=thibaudm@chromium.org

Change-Id: Ib51cee2d166443a34e22fa02e8ad1549328aaa7f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2214827Reviewed-by: 's avatarThibaud Michaud <thibaudm@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67966}
parent cfeb66d2
......@@ -202,8 +202,8 @@ class DebugEvaluatorProxy {
DCHECK(frame_->is_wasm());
wasm::DebugInfo* debug_info =
WasmFrame::cast(frame_)->native_module()->GetDebugInfo();
return debug_info->GetLocalValue(local, isolate_, frame_->pc(),
frame_->fp(), frame_->callee_fp());
return debug_info->GetLocalValue(local, frame_->pc(), frame_->fp(),
frame_->callee_fp());
}
uint32_t GetArgAsUInt32(const v8::FunctionCallbackInfo<v8::Value>& args,
......
......@@ -374,29 +374,29 @@ class DebugInfoImpl {
explicit DebugInfoImpl(NativeModule* native_module)
: native_module_(native_module) {}
int GetNumLocals(Isolate* isolate, Address pc) {
FrameInspectionScope scope(this, isolate, pc);
int GetNumLocals(Address pc) {
FrameInspectionScope scope(this, pc);
if (!scope.is_inspectable()) return 0;
return scope.debug_side_table->num_locals();
}
WasmValue GetLocalValue(int local, Isolate* isolate, Address pc, Address fp,
WasmValue GetLocalValue(int local, Address pc, Address fp,
Address debug_break_fp) {
FrameInspectionScope scope(this, isolate, pc);
FrameInspectionScope scope(this, pc);
return GetValue(scope.debug_side_table_entry, local, fp, debug_break_fp);
}
int GetStackDepth(Isolate* isolate, Address pc) {
FrameInspectionScope scope(this, isolate, pc);
int GetStackDepth(Address pc) {
FrameInspectionScope scope(this, pc);
if (!scope.is_inspectable()) return 0;
int num_locals = static_cast<int>(scope.debug_side_table->num_locals());
int value_count = scope.debug_side_table_entry->num_values();
return value_count - num_locals;
}
WasmValue GetStackValue(int index, Isolate* isolate, Address pc, Address fp,
WasmValue GetStackValue(int index, Address pc, Address fp,
Address debug_break_fp) {
FrameInspectionScope scope(this, isolate, pc);
FrameInspectionScope scope(this, pc);
int num_locals = static_cast<int>(scope.debug_side_table->num_locals());
int value_count = scope.debug_side_table_entry->num_values();
if (num_locals + index >= value_count) return {};
......@@ -406,7 +406,7 @@ class DebugInfoImpl {
Handle<JSObject> GetLocalScopeObject(Isolate* isolate, Address pc, Address fp,
Address debug_break_fp) {
FrameInspectionScope scope(this, isolate, pc);
FrameInspectionScope scope(this, pc);
Handle<JSObject> local_scope_object =
isolate->factory()->NewJSObjectWithNullProto();
......@@ -451,7 +451,7 @@ class DebugInfoImpl {
Handle<JSObject> GetStackScopeObject(Isolate* isolate, Address pc, Address fp,
Address debug_break_fp) {
FrameInspectionScope scope(this, isolate, pc);
FrameInspectionScope scope(this, pc);
Handle<JSObject> stack_scope_obj =
isolate->factory()->NewJSObjectWithNullProto();
......@@ -644,13 +644,14 @@ class DebugInfoImpl {
private:
struct FrameInspectionScope {
FrameInspectionScope(DebugInfoImpl* debug_info, Isolate* isolate,
Address pc)
: code(isolate->wasm_engine()->code_manager()->LookupCode(pc)),
FrameInspectionScope(DebugInfoImpl* debug_info, Address pc)
: code(debug_info->native_module_->engine()->code_manager()->LookupCode(
pc)),
pc_offset(static_cast<int>(pc - code->instruction_start())),
debug_side_table(
code->is_inspectable()
? debug_info->GetDebugSideTable(code, isolate->allocator())
? debug_info->GetDebugSideTable(
code, debug_info->native_module_->engine()->allocator())
: nullptr),
debug_side_table_entry(debug_side_table
? debug_side_table->GetEntry(pc_offset)
......@@ -842,22 +843,18 @@ DebugInfo::DebugInfo(NativeModule* native_module)
DebugInfo::~DebugInfo() = default;
int DebugInfo::GetNumLocals(Isolate* isolate, Address pc) {
return impl_->GetNumLocals(isolate, pc);
}
int DebugInfo::GetNumLocals(Address pc) { return impl_->GetNumLocals(pc); }
WasmValue DebugInfo::GetLocalValue(int local, Isolate* isolate, Address pc,
Address fp, Address debug_break_fp) {
return impl_->GetLocalValue(local, isolate, pc, fp, debug_break_fp);
WasmValue DebugInfo::GetLocalValue(int local, Address pc, Address fp,
Address debug_break_fp) {
return impl_->GetLocalValue(local, pc, fp, debug_break_fp);
}
int DebugInfo::GetStackDepth(Isolate* isolate, Address pc) {
return impl_->GetStackDepth(isolate, pc);
}
int DebugInfo::GetStackDepth(Address pc) { return impl_->GetStackDepth(pc); }
WasmValue DebugInfo::GetStackValue(int index, Isolate* isolate, Address pc,
Address fp, Address debug_break_fp) {
return impl_->GetStackValue(index, isolate, pc, fp, debug_break_fp);
WasmValue DebugInfo::GetStackValue(int index, Address pc, Address fp,
Address debug_break_fp) {
return impl_->GetStackValue(index, pc, fp, debug_break_fp);
}
Handle<JSObject> DebugInfo::GetLocalScopeObject(Isolate* isolate, Address pc,
......
......@@ -149,11 +149,11 @@ class V8_EXPORT_PRIVATE DebugInfo {
// For the frame inspection methods below:
// {fp} is the frame pointer of the Liftoff frame, {debug_break_fp} that of
// the {WasmDebugBreak} frame (if any).
int GetNumLocals(Isolate*, Address pc);
WasmValue GetLocalValue(int local, Isolate*, Address pc, Address fp,
int GetNumLocals(Address pc);
WasmValue GetLocalValue(int local, Address pc, Address fp,
Address debug_break_fp);
int GetStackDepth(Isolate*, Address pc);
WasmValue GetStackValue(int index, Isolate*, Address pc, Address fp,
int GetStackDepth(Address pc);
WasmValue GetStackValue(int index, Address pc, Address fp,
Address debug_break_fp);
Handle<JSObject> GetLocalScopeObject(Isolate*, Address pc, Address fp,
......
......@@ -233,19 +233,19 @@ class CollectValuesBreakHandler : public debug::DebugDelegate {
WasmFrame* frame = WasmFrame::cast(frame_it.frame());
DebugInfo* debug_info = frame->native_module()->GetDebugInfo();
int num_locals = debug_info->GetNumLocals(isolate_, frame->pc());
int num_locals = debug_info->GetNumLocals(frame->pc());
CHECK_EQ(expected.locals.size(), num_locals);
for (int i = 0; i < num_locals; ++i) {
WasmValue local_value = debug_info->GetLocalValue(
i, isolate_, frame->pc(), frame->fp(), frame->callee_fp());
i, frame->pc(), frame->fp(), frame->callee_fp());
CHECK_EQ(WasmValWrapper{expected.locals[i]}, WasmValWrapper{local_value});
}
int stack_depth = debug_info->GetStackDepth(isolate_, frame->pc());
int stack_depth = debug_info->GetStackDepth(frame->pc());
CHECK_EQ(expected.stack.size(), stack_depth);
for (int i = 0; i < stack_depth; ++i) {
WasmValue stack_value = debug_info->GetStackValue(
i, isolate_, frame->pc(), frame->fp(), frame->callee_fp());
i, frame->pc(), frame->fp(), frame->callee_fp());
CHECK_EQ(WasmValWrapper{expected.stack[i]}, WasmValWrapper{stack_value});
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment