OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 var $functionSourceString; | 5 var $functionSourceString; |
6 var $globalEval; | 6 var $globalEval; |
7 var $objectDefineOwnProperty; | 7 var $objectDefineOwnProperty; |
8 var $objectGetOwnPropertyDescriptor; | 8 var $objectGetOwnPropertyDescriptor; |
9 var $toCompletePropertyDescriptor; | 9 var $toCompletePropertyDescriptor; |
10 | 10 |
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
796 %DefineAccessorPropertyUnchecked(obj, p, getter, setter, flag); | 796 %DefineAccessorPropertyUnchecked(obj, p, getter, setter, flag); |
797 } | 797 } |
798 return true; | 798 return true; |
799 } | 799 } |
800 | 800 |
801 | 801 |
802 // ES5 section 15.4.5.1. | 802 // ES5 section 15.4.5.1. |
803 function DefineArrayProperty(obj, p, desc, should_throw) { | 803 function DefineArrayProperty(obj, p, desc, should_throw) { |
804 // Step 3 - Special handling for array index. | 804 // Step 3 - Special handling for array index. |
805 if (!IS_SYMBOL(p)) { | 805 if (!IS_SYMBOL(p)) { |
806 var index = $toUint32(p); | 806 var index = TO_UINT32(p); |
807 var emit_splice = false; | 807 var emit_splice = false; |
808 if ($toString(index) == p && index != 4294967295) { | 808 if ($toString(index) == p && index != 4294967295) { |
809 var length = obj.length; | 809 var length = obj.length; |
810 if (index >= length && %IsObserved(obj)) { | 810 if (index >= length && %IsObserved(obj)) { |
811 emit_splice = true; | 811 emit_splice = true; |
812 $observeBeginPerformSplice(obj); | 812 $observeBeginPerformSplice(obj); |
813 } | 813 } |
814 | 814 |
815 var length_desc = GetOwnPropertyJS(obj, "length"); | 815 var length_desc = GetOwnPropertyJS(obj, "length"); |
816 if ((index >= length && !length_desc.isWritable()) || | 816 if ((index >= length && !length_desc.isWritable()) || |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
892 var desc = GetOwnPropertyJS(TO_OBJECT(obj), p); | 892 var desc = GetOwnPropertyJS(TO_OBJECT(obj), p); |
893 return FromPropertyDescriptor(desc); | 893 return FromPropertyDescriptor(desc); |
894 } | 894 } |
895 | 895 |
896 | 896 |
897 // For Harmony proxies | 897 // For Harmony proxies |
898 function ToNameArray(obj, trap, includeSymbols) { | 898 function ToNameArray(obj, trap, includeSymbols) { |
899 if (!IS_SPEC_OBJECT(obj)) { | 899 if (!IS_SPEC_OBJECT(obj)) { |
900 throw MakeTypeError(kProxyNonObjectPropNames, trap, obj); | 900 throw MakeTypeError(kProxyNonObjectPropNames, trap, obj); |
901 } | 901 } |
902 var n = $toUint32(obj.length); | 902 var n = TO_UINT32(obj.length); |
903 var array = new GlobalArray(n); | 903 var array = new GlobalArray(n); |
904 var realLength = 0; | 904 var realLength = 0; |
905 var names = { __proto__: null }; // TODO(rossberg): use sets once ready. | 905 var names = { __proto__: null }; // TODO(rossberg): use sets once ready. |
906 for (var index = 0; index < n; index++) { | 906 for (var index = 0; index < n; index++) { |
907 var s = $toName(obj[index]); | 907 var s = $toName(obj[index]); |
908 // TODO(rossberg): adjust once there is a story for symbols vs proxies. | 908 // TODO(rossberg): adjust once there is a story for symbols vs proxies. |
909 if (IS_SYMBOL(s) && !includeSymbols) continue; | 909 if (IS_SYMBOL(s) && !includeSymbols) continue; |
910 if (%HasOwnProperty(names, s)) { | 910 if (%HasOwnProperty(names, s)) { |
911 throw MakeTypeError(kProxyRepeatedPropName, trap, s); | 911 throw MakeTypeError(kProxyRepeatedPropName, trap, s); |
912 } | 912 } |
(...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1808 to.ObjectGetOwnPropertyKeys = ObjectGetOwnPropertyKeys; | 1808 to.ObjectGetOwnPropertyKeys = ObjectGetOwnPropertyKeys; |
1809 to.ObjectHasOwnProperty = ObjectHasOwnProperty; | 1809 to.ObjectHasOwnProperty = ObjectHasOwnProperty; |
1810 to.ObjectIsFrozen = ObjectIsFrozen; | 1810 to.ObjectIsFrozen = ObjectIsFrozen; |
1811 to.ObjectIsSealed = ObjectIsSealed; | 1811 to.ObjectIsSealed = ObjectIsSealed; |
1812 to.ObjectToString = ObjectToString; | 1812 to.ObjectToString = ObjectToString; |
1813 to.OwnPropertyKeys = OwnPropertyKeys; | 1813 to.OwnPropertyKeys = OwnPropertyKeys; |
1814 to.ToNameArray = ToNameArray; | 1814 to.ToNameArray = ToNameArray; |
1815 }); | 1815 }); |
1816 | 1816 |
1817 }) | 1817 }) |
OLD | NEW |