| 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 794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 805 f.prototype.name = name; | 805 f.prototype.name = name; |
| 806 %SetCode(f, function(m) { | 806 %SetCode(f, function(m) { |
| 807 if (%_IsConstructCall()) { | 807 if (%_IsConstructCall()) { |
| 808 if (m === kAddMessageAccessorsMarker) { | 808 if (m === kAddMessageAccessorsMarker) { |
| 809 DefineOneShotAccessor(this, 'message', function (obj) { | 809 DefineOneShotAccessor(this, 'message', function (obj) { |
| 810 return FormatMessage({type: obj.type, args: obj.arguments}); | 810 return FormatMessage({type: obj.type, args: obj.arguments}); |
| 811 }); | 811 }); |
| 812 } else if (!IS_UNDEFINED(m)) { | 812 } else if (!IS_UNDEFINED(m)) { |
| 813 this.message = ToString(m); | 813 this.message = ToString(m); |
| 814 } | 814 } |
| 815 if ($Error.captureStackTraces) { | 815 var stackTraceLimit = $Error.stackTraceLimit; |
| 816 var raw_stack = %CollectStackTrace(f); | 816 if (stackTraceLimit) { |
| 817 // Cap the limit to avoid extremely big traces |
| 818 if (stackTraceLimit < 0 || stackTraceLimit > 10000) |
| 819 stackTraceLimit = 10000; |
| 820 var raw_stack = %CollectStackTrace(f, stackTraceLimit); |
| 817 DefineOneShotAccessor(this, 'stack', function (obj) { | 821 DefineOneShotAccessor(this, 'stack', function (obj) { |
| 818 return FormatRawStackTrace(obj, raw_stack); | 822 return FormatRawStackTrace(obj, raw_stack); |
| 819 }); | 823 }); |
| 820 } | 824 } |
| 821 } else { | 825 } else { |
| 822 return new f(m); | 826 return new f(m); |
| 823 } | 827 } |
| 824 }); | 828 }); |
| 825 } | 829 } |
| 826 | 830 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 843 return this.name + ": " + FormatMessage({ type: type, args: this.arguments }
); | 847 return this.name + ": " + FormatMessage({ type: type, args: this.arguments }
); |
| 844 } | 848 } |
| 845 var message = this.message; | 849 var message = this.message; |
| 846 return this.name + (message ? (": " + message) : ""); | 850 return this.name + (message ? (": " + message) : ""); |
| 847 }, DONT_ENUM); | 851 }, DONT_ENUM); |
| 848 | 852 |
| 849 | 853 |
| 850 // Boilerplate for exceptions for stack overflows. Used from | 854 // Boilerplate for exceptions for stack overflows. Used from |
| 851 // Top::StackOverflow(). | 855 // Top::StackOverflow(). |
| 852 const kStackOverflowBoilerplate = MakeRangeError('stack_overflow', []); | 856 const kStackOverflowBoilerplate = MakeRangeError('stack_overflow', []); |
| OLD | NEW |