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 958 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
969 var attributes = FromGenericPropertyDescriptor(desc); | 969 var attributes = FromGenericPropertyDescriptor(desc); |
970 return DefineProxyProperty(obj, p, attributes, should_throw); | 970 return DefineProxyProperty(obj, p, attributes, should_throw); |
971 } else if (IS_ARRAY(obj)) { | 971 } else if (IS_ARRAY(obj)) { |
972 return DefineArrayProperty(obj, p, desc, should_throw); | 972 return DefineArrayProperty(obj, p, desc, should_throw); |
973 } else { | 973 } else { |
974 return DefineObjectProperty(obj, p, desc, should_throw); | 974 return DefineObjectProperty(obj, p, desc, should_throw); |
975 } | 975 } |
976 } | 976 } |
977 | 977 |
978 | 978 |
979 // ES6 section 19.1.2.9 | 979 // ES5 section 15.2.3.2. |
980 function ObjectGetPrototypeOf(obj) { | 980 function ObjectGetPrototypeOf(obj) { |
981 return %_GetPrototype(TO_OBJECT_INLINE(obj)); | 981 if (!IS_SPEC_OBJECT(obj)) { |
| 982 throw MakeTypeError("called_on_non_object", ["Object.getPrototypeOf"]); |
| 983 } |
| 984 return %_GetPrototype(obj); |
982 } | 985 } |
983 | 986 |
984 // ES6 section 19.1.2.19. | 987 // ES6 section 19.1.2.19. |
985 function ObjectSetPrototypeOf(obj, proto) { | 988 function ObjectSetPrototypeOf(obj, proto) { |
986 CHECK_OBJECT_COERCIBLE(obj, "Object.setPrototypeOf"); | 989 CHECK_OBJECT_COERCIBLE(obj, "Object.setPrototypeOf"); |
987 | 990 |
988 if (proto !== null && !IS_SPEC_OBJECT(proto)) { | 991 if (proto !== null && !IS_SPEC_OBJECT(proto)) { |
989 throw MakeTypeError("proto_object_or_null", [proto]); | 992 throw MakeTypeError("proto_object_or_null", [proto]); |
990 } | 993 } |
991 | 994 |
(...skipping 899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1891 } | 1894 } |
1892 if (!IS_SPEC_FUNCTION(method)) { | 1895 if (!IS_SPEC_FUNCTION(method)) { |
1893 throw MakeTypeError('not_iterable', [obj]); | 1896 throw MakeTypeError('not_iterable', [obj]); |
1894 } | 1897 } |
1895 var iterator = %_CallFunction(obj, method); | 1898 var iterator = %_CallFunction(obj, method); |
1896 if (!IS_SPEC_OBJECT(iterator)) { | 1899 if (!IS_SPEC_OBJECT(iterator)) { |
1897 throw MakeTypeError('not_an_iterator', [iterator]); | 1900 throw MakeTypeError('not_an_iterator', [iterator]); |
1898 } | 1901 } |
1899 return iterator; | 1902 return iterator; |
1900 } | 1903 } |
OLD | NEW |