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 // This file relies on the fact that the following declarations have been made | 5 // This file relies on the fact that the following declarations have been made |
6 // in runtime.js: | 6 // in runtime.js: |
7 // var $Object = global.Object; | 7 // var $Object = global.Object; |
8 // var $Boolean = global.Boolean; | 8 // var $Boolean = global.Boolean; |
9 // var $Number = global.Number; | 9 // var $Number = global.Number; |
10 // var $Function = global.Function; | 10 // var $Function = global.Function; |
(...skipping 982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
993 } | 993 } |
994 | 994 |
995 if (IS_SPEC_OBJECT(obj)) { | 995 if (IS_SPEC_OBJECT(obj)) { |
996 %SetPrototype(obj, proto); | 996 %SetPrototype(obj, proto); |
997 } | 997 } |
998 | 998 |
999 return obj; | 999 return obj; |
1000 } | 1000 } |
1001 | 1001 |
1002 | 1002 |
1003 // ES5 section 15.2.3.3 | 1003 // ES6 section 19.1.2.6 |
1004 function ObjectGetOwnPropertyDescriptor(obj, p) { | 1004 function ObjectGetOwnPropertyDescriptor(obj, p) { |
1005 if (!IS_SPEC_OBJECT(obj)) { | 1005 var desc = GetOwnPropertyJS(TO_OBJECT_INLINE(obj), p); |
1006 throw MakeTypeError("called_on_non_object", | |
1007 ["Object.getOwnPropertyDescriptor"]); | |
1008 } | |
1009 var desc = GetOwnPropertyJS(obj, p); | |
1010 return FromPropertyDescriptor(desc); | 1006 return FromPropertyDescriptor(desc); |
1011 } | 1007 } |
1012 | 1008 |
1013 | 1009 |
1014 // For Harmony proxies | 1010 // For Harmony proxies |
1015 function ToNameArray(obj, trap, includeSymbols) { | 1011 function ToNameArray(obj, trap, includeSymbols) { |
1016 if (!IS_SPEC_OBJECT(obj)) { | 1012 if (!IS_SPEC_OBJECT(obj)) { |
1017 throw MakeTypeError("proxy_non_object_prop_names", [obj, trap]); | 1013 throw MakeTypeError("proxy_non_object_prop_names", [obj, trap]); |
1018 } | 1014 } |
1019 var n = ToUint32(obj.length); | 1015 var n = ToUint32(obj.length); |
(...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1895 } | 1891 } |
1896 if (!IS_SPEC_FUNCTION(method)) { | 1892 if (!IS_SPEC_FUNCTION(method)) { |
1897 throw MakeTypeError('not_iterable', [obj]); | 1893 throw MakeTypeError('not_iterable', [obj]); |
1898 } | 1894 } |
1899 var iterator = %_CallFunction(obj, method); | 1895 var iterator = %_CallFunction(obj, method); |
1900 if (!IS_SPEC_OBJECT(iterator)) { | 1896 if (!IS_SPEC_OBJECT(iterator)) { |
1901 throw MakeTypeError('not_an_iterator', [iterator]); | 1897 throw MakeTypeError('not_an_iterator', [iterator]); |
1902 } | 1898 } |
1903 return iterator; | 1899 return iterator; |
1904 } | 1900 } |
OLD | NEW |