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

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

Issue 1558433002: [runtime] Migrate Object.create to C++. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address Camillos comment. 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/heap/heap.h ('k') | src/objects.h » ('j') | 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 775 matching lines...) Expand 10 before | Expand all | Expand 10 after
786 } 786 }
787 787
788 788
789 // ES5 section 15.2.3.4. 789 // ES5 section 15.2.3.4.
790 function ObjectGetOwnPropertyNames(obj) { 790 function ObjectGetOwnPropertyNames(obj) {
791 obj = TO_OBJECT(obj); 791 obj = TO_OBJECT(obj);
792 return %GetOwnPropertyKeys(obj, PROPERTY_FILTER_SKIP_SYMBOLS); 792 return %GetOwnPropertyKeys(obj, PROPERTY_FILTER_SKIP_SYMBOLS);
793 } 793 }
794 794
795 795
796 // ES5 section 15.2.3.5.
797 function ObjectCreate(proto, properties) {
798 if (!IS_RECEIVER(proto) && proto !== null) {
799 throw MakeTypeError(kProtoObjectOrNull, proto);
800 }
801 var obj = {};
802 %InternalSetPrototype(obj, proto);
803 if (!IS_UNDEFINED(properties)) ObjectDefineProperties(obj, properties);
804 return obj;
805 }
806
807
808 // ES5 section 15.2.3.6. 796 // ES5 section 15.2.3.6.
809 function ObjectDefineProperty(obj, p, attributes) { 797 function ObjectDefineProperty(obj, p, attributes) {
810 // The new pure-C++ implementation doesn't support O.o. 798 // The new pure-C++ implementation doesn't support O.o.
811 // TODO(jkummerow): Implement missing features and remove fallback path. 799 // TODO(jkummerow): Implement missing features and remove fallback path.
812 if (%IsObserved(obj)) { 800 if (%IsObserved(obj)) {
813 if (!IS_RECEIVER(obj)) { 801 if (!IS_RECEIVER(obj)) {
814 throw MakeTypeError(kCalledOnNonObject, "Object.defineProperty"); 802 throw MakeTypeError(kCalledOnNonObject, "Object.defineProperty");
815 } 803 }
816 var name = TO_NAME(p); 804 var name = TO_NAME(p);
817 var desc = ToPropertyDescriptor(attributes); 805 var desc = ToPropertyDescriptor(attributes);
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
940 "__defineSetter__", ObjectDefineSetter, 928 "__defineSetter__", ObjectDefineSetter,
941 "__lookupSetter__", ObjectLookupSetter 929 "__lookupSetter__", ObjectLookupSetter
942 ]); 930 ]);
943 utils.InstallGetterSetter(GlobalObject.prototype, "__proto__", ObjectGetProto, 931 utils.InstallGetterSetter(GlobalObject.prototype, "__proto__", ObjectGetProto,
944 ObjectSetProto); 932 ObjectSetProto);
945 933
946 // Set up non-enumerable functions in the Object object. 934 // Set up non-enumerable functions in the Object object.
947 utils.InstallFunctions(GlobalObject, DONT_ENUM, [ 935 utils.InstallFunctions(GlobalObject, DONT_ENUM, [
948 // assign is added in bootstrapper.cc. 936 // assign is added in bootstrapper.cc.
949 "keys", ObjectKeys, 937 "keys", ObjectKeys,
950 "create", ObjectCreate,
951 "defineProperty", ObjectDefineProperty, 938 "defineProperty", ObjectDefineProperty,
952 "defineProperties", ObjectDefineProperties, 939 "defineProperties", ObjectDefineProperties,
953 "freeze", ObjectFreezeJS, 940 "freeze", ObjectFreezeJS,
954 "getPrototypeOf", ObjectGetPrototypeOf, 941 "getPrototypeOf", ObjectGetPrototypeOf,
955 "setPrototypeOf", ObjectSetPrototypeOf, 942 "setPrototypeOf", ObjectSetPrototypeOf,
956 "getOwnPropertyDescriptor", ObjectGetOwnPropertyDescriptor, 943 "getOwnPropertyDescriptor", ObjectGetOwnPropertyDescriptor,
957 "getOwnPropertyNames", ObjectGetOwnPropertyNames, 944 "getOwnPropertyNames", ObjectGetOwnPropertyNames,
958 // getOwnPropertySymbols is added in symbol.js. 945 // getOwnPropertySymbols is added in symbol.js.
959 "is", SameValue, // ECMA-262, Edition 6, section 19.1.2.10 946 "is", SameValue, // ECMA-262, Edition 6, section 19.1.2.10
960 "isExtensible", ObjectIsExtensible, 947 "isExtensible", ObjectIsExtensible,
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
1275 to.ObjectIsFrozen = ObjectIsFrozen; 1262 to.ObjectIsFrozen = ObjectIsFrozen;
1276 to.ObjectIsSealed = ObjectIsSealed; 1263 to.ObjectIsSealed = ObjectIsSealed;
1277 to.ObjectKeys = ObjectKeys; 1264 to.ObjectKeys = ObjectKeys;
1278 }); 1265 });
1279 1266
1280 %InstallToContext([ 1267 %InstallToContext([
1281 "object_value_of", ObjectValueOf, 1268 "object_value_of", ObjectValueOf,
1282 ]); 1269 ]);
1283 1270
1284 }) 1271 })
OLDNEW
« no previous file with comments | « src/heap/heap.h ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698