| 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 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 700 var script = %FunctionGetScript(this.fun); | 700 var script = %FunctionGetScript(this.fun); |
| 701 if (script && script.compilation_type == COMPILATION_TYPE_EVAL) | 701 if (script && script.compilation_type == COMPILATION_TYPE_EVAL) |
| 702 return "eval"; | 702 return "eval"; |
| 703 return null; | 703 return null; |
| 704 }; | 704 }; |
| 705 | 705 |
| 706 CallSite.prototype.getMethodName = function () { | 706 CallSite.prototype.getMethodName = function () { |
| 707 // See if we can find a unique property on the receiver that holds | 707 // See if we can find a unique property on the receiver that holds |
| 708 // this function. | 708 // this function. |
| 709 var ownName = this.fun.name; | 709 var ownName = this.fun.name; |
| 710 if (ownName && this.receiver && this.receiver[ownName] === this.fun) | 710 if (ownName && this.receiver && |
| 711 (ObjectLookupGetter.call(this.receiver, ownName) === this.fun || |
| 712 ObjectLookupSetter.call(this.receiver, ownName) === this.fun || |
| 713 this.receiver[ownName] === this.fun)) { |
| 711 // To handle DontEnum properties we guess that the method has | 714 // To handle DontEnum properties we guess that the method has |
| 712 // the same name as the function. | 715 // the same name as the function. |
| 713 return ownName; | 716 return ownName; |
| 717 } |
| 714 var name = null; | 718 var name = null; |
| 715 for (var prop in this.receiver) { | 719 for (var prop in this.receiver) { |
| 716 if (this.receiver[prop] === this.fun) { | 720 if (this.receiver.__lookupGetter__(prop) === this.fun || |
| 717 // If we find more than one match bail out to avoid confusion | 721 this.receiver.__lookupSetter__(prop) === this.fun || |
| 722 (!this.receiver.__lookupGetter__(prop) && this.receiver[prop] === this.f
un)) { |
| 723 // If we find more than one match bail out to avoid confusion. |
| 718 if (name) | 724 if (name) |
| 719 return null; | 725 return null; |
| 720 name = prop; | 726 name = prop; |
| 721 } | 727 } |
| 722 } | 728 } |
| 723 if (name) | 729 if (name) |
| 724 return name; | 730 return name; |
| 725 return null; | 731 return null; |
| 726 }; | 732 }; |
| 727 | 733 |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 973 return this.name + ": " + FormatMessage({ type: type, args: this.arguments }
); | 979 return this.name + ": " + FormatMessage({ type: type, args: this.arguments }
); |
| 974 } | 980 } |
| 975 var message = this.message; | 981 var message = this.message; |
| 976 return this.name + (message ? (": " + message) : ""); | 982 return this.name + (message ? (": " + message) : ""); |
| 977 }, DONT_ENUM); | 983 }, DONT_ENUM); |
| 978 | 984 |
| 979 | 985 |
| 980 // Boilerplate for exceptions for stack overflows. Used from | 986 // Boilerplate for exceptions for stack overflows. Used from |
| 981 // Top::StackOverflow(). | 987 // Top::StackOverflow(). |
| 982 const kStackOverflowBoilerplate = MakeRangeError('stack_overflow', []); | 988 const kStackOverflowBoilerplate = MakeRangeError('stack_overflow', []); |
| OLD | NEW |