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

Unified Diff: src/frames.cc

Issue 2413693003: [wasm] Stack inspection support for asm.js frames (Closed)
Patch Set: Created 4 years, 2 months 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
« no previous file with comments | « src/frames.h ('k') | src/wasm/wasm-module.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/frames.cc
diff --git a/src/frames.cc b/src/frames.cc
index c67fdc2d94fdd5e524890be41c56a6c377471d47..92a98e8c98df9501f8d4fdce0a147bbd696665ca 100644
--- a/src/frames.cc
+++ b/src/frames.cc
@@ -720,6 +720,12 @@ Object* StandardFrame::context() const {
return isolate()->heap()->undefined_value();
}
+int StandardFrame::position() const {
+ AbstractCode* code = AbstractCode::cast(LookupCode());
+ int code_offset = static_cast<int>(pc() - code->instruction_start());
+ return code->SourcePosition(code_offset);
+}
+
int StandardFrame::ComputeExpressionsCount() const {
Address base = GetExpressionAddress(0);
Address limit = sp() - kPointerSize;
@@ -1335,6 +1341,12 @@ Object* OptimizedFrame::StackSlotAt(int index) const {
return Memory::Object_at(fp() + StackSlotOffsetRelativeToFp(index));
}
+int InterpretedFrame::position() const {
+ AbstractCode* code = AbstractCode::cast(GetBytecodeArray());
+ int code_offset = GetBytecodeOffset();
+ return code->SourcePosition(code_offset);
+}
+
int InterpretedFrame::LookupExceptionHandlerInTable(
int* context_register, HandlerTable::CatchPrediction* prediction) {
BytecodeArray* bytecode = function()->shared()->bytecode_array();
@@ -1474,10 +1486,22 @@ uint32_t WasmFrame::function_index() const {
Script* WasmFrame::script() const {
Handle<JSObject> wasm(JSObject::cast(wasm_obj()), isolate());
+ if (wasm::WasmIsAsmJs(*wasm, isolate())) {
+ return *wasm::GetAsmWasmScript(wasm);
+ }
Handle<wasm::WasmDebugInfo> debug_info = wasm::GetDebugInfo(wasm);
return wasm::WasmDebugInfo::GetFunctionScript(debug_info, function_index());
}
+int WasmFrame::position() const {
+ int position = StandardFrame::position();
+ if (wasm::WasmIsAsmJs(wasm_obj(), isolate())) {
+ Handle<JSObject> wasm(JSObject::cast(wasm_obj()), isolate());
+ position = wasm::GetAsmWasmSourcePosition(wasm, function_index(), position);
+ }
+ return position;
+}
+
int WasmFrame::LookupExceptionHandlerInTable(int* stack_slots) {
DCHECK_NOT_NULL(stack_slots);
Code* code = LookupCode();
« no previous file with comments | « src/frames.h ('k') | src/wasm/wasm-module.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698