Index: src/js/messages.js |
diff --git a/src/js/messages.js b/src/js/messages.js |
index d99b920815d622ec84f4738ab95f32b809fecc49..4d683e76a384c44b579471c521bba701256dffdb 100644 |
--- a/src/js/messages.js |
+++ b/src/js/messages.js |
@@ -836,7 +836,10 @@ function GetStackFrames(raw_stack) { |
var fun = raw_stack[i + 1]; |
var code = raw_stack[i + 2]; |
var pc = raw_stack[i + 3]; |
- var pos = %FunctionGetPositionForOffset(code, pc); |
+ // For traps in wasm, the bytecode offset is passed as (-1 - offset). |
+ // Otherwise, lookup the position from the pc. |
+ var pos = IS_NUMBER(fun) && pc < 0 ? (-1 - pc) : |
+ %FunctionGetPositionForOffset(code, pc); |
sloppy_frames--; |
frames.push(new CallSite(recv, fun, pos, (sloppy_frames < 0))); |
} |