OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 1060 matching lines...) Loading... |
1071 } | 1071 } |
1072 } | 1072 } |
1073 | 1073 |
1074 | 1074 |
1075 function captureStackTrace(obj, cons_opt) { | 1075 function captureStackTrace(obj, cons_opt) { |
1076 var stackTraceLimit = $Error.stackTraceLimit; | 1076 var stackTraceLimit = $Error.stackTraceLimit; |
1077 if (!stackTraceLimit || !IS_NUMBER(stackTraceLimit)) return; | 1077 if (!stackTraceLimit || !IS_NUMBER(stackTraceLimit)) return; |
1078 if (stackTraceLimit < 0 || stackTraceLimit > 10000) { | 1078 if (stackTraceLimit < 0 || stackTraceLimit > 10000) { |
1079 stackTraceLimit = 10000; | 1079 stackTraceLimit = 10000; |
1080 } | 1080 } |
1081 var raw_stack = %CollectStackTrace(cons_opt | 1081 var raw_stack = %CollectStackTrace(obj, |
1082 ? cons_opt | 1082 cons_opt ? cons_opt : captureStackTrace, |
1083 : captureStackTrace, stackTraceLimit); | 1083 stackTraceLimit); |
1084 DefineOneShotAccessor(obj, 'stack', function (obj) { | 1084 DefineOneShotAccessor(obj, 'stack', function (obj) { |
1085 return FormatRawStackTrace(obj, raw_stack); | 1085 return FormatRawStackTrace(obj, raw_stack); |
1086 }); | 1086 }); |
1087 } | 1087 } |
1088 | 1088 |
1089 | 1089 |
1090 function SetUpError() { | 1090 function SetUpError() { |
1091 // Define special error type constructors. | 1091 // Define special error type constructors. |
1092 | 1092 |
1093 function DefineError(f) { | 1093 function DefineError(f) { |
(...skipping 113 matching lines...) Loading... |
1207 throw e; | 1207 throw e; |
1208 } | 1208 } |
1209 } | 1209 } |
1210 | 1210 |
1211 | 1211 |
1212 InstallFunctions($Error.prototype, DONT_ENUM, ['toString', ErrorToString]); | 1212 InstallFunctions($Error.prototype, DONT_ENUM, ['toString', ErrorToString]); |
1213 | 1213 |
1214 // Boilerplate for exceptions for stack overflows. Used from | 1214 // Boilerplate for exceptions for stack overflows. Used from |
1215 // Isolate::StackOverflow(). | 1215 // Isolate::StackOverflow(). |
1216 const kStackOverflowBoilerplate = MakeRangeError('stack_overflow', []); | 1216 const kStackOverflowBoilerplate = MakeRangeError('stack_overflow', []); |
OLD | NEW |