Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(293)

Side by Side Diff: src/js/v8natives.js

Issue 1609173002: Revert of [runtime] Migrate Object.getOwnPropertyNames to C++. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@ObjectGetOwnPropertyDescriptor
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/builtins.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 // ES5 section 15.2.3.4.
776 function ObjectGetOwnPropertyNames(obj) {
777 obj = TO_OBJECT(obj);
778 return %GetOwnPropertyKeys(obj, PROPERTY_FILTER_SKIP_SYMBOLS);
779 }
780
781
775 // ES5 section 15.2.3.6. 782 // ES5 section 15.2.3.6.
776 function ObjectDefineProperty(obj, p, attributes) { 783 function ObjectDefineProperty(obj, p, attributes) {
777 // The new pure-C++ implementation doesn't support O.o. 784 // The new pure-C++ implementation doesn't support O.o.
778 // TODO(jkummerow): Implement missing features and remove fallback path. 785 // TODO(jkummerow): Implement missing features and remove fallback path.
779 if (%IsObserved(obj)) { 786 if (%IsObserved(obj)) {
780 if (!IS_RECEIVER(obj)) { 787 if (!IS_RECEIVER(obj)) {
781 throw MakeTypeError(kCalledOnNonObject, "Object.defineProperty"); 788 throw MakeTypeError(kCalledOnNonObject, "Object.defineProperty");
782 } 789 }
783 var name = TO_NAME(p); 790 var name = TO_NAME(p);
784 var desc = ToPropertyDescriptor(attributes); 791 var desc = ToPropertyDescriptor(attributes);
785 DefineOwnProperty(obj, name, desc, true); 792 DefineOwnProperty(obj, name, desc, true);
786 return obj; 793 return obj;
787 } 794 }
788 return %ObjectDefineProperty(obj, p, attributes); 795 return %ObjectDefineProperty(obj, p, attributes);
789 } 796 }
790 797
791 798
799 function GetOwnEnumerablePropertyNames(object) {
800 return %GetOwnPropertyKeys(object, PROPERTY_FILTER_ONLY_ENUMERABLE);
801 }
802
803
792 // ES5 section 15.2.3.7. 804 // ES5 section 15.2.3.7.
793 function ObjectDefineProperties(obj, properties) { 805 function ObjectDefineProperties(obj, properties) {
794 // The new pure-C++ implementation doesn't support O.o. 806 // The new pure-C++ implementation doesn't support O.o.
795 // TODO(jkummerow): Implement missing features and remove fallback path. 807 // TODO(jkummerow): Implement missing features and remove fallback path.
796 if (%IsObserved(obj)) { 808 if (%IsObserved(obj)) {
797 if (!IS_RECEIVER(obj)) { 809 if (!IS_RECEIVER(obj)) {
798 throw MakeTypeError(kCalledOnNonObject, "Object.defineProperties"); 810 throw MakeTypeError(kCalledOnNonObject, "Object.defineProperties");
799 } 811 }
800 var props = TO_OBJECT(properties); 812 var props = TO_OBJECT(properties);
801 var names = %GetOwnPropertyKeys(props, PROPERTY_FILTER_ONLY_ENUMERABLE); 813 var names = GetOwnEnumerablePropertyNames(props);
802 var descriptors = new InternalArray(); 814 var descriptors = new InternalArray();
803 for (var i = 0; i < names.length; i++) { 815 for (var i = 0; i < names.length; i++) {
804 descriptors.push(ToPropertyDescriptor(props[names[i]])); 816 descriptors.push(ToPropertyDescriptor(props[names[i]]));
805 } 817 }
806 for (var i = 0; i < names.length; i++) { 818 for (var i = 0; i < names.length; i++) {
807 DefineOwnProperty(obj, names[i], descriptors[i], true); 819 DefineOwnProperty(obj, names[i], descriptors[i], true);
808 } 820 }
809 return obj; 821 return obj;
810 } 822 }
811 return %ObjectDefineProperties(obj, properties); 823 return %ObjectDefineProperties(obj, properties);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
864 ObjectSetProto); 876 ObjectSetProto);
865 877
866 // Set up non-enumerable functions in the Object object. 878 // Set up non-enumerable functions in the Object object.
867 utils.InstallFunctions(GlobalObject, DONT_ENUM, [ 879 utils.InstallFunctions(GlobalObject, DONT_ENUM, [
868 // assign is added in bootstrapper.cc. 880 // assign is added in bootstrapper.cc.
869 // keys is added in bootstrapper.cc. 881 // keys is added in bootstrapper.cc.
870 "defineProperty", ObjectDefineProperty, 882 "defineProperty", ObjectDefineProperty,
871 "defineProperties", ObjectDefineProperties, 883 "defineProperties", ObjectDefineProperties,
872 "getPrototypeOf", ObjectGetPrototypeOf, 884 "getPrototypeOf", ObjectGetPrototypeOf,
873 "setPrototypeOf", ObjectSetPrototypeOf, 885 "setPrototypeOf", ObjectSetPrototypeOf,
886 "getOwnPropertyNames", ObjectGetOwnPropertyNames,
874 // getOwnPropertySymbols is added in symbol.js. 887 // getOwnPropertySymbols is added in symbol.js.
875 "is", SameValue, // ECMA-262, Edition 6, section 19.1.2.10 888 "is", SameValue, // ECMA-262, Edition 6, section 19.1.2.10
876 // deliverChangeRecords, getNotifier, observe and unobserve are added 889 // deliverChangeRecords, getNotifier, observe and unobserve are added
877 // in object-observe.js. 890 // in object-observe.js.
878 ]); 891 ]);
879 892
880 893
881 // ---------------------------------------------------------------------------- 894 // ----------------------------------------------------------------------------
882 // Boolean 895 // Boolean
883 896
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
1161 to.ObjectDefineProperties = ObjectDefineProperties; 1174 to.ObjectDefineProperties = ObjectDefineProperties;
1162 to.ObjectDefineProperty = ObjectDefineProperty; 1175 to.ObjectDefineProperty = ObjectDefineProperty;
1163 to.ObjectHasOwnProperty = ObjectHasOwnProperty; 1176 to.ObjectHasOwnProperty = ObjectHasOwnProperty;
1164 }); 1177 });
1165 1178
1166 %InstallToContext([ 1179 %InstallToContext([
1167 "object_value_of", ObjectValueOf, 1180 "object_value_of", ObjectValueOf,
1168 ]); 1181 ]);
1169 1182
1170 }) 1183 })
OLDNEW
« no previous file with comments | « src/builtins.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698