| 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 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 632 // within the runtime system to avoid strange side | 632 // within the runtime system to avoid strange side |
| 633 // effects when overwriting the error functions from | 633 // effects when overwriting the error functions from |
| 634 // user code. | 634 // user code. |
| 635 var name = f.name; | 635 var name = f.name; |
| 636 %SetProperty(global, name, f, DONT_ENUM); | 636 %SetProperty(global, name, f, DONT_ENUM); |
| 637 this['$' + name] = f; | 637 this['$' + name] = f; |
| 638 // Configure the error function. | 638 // Configure the error function. |
| 639 // prototype of 'Error' must be as default: new Object(). | 639 // prototype of 'Error' must be as default: new Object(). |
| 640 if (name != 'Error') %FunctionSetPrototype(f, new $Error()); | 640 if (name != 'Error') %FunctionSetPrototype(f, new $Error()); |
| 641 %FunctionSetInstanceClassName(f, 'Error'); | 641 %FunctionSetInstanceClassName(f, 'Error'); |
| 642 %SetProperty(f.prototype, 'constructor', f, DONT_ENUM); |
| 642 f.prototype.name = name; | 643 f.prototype.name = name; |
| 643 f.prototype.constructor = f; | |
| 644 %SetCode(f, function(m) { | 644 %SetCode(f, function(m) { |
| 645 if (%IsConstructCall()) { | 645 if (%IsConstructCall()) { |
| 646 if (!IS_UNDEFINED(m)) this.message = ToString(m); | 646 if (!IS_UNDEFINED(m)) this.message = ToString(m); |
| 647 } else { | 647 } else { |
| 648 return new f(m); | 648 return new f(m); |
| 649 } | 649 } |
| 650 }); | 650 }); |
| 651 } | 651 } |
| 652 | 652 |
| 653 $Math.__proto__ = global.Object.prototype; | 653 $Math.__proto__ = global.Object.prototype; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 669 return this.name + ": " + FormatMessage({ type: type, args: this.arguments }
); | 669 return this.name + ": " + FormatMessage({ type: type, args: this.arguments }
); |
| 670 } | 670 } |
| 671 var message = this.message; | 671 var message = this.message; |
| 672 return this.name + (message ? (": " + message) : ""); | 672 return this.name + (message ? (": " + message) : ""); |
| 673 }, DONT_ENUM); | 673 }, DONT_ENUM); |
| 674 | 674 |
| 675 | 675 |
| 676 // Boilerplate for exceptions for stack overflows. Used from | 676 // Boilerplate for exceptions for stack overflows. Used from |
| 677 // Top::StackOverflow(). | 677 // Top::StackOverflow(). |
| 678 const kStackOverflowBoilerplate = MakeRangeError('stack_overflow', []); | 678 const kStackOverflowBoilerplate = MakeRangeError('stack_overflow', []); |
| OLD | NEW |