OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
813 // See if we can find a unique property on the receiver that holds | 813 // See if we can find a unique property on the receiver that holds |
814 // this function. | 814 // this function. |
815 var ownName = this.fun.name; | 815 var ownName = this.fun.name; |
816 if (ownName && this.receiver && | 816 if (ownName && this.receiver && |
817 (%_CallFunction(this.receiver, | 817 (%_CallFunction(this.receiver, |
818 ownName, | 818 ownName, |
819 ObjectLookupGetter) === this.fun || | 819 ObjectLookupGetter) === this.fun || |
820 %_CallFunction(this.receiver, | 820 %_CallFunction(this.receiver, |
821 ownName, | 821 ownName, |
822 ObjectLookupSetter) === this.fun || | 822 ObjectLookupSetter) === this.fun || |
823 %GetDataProperty(this.receiver, ownName) === this.fun)) { | 823 (IS_OBJECT(this.receiver) && |
| 824 %GetDataProperty(this.receiver, ownName) === this.fun))) { |
824 // To handle DontEnum properties we guess that the method has | 825 // To handle DontEnum properties we guess that the method has |
825 // the same name as the function. | 826 // the same name as the function. |
826 return ownName; | 827 return ownName; |
827 } | 828 } |
828 var name = null; | 829 var name = null; |
829 for (var prop in this.receiver) { | 830 for (var prop in this.receiver) { |
830 if (%_CallFunction(this.receiver, prop, ObjectLookupGetter) === this.fun || | 831 if (%_CallFunction(this.receiver, prop, ObjectLookupGetter) === this.fun || |
831 %_CallFunction(this.receiver, prop, ObjectLookupSetter) === this.fun || | 832 %_CallFunction(this.receiver, prop, ObjectLookupSetter) === this.fun || |
832 %GetDataProperty(this.receiver, prop) === this.fun) { | 833 (IS_OBJECT(this.receiver) && |
| 834 %GetDataProperty(this.receiver, prop) === this.fun)) { |
833 // If we find more than one match bail out to avoid confusion. | 835 // If we find more than one match bail out to avoid confusion. |
834 if (name) { | 836 if (name) { |
835 return null; | 837 return null; |
836 } | 838 } |
837 name = prop; | 839 name = prop; |
838 } | 840 } |
839 } | 841 } |
840 if (name) { | 842 if (name) { |
841 return name; | 843 return name; |
842 } | 844 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
876 var script = %FunctionGetScript(this.fun); | 878 var script = %FunctionGetScript(this.fun); |
877 return script ? (script.type == TYPE_NATIVE) : false; | 879 return script ? (script.type == TYPE_NATIVE) : false; |
878 } | 880 } |
879 | 881 |
880 function CallSiteGetPosition() { | 882 function CallSiteGetPosition() { |
881 return this.pos; | 883 return this.pos; |
882 } | 884 } |
883 | 885 |
884 function CallSiteIsConstructor() { | 886 function CallSiteIsConstructor() { |
885 var receiver = this.receiver; | 887 var receiver = this.receiver; |
886 var constructor = receiver ? %GetDataProperty(receiver, "constructor") : null; | 888 var constructor = |
887 if (!constructor) { | 889 IS_OBJECT(receiver) ? %GetDataProperty(receiver, "constructor") : null; |
888 return false; | 890 if (!constructor) return false; |
889 } | |
890 return this.fun === constructor; | 891 return this.fun === constructor; |
891 } | 892 } |
892 | 893 |
893 function CallSiteToString() { | 894 function CallSiteToString() { |
894 var fileName; | 895 var fileName; |
895 var fileLocation = ""; | 896 var fileLocation = ""; |
896 if (this.isNative()) { | 897 if (this.isNative()) { |
897 fileLocation = "native"; | 898 fileLocation = "native"; |
898 } else { | 899 } else { |
899 if (this.isEval()) { | 900 if (this.isEval()) { |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1301 %SetOverflowedStackTrace(this, void 0); | 1302 %SetOverflowedStackTrace(this, void 0); |
1302 } | 1303 } |
1303 | 1304 |
1304 %DefineOrRedefineAccessorProperty( | 1305 %DefineOrRedefineAccessorProperty( |
1305 boilerplate, 'stack', getter, setter, DONT_ENUM); | 1306 boilerplate, 'stack', getter, setter, DONT_ENUM); |
1306 | 1307 |
1307 return boilerplate; | 1308 return boilerplate; |
1308 } | 1309 } |
1309 | 1310 |
1310 var kStackOverflowBoilerplate = SetUpStackOverflowBoilerplate(); | 1311 var kStackOverflowBoilerplate = SetUpStackOverflowBoilerplate(); |
OLD | NEW |