| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 897 line = "<error>"; | 897 line = "<error>"; |
| 898 } | 898 } |
| 899 } | 899 } |
| 900 lines.push(" at " + line); | 900 lines.push(" at " + line); |
| 901 } | 901 } |
| 902 return lines.join("\n"); | 902 return lines.join("\n"); |
| 903 } | 903 } |
| 904 | 904 |
| 905 function FormatRawStackTrace(error, raw_stack) { | 905 function FormatRawStackTrace(error, raw_stack) { |
| 906 var frames = [ ]; | 906 var frames = [ ]; |
| 907 for (var i = 0; i < raw_stack.length; i += 3) { | 907 for (var i = 0; i < raw_stack.length; i += 4) { |
| 908 var recv = raw_stack[i]; | 908 var recv = raw_stack[i]; |
| 909 var fun = raw_stack[i+1]; | 909 var fun = raw_stack[i + 1]; |
| 910 var pc = raw_stack[i+2]; | 910 var code = raw_stack[i + 2]; |
| 911 var pos = %FunctionGetPositionForOffset(fun, pc); | 911 var pc = raw_stack[i + 3]; |
| 912 var pos = %FunctionGetPositionForOffset(code, pc); |
| 912 frames.push(new CallSite(recv, fun, pos)); | 913 frames.push(new CallSite(recv, fun, pos)); |
| 913 } | 914 } |
| 914 if (IS_FUNCTION($Error.prepareStackTrace)) { | 915 if (IS_FUNCTION($Error.prepareStackTrace)) { |
| 915 return $Error.prepareStackTrace(error, frames); | 916 return $Error.prepareStackTrace(error, frames); |
| 916 } else { | 917 } else { |
| 917 return FormatStackTrace(error, frames); | 918 return FormatStackTrace(error, frames); |
| 918 } | 919 } |
| 919 } | 920 } |
| 920 | 921 |
| 921 function DefineError(f) { | 922 function DefineError(f) { |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 993 return this.name + ": " + FormatMessage({ type: type, args: this.arguments }
); | 994 return this.name + ": " + FormatMessage({ type: type, args: this.arguments }
); |
| 994 } | 995 } |
| 995 var message = this.message; | 996 var message = this.message; |
| 996 return this.name + (message ? (": " + message) : ""); | 997 return this.name + (message ? (": " + message) : ""); |
| 997 }, DONT_ENUM); | 998 }, DONT_ENUM); |
| 998 | 999 |
| 999 | 1000 |
| 1000 // Boilerplate for exceptions for stack overflows. Used from | 1001 // Boilerplate for exceptions for stack overflows. Used from |
| 1001 // Isolate::StackOverflow(). | 1002 // Isolate::StackOverflow(). |
| 1002 const kStackOverflowBoilerplate = MakeRangeError('stack_overflow', []); | 1003 const kStackOverflowBoilerplate = MakeRangeError('stack_overflow', []); |
| OLD | NEW |