OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // ------------------------------------------------------------------- | 5 // ------------------------------------------------------------------- |
6 | 6 |
7 (function(global, utils) { | 7 (function(global, utils) { |
8 | 8 |
9 %CheckIsBootstrapping(); | 9 %CheckIsBootstrapping(); |
10 | 10 |
(...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
829 | 829 |
830 | 830 |
831 function GetStackFrames(raw_stack) { | 831 function GetStackFrames(raw_stack) { |
832 var frames = new InternalArray(); | 832 var frames = new InternalArray(); |
833 var sloppy_frames = raw_stack[0]; | 833 var sloppy_frames = raw_stack[0]; |
834 for (var i = 1; i < raw_stack.length; i += 4) { | 834 for (var i = 1; i < raw_stack.length; i += 4) { |
835 var recv = raw_stack[i]; | 835 var recv = raw_stack[i]; |
836 var fun = raw_stack[i + 1]; | 836 var fun = raw_stack[i + 1]; |
837 var code = raw_stack[i + 2]; | 837 var code = raw_stack[i + 2]; |
838 var pc = raw_stack[i + 3]; | 838 var pc = raw_stack[i + 3]; |
839 var pos = %FunctionGetPositionForOffset(code, pc); | 839 // For traps in wasm, the bytecode offset is passed as (-1 - offset). |
| 840 // Otherwise, lookup the position from the pc. |
| 841 var pos = IS_NUMBER(fun) && pc < 0 ? (-1 - pc) : |
| 842 %FunctionGetPositionForOffset(code, pc); |
840 sloppy_frames--; | 843 sloppy_frames--; |
841 frames.push(new CallSite(recv, fun, pos, (sloppy_frames < 0))); | 844 frames.push(new CallSite(recv, fun, pos, (sloppy_frames < 0))); |
842 } | 845 } |
843 return frames; | 846 return frames; |
844 } | 847 } |
845 | 848 |
846 | 849 |
847 // Flag to prevent recursive call of Error.prepareStackTrace. | 850 // Flag to prevent recursive call of Error.prepareStackTrace. |
848 var formatting_custom_stack_trace = false; | 851 var formatting_custom_stack_trace = false; |
849 | 852 |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1052 utils.Export(function(to) { | 1055 utils.Export(function(to) { |
1053 to.ErrorToString = ErrorToString; | 1056 to.ErrorToString = ErrorToString; |
1054 to.MakeError = MakeError; | 1057 to.MakeError = MakeError; |
1055 to.MakeRangeError = MakeRangeError; | 1058 to.MakeRangeError = MakeRangeError; |
1056 to.MakeSyntaxError = MakeSyntaxError; | 1059 to.MakeSyntaxError = MakeSyntaxError; |
1057 to.MakeTypeError = MakeTypeError; | 1060 to.MakeTypeError = MakeTypeError; |
1058 to.MakeURIError = MakeURIError; | 1061 to.MakeURIError = MakeURIError; |
1059 }); | 1062 }); |
1060 | 1063 |
1061 }); | 1064 }); |
OLD | NEW |