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 997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1008 | 1008 |
1009 | 1009 |
1010 // ES5 section 15.2.3.2. | 1010 // ES5 section 15.2.3.2. |
1011 function ObjectGetPrototypeOf(obj) { | 1011 function ObjectGetPrototypeOf(obj) { |
1012 if (!IS_SPEC_OBJECT(obj)) { | 1012 if (!IS_SPEC_OBJECT(obj)) { |
1013 throw MakeTypeError("called_on_non_object", ["Object.getPrototypeOf"]); | 1013 throw MakeTypeError("called_on_non_object", ["Object.getPrototypeOf"]); |
1014 } | 1014 } |
1015 return %GetPrototype(obj); | 1015 return %GetPrototype(obj); |
1016 } | 1016 } |
1017 | 1017 |
| 1018 // ES6 section 19.1.2.19. |
| 1019 function ObjectSetPrototypeOf(obj, proto) { |
| 1020 CHECK_OBJECT_COERCIBLE(obj, "Object.setPrototypeOf"); |
| 1021 |
| 1022 if (proto !== null && !IS_SPEC_OBJECT(proto)) { |
| 1023 throw MakeTypeError("proto_object_or_null", [proto]); |
| 1024 } |
| 1025 |
| 1026 if (IS_SPEC_OBJECT(obj)) { |
| 1027 %SetPrototype(obj, proto); |
| 1028 } |
| 1029 |
| 1030 return obj; |
| 1031 } |
| 1032 |
1018 | 1033 |
1019 // ES5 section 15.2.3.3 | 1034 // ES5 section 15.2.3.3 |
1020 function ObjectGetOwnPropertyDescriptor(obj, p) { | 1035 function ObjectGetOwnPropertyDescriptor(obj, p) { |
1021 if (!IS_SPEC_OBJECT(obj)) { | 1036 if (!IS_SPEC_OBJECT(obj)) { |
1022 throw MakeTypeError("called_on_non_object", | 1037 throw MakeTypeError("called_on_non_object", |
1023 ["Object.getOwnPropertyDescriptor"]); | 1038 ["Object.getOwnPropertyDescriptor"]); |
1024 } | 1039 } |
1025 var desc = GetOwnProperty(obj, p); | 1040 var desc = GetOwnProperty(obj, p); |
1026 return FromPropertyDescriptor(desc); | 1041 return FromPropertyDescriptor(desc); |
1027 } | 1042 } |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1436 ObjectGetProto, ObjectSetProto); | 1451 ObjectGetProto, ObjectSetProto); |
1437 | 1452 |
1438 // Set up non-enumerable functions in the Object object. | 1453 // Set up non-enumerable functions in the Object object. |
1439 InstallFunctions($Object, DONT_ENUM, $Array( | 1454 InstallFunctions($Object, DONT_ENUM, $Array( |
1440 "keys", ObjectKeys, | 1455 "keys", ObjectKeys, |
1441 "create", ObjectCreate, | 1456 "create", ObjectCreate, |
1442 "defineProperty", ObjectDefineProperty, | 1457 "defineProperty", ObjectDefineProperty, |
1443 "defineProperties", ObjectDefineProperties, | 1458 "defineProperties", ObjectDefineProperties, |
1444 "freeze", ObjectFreeze, | 1459 "freeze", ObjectFreeze, |
1445 "getPrototypeOf", ObjectGetPrototypeOf, | 1460 "getPrototypeOf", ObjectGetPrototypeOf, |
| 1461 "setPrototypeOf", ObjectSetPrototypeOf, |
1446 "getOwnPropertyDescriptor", ObjectGetOwnPropertyDescriptor, | 1462 "getOwnPropertyDescriptor", ObjectGetOwnPropertyDescriptor, |
1447 "getOwnPropertyNames", ObjectGetOwnPropertyNames, | 1463 "getOwnPropertyNames", ObjectGetOwnPropertyNames, |
1448 // getOwnPropertySymbols is added in symbol.js. | 1464 // getOwnPropertySymbols is added in symbol.js. |
1449 "is", ObjectIs, | 1465 "is", ObjectIs, |
1450 "isExtensible", ObjectIsExtensible, | 1466 "isExtensible", ObjectIsExtensible, |
1451 "isFrozen", ObjectIsFrozen, | 1467 "isFrozen", ObjectIsFrozen, |
1452 "isSealed", ObjectIsSealed, | 1468 "isSealed", ObjectIsSealed, |
1453 "preventExtensions", ObjectPreventExtension, | 1469 "preventExtensions", ObjectPreventExtension, |
1454 "seal", ObjectSeal | 1470 "seal", ObjectSeal |
1455 // deliverChangeRecords, getNotifier, observe and unobserve are added | 1471 // deliverChangeRecords, getNotifier, observe and unobserve are added |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1888 // Eventually, we should move to a real event queue that allows to maintain | 1904 // Eventually, we should move to a real event queue that allows to maintain |
1889 // relative ordering of different kinds of tasks. | 1905 // relative ordering of different kinds of tasks. |
1890 | 1906 |
1891 RunMicrotasks.runners = new InternalArray; | 1907 RunMicrotasks.runners = new InternalArray; |
1892 | 1908 |
1893 function RunMicrotasks() { | 1909 function RunMicrotasks() { |
1894 while (%SetMicrotaskPending(false)) { | 1910 while (%SetMicrotaskPending(false)) { |
1895 for (var i in RunMicrotasks.runners) RunMicrotasks.runners[i](); | 1911 for (var i in RunMicrotasks.runners) RunMicrotasks.runners[i](); |
1896 } | 1912 } |
1897 } | 1913 } |
OLD | NEW |