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

Side by Side Diff: src/v8natives.js

Issue 1051523003: [es6] Object.getPrototypeOf should work with values (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 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 | « no previous file | test/mjsunit/get-prototype-of.js » ('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 // 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 961 matching lines...) Expand 10 before | Expand all | Expand 10 after
972 var attributes = FromGenericPropertyDescriptor(desc); 972 var attributes = FromGenericPropertyDescriptor(desc);
973 return DefineProxyProperty(obj, p, attributes, should_throw); 973 return DefineProxyProperty(obj, p, attributes, should_throw);
974 } else if (IS_ARRAY(obj)) { 974 } else if (IS_ARRAY(obj)) {
975 return DefineArrayProperty(obj, p, desc, should_throw); 975 return DefineArrayProperty(obj, p, desc, should_throw);
976 } else { 976 } else {
977 return DefineObjectProperty(obj, p, desc, should_throw); 977 return DefineObjectProperty(obj, p, desc, should_throw);
978 } 978 }
979 } 979 }
980 980
981 981
982 // ES5 section 15.2.3.2. 982 // ES6 section 19.1.2.9
983 function ObjectGetPrototypeOf(obj) { 983 function ObjectGetPrototypeOf(obj) {
984 if (!IS_SPEC_OBJECT(obj)) { 984 return %_GetPrototype(TO_OBJECT_INLINE(obj));
985 throw MakeTypeError("called_on_non_object", ["Object.getPrototypeOf"]);
986 }
987 return %_GetPrototype(obj);
988 } 985 }
989 986
990 // ES6 section 19.1.2.19. 987 // ES6 section 19.1.2.19.
991 function ObjectSetPrototypeOf(obj, proto) { 988 function ObjectSetPrototypeOf(obj, proto) {
992 CHECK_OBJECT_COERCIBLE(obj, "Object.setPrototypeOf"); 989 CHECK_OBJECT_COERCIBLE(obj, "Object.setPrototypeOf");
993 990
994 if (proto !== null && !IS_SPEC_OBJECT(proto)) { 991 if (proto !== null && !IS_SPEC_OBJECT(proto)) {
995 throw MakeTypeError("proto_object_or_null", [proto]); 992 throw MakeTypeError("proto_object_or_null", [proto]);
996 } 993 }
997 994
(...skipping 899 matching lines...) Expand 10 before | Expand all | Expand 10 after
1897 } 1894 }
1898 if (!IS_SPEC_FUNCTION(method)) { 1895 if (!IS_SPEC_FUNCTION(method)) {
1899 throw MakeTypeError('not_iterable', [obj]); 1896 throw MakeTypeError('not_iterable', [obj]);
1900 } 1897 }
1901 var iterator = %_CallFunction(obj, method); 1898 var iterator = %_CallFunction(obj, method);
1902 if (!IS_SPEC_OBJECT(iterator)) { 1899 if (!IS_SPEC_OBJECT(iterator)) {
1903 throw MakeTypeError('not_an_iterator', [iterator]); 1900 throw MakeTypeError('not_an_iterator', [iterator]);
1904 } 1901 }
1905 return iterator; 1902 return iterator;
1906 } 1903 }
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/get-prototype-of.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698