| 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 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 627 var name = f.name; | 627 var name = f.name; |
| 628 %SetProperty(global, name, f, DONT_ENUM); | 628 %SetProperty(global, name, f, DONT_ENUM); |
| 629 this['$' + name] = f; | 629 this['$' + name] = f; |
| 630 // Configure the error function. | 630 // Configure the error function. |
| 631 if (name == 'Error') { | 631 if (name == 'Error') { |
| 632 // The prototype of the Error object must itself be an error. | 632 // The prototype of the Error object must itself be an error. |
| 633 // However, it can't be an instance of the Error object because | 633 // However, it can't be an instance of the Error object because |
| 634 // it hasn't been properly configured yet. Instead we create a | 634 // it hasn't been properly configured yet. Instead we create a |
| 635 // special not-a-true-error-but-close-enough object. | 635 // special not-a-true-error-but-close-enough object. |
| 636 function ErrorPrototype() {} | 636 function ErrorPrototype() {} |
| 637 %FunctionSetPrototype(ErrorPrototype, $Object.prototype); |
| 637 %FunctionSetInstanceClassName(ErrorPrototype, 'Error'); | 638 %FunctionSetInstanceClassName(ErrorPrototype, 'Error'); |
| 638 %FunctionSetPrototype(f, new ErrorPrototype()); | 639 %FunctionSetPrototype(f, new ErrorPrototype()); |
| 639 } else { | 640 } else { |
| 640 %FunctionSetPrototype(f, new $Error()); | 641 %FunctionSetPrototype(f, new $Error()); |
| 641 } | 642 } |
| 642 %FunctionSetInstanceClassName(f, 'Error'); | 643 %FunctionSetInstanceClassName(f, 'Error'); |
| 643 %SetProperty(f.prototype, 'constructor', f, DONT_ENUM); | 644 %SetProperty(f.prototype, 'constructor', f, DONT_ENUM); |
| 644 f.prototype.name = name; | 645 f.prototype.name = name; |
| 645 %SetCode(f, function(m) { | 646 %SetCode(f, function(m) { |
| 646 if (%IsConstructCall()) { | 647 if (%IsConstructCall()) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 676 return this.name + ": " + FormatMessage({ type: type, args: this.arguments }
); | 677 return this.name + ": " + FormatMessage({ type: type, args: this.arguments }
); |
| 677 } | 678 } |
| 678 var message = this.message; | 679 var message = this.message; |
| 679 return this.name + (message ? (": " + message) : ""); | 680 return this.name + (message ? (": " + message) : ""); |
| 680 }, DONT_ENUM); | 681 }, DONT_ENUM); |
| 681 | 682 |
| 682 | 683 |
| 683 // Boilerplate for exceptions for stack overflows. Used from | 684 // Boilerplate for exceptions for stack overflows. Used from |
| 684 // Top::StackOverflow(). | 685 // Top::StackOverflow(). |
| 685 const kStackOverflowBoilerplate = MakeRangeError('stack_overflow', []); | 686 const kStackOverflowBoilerplate = MakeRangeError('stack_overflow', []); |
| OLD | NEW |