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 808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
819 | 819 |
820 | 820 |
821 function GetStackFrames(raw_stack) { | 821 function GetStackFrames(raw_stack) { |
822 var frames = new InternalArray(); | 822 var frames = new InternalArray(); |
823 var sloppy_frames = raw_stack[0]; | 823 var sloppy_frames = raw_stack[0]; |
824 for (var i = 1; i < raw_stack.length; i += 4) { | 824 for (var i = 1; i < raw_stack.length; i += 4) { |
825 var recv = raw_stack[i]; | 825 var recv = raw_stack[i]; |
826 var fun = raw_stack[i + 1]; | 826 var fun = raw_stack[i + 1]; |
827 var code = raw_stack[i + 2]; | 827 var code = raw_stack[i + 2]; |
828 var pc = raw_stack[i + 3]; | 828 var pc = raw_stack[i + 3]; |
829 var pos = %FunctionGetPositionForOffset(code, pc); | 829 // For traps in wasm, the bytecode offset is passed as (-1 - offset). |
830 // Otherwise, lookup the position from the pc. | |
831 var pos = IS_NUMBER(fun) && pc < 0 ? (-1 - pc) : | |
Yang
2016/05/11 08:22:18
fun can only be a number for wasm, right? Why do w
Clemens Hammacher
2016/05/12 07:49:39
Because there are still two cases for wasm:
1) For
| |
832 %FunctionGetPositionForOffset(code, pc); | |
830 sloppy_frames--; | 833 sloppy_frames--; |
831 frames.push(new CallSite(recv, fun, pos, (sloppy_frames < 0))); | 834 frames.push(new CallSite(recv, fun, pos, (sloppy_frames < 0))); |
832 } | 835 } |
833 return frames; | 836 return frames; |
834 } | 837 } |
835 | 838 |
836 | 839 |
837 // Flag to prevent recursive call of Error.prepareStackTrace. | 840 // Flag to prevent recursive call of Error.prepareStackTrace. |
838 var formatting_custom_stack_trace = false; | 841 var formatting_custom_stack_trace = false; |
839 | 842 |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1042 utils.Export(function(to) { | 1045 utils.Export(function(to) { |
1043 to.ErrorToString = ErrorToString; | 1046 to.ErrorToString = ErrorToString; |
1044 to.MakeError = MakeError; | 1047 to.MakeError = MakeError; |
1045 to.MakeRangeError = MakeRangeError; | 1048 to.MakeRangeError = MakeRangeError; |
1046 to.MakeSyntaxError = MakeSyntaxError; | 1049 to.MakeSyntaxError = MakeSyntaxError; |
1047 to.MakeTypeError = MakeTypeError; | 1050 to.MakeTypeError = MakeTypeError; |
1048 to.MakeURIError = MakeURIError; | 1051 to.MakeURIError = MakeURIError; |
1049 }); | 1052 }); |
1050 | 1053 |
1051 }); | 1054 }); |
OLD | NEW |