| 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 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 %FunctionSetPrototype(ErrorPrototype, $Object.prototype); | 652 %FunctionSetPrototype(ErrorPrototype, $Object.prototype); |
| 653 %FunctionSetInstanceClassName(ErrorPrototype, 'Error'); | 653 %FunctionSetInstanceClassName(ErrorPrototype, 'Error'); |
| 654 %FunctionSetPrototype(f, new ErrorPrototype()); | 654 %FunctionSetPrototype(f, new ErrorPrototype()); |
| 655 } else { | 655 } else { |
| 656 %FunctionSetPrototype(f, new $Error()); | 656 %FunctionSetPrototype(f, new $Error()); |
| 657 } | 657 } |
| 658 %FunctionSetInstanceClassName(f, 'Error'); | 658 %FunctionSetInstanceClassName(f, 'Error'); |
| 659 %SetProperty(f.prototype, 'constructor', f, DONT_ENUM); | 659 %SetProperty(f.prototype, 'constructor', f, DONT_ENUM); |
| 660 f.prototype.name = name; | 660 f.prototype.name = name; |
| 661 %SetCode(f, function(m) { | 661 %SetCode(f, function(m) { |
| 662 if (%IsConstructCall()) { | 662 if (%_IsConstructCall()) { |
| 663 if (m === kAddMessageAccessorsMarker) { | 663 if (m === kAddMessageAccessorsMarker) { |
| 664 DefineOneShotAccessor(this, 'message', function (obj) { | 664 DefineOneShotAccessor(this, 'message', function (obj) { |
| 665 return FormatMessage({type: obj.type, args: obj.arguments}); | 665 return FormatMessage({type: obj.type, args: obj.arguments}); |
| 666 }); | 666 }); |
| 667 } else if (!IS_UNDEFINED(m)) { | 667 } else if (!IS_UNDEFINED(m)) { |
| 668 this.message = ToString(m); | 668 this.message = ToString(m); |
| 669 } | 669 } |
| 670 } else { | 670 } else { |
| 671 return new f(m); | 671 return new f(m); |
| 672 } | 672 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 692 return this.name + ": " + FormatMessage({ type: type, args: this.arguments }
); | 692 return this.name + ": " + FormatMessage({ type: type, args: this.arguments }
); |
| 693 } | 693 } |
| 694 var message = this.message; | 694 var message = this.message; |
| 695 return this.name + (message ? (": " + message) : ""); | 695 return this.name + (message ? (": " + message) : ""); |
| 696 }, DONT_ENUM); | 696 }, DONT_ENUM); |
| 697 | 697 |
| 698 | 698 |
| 699 // Boilerplate for exceptions for stack overflows. Used from | 699 // Boilerplate for exceptions for stack overflows. Used from |
| 700 // Top::StackOverflow(). | 700 // Top::StackOverflow(). |
| 701 const kStackOverflowBoilerplate = MakeRangeError('stack_overflow', []); | 701 const kStackOverflowBoilerplate = MakeRangeError('stack_overflow', []); |
| OLD | NEW |