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 (function(global, utils) { | 5 (function(global, utils) { |
6 | 6 |
7 %CheckIsBootstrapping(); | 7 %CheckIsBootstrapping(); |
8 | 8 |
9 // ---------------------------------------------------------------------------- | 9 // ---------------------------------------------------------------------------- |
10 // Imports | 10 // Imports |
(...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
765 } | 765 } |
766 | 766 |
767 if (IS_RECEIVER(obj)) { | 767 if (IS_RECEIVER(obj)) { |
768 %SetPrototype(obj, proto); | 768 %SetPrototype(obj, proto); |
769 } | 769 } |
770 | 770 |
771 return obj; | 771 return obj; |
772 } | 772 } |
773 | 773 |
774 | 774 |
775 // ES6 section 19.1.2.6 | |
776 function ObjectGetOwnPropertyDescriptor(obj, p) { | |
777 return %GetOwnProperty(obj, p); | |
778 } | |
779 | |
780 | |
781 // ES5 section 15.2.3.6. | 775 // ES5 section 15.2.3.6. |
782 function ObjectDefineProperty(obj, p, attributes) { | 776 function ObjectDefineProperty(obj, p, attributes) { |
783 // The new pure-C++ implementation doesn't support O.o. | 777 // The new pure-C++ implementation doesn't support O.o. |
784 // TODO(jkummerow): Implement missing features and remove fallback path. | 778 // TODO(jkummerow): Implement missing features and remove fallback path. |
785 if (%IsObserved(obj)) { | 779 if (%IsObserved(obj)) { |
786 if (!IS_RECEIVER(obj)) { | 780 if (!IS_RECEIVER(obj)) { |
787 throw MakeTypeError(kCalledOnNonObject, "Object.defineProperty"); | 781 throw MakeTypeError(kCalledOnNonObject, "Object.defineProperty"); |
788 } | 782 } |
789 var name = TO_NAME(p); | 783 var name = TO_NAME(p); |
790 var desc = ToPropertyDescriptor(attributes); | 784 var desc = ToPropertyDescriptor(attributes); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
870 ObjectSetProto); | 864 ObjectSetProto); |
871 | 865 |
872 // Set up non-enumerable functions in the Object object. | 866 // Set up non-enumerable functions in the Object object. |
873 utils.InstallFunctions(GlobalObject, DONT_ENUM, [ | 867 utils.InstallFunctions(GlobalObject, DONT_ENUM, [ |
874 // assign is added in bootstrapper.cc. | 868 // assign is added in bootstrapper.cc. |
875 // keys is added in bootstrapper.cc. | 869 // keys is added in bootstrapper.cc. |
876 "defineProperty", ObjectDefineProperty, | 870 "defineProperty", ObjectDefineProperty, |
877 "defineProperties", ObjectDefineProperties, | 871 "defineProperties", ObjectDefineProperties, |
878 "getPrototypeOf", ObjectGetPrototypeOf, | 872 "getPrototypeOf", ObjectGetPrototypeOf, |
879 "setPrototypeOf", ObjectSetPrototypeOf, | 873 "setPrototypeOf", ObjectSetPrototypeOf, |
880 "getOwnPropertyDescriptor", ObjectGetOwnPropertyDescriptor, | |
881 // getOwnPropertySymbols is added in symbol.js. | 874 // getOwnPropertySymbols is added in symbol.js. |
882 "is", SameValue, // ECMA-262, Edition 6, section 19.1.2.10 | 875 "is", SameValue, // ECMA-262, Edition 6, section 19.1.2.10 |
883 // deliverChangeRecords, getNotifier, observe and unobserve are added | 876 // deliverChangeRecords, getNotifier, observe and unobserve are added |
884 // in object-observe.js. | 877 // in object-observe.js. |
885 ]); | 878 ]); |
886 | 879 |
887 | 880 |
888 // ---------------------------------------------------------------------------- | 881 // ---------------------------------------------------------------------------- |
889 // Boolean | 882 // Boolean |
890 | 883 |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1168 to.ObjectDefineProperties = ObjectDefineProperties; | 1161 to.ObjectDefineProperties = ObjectDefineProperties; |
1169 to.ObjectDefineProperty = ObjectDefineProperty; | 1162 to.ObjectDefineProperty = ObjectDefineProperty; |
1170 to.ObjectHasOwnProperty = ObjectHasOwnProperty; | 1163 to.ObjectHasOwnProperty = ObjectHasOwnProperty; |
1171 }); | 1164 }); |
1172 | 1165 |
1173 %InstallToContext([ | 1166 %InstallToContext([ |
1174 "object_value_of", ObjectValueOf, | 1167 "object_value_of", ObjectValueOf, |
1175 ]); | 1168 ]); |
1176 | 1169 |
1177 }) | 1170 }) |
OLD | NEW |