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

Side by Side Diff: src/v8natives.js

Issue 1014813003: [es6] Object.getPrototypeOf should work with values (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Update webkit tests and test262 status Created 5 years, 9 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 958 matching lines...) Expand 10 before | Expand all | Expand 10 after
969 var attributes = FromGenericPropertyDescriptor(desc); 969 var attributes = FromGenericPropertyDescriptor(desc);
970 return DefineProxyProperty(obj, p, attributes, should_throw); 970 return DefineProxyProperty(obj, p, attributes, should_throw);
971 } else if (IS_ARRAY(obj)) { 971 } else if (IS_ARRAY(obj)) {
972 return DefineArrayProperty(obj, p, desc, should_throw); 972 return DefineArrayProperty(obj, p, desc, should_throw);
973 } else { 973 } else {
974 return DefineObjectProperty(obj, p, desc, should_throw); 974 return DefineObjectProperty(obj, p, desc, should_throw);
975 } 975 }
976 } 976 }
977 977
978 978
979 // ES5 section 15.2.3.2. 979 // ES6 section 19.1.2.9
980 function ObjectGetPrototypeOf(obj) { 980 function ObjectGetPrototypeOf(obj) {
981 if (!IS_SPEC_OBJECT(obj)) { 981 return %_GetPrototype(TO_OBJECT_INLINE(obj));
982 throw MakeTypeError("called_on_non_object", ["Object.getPrototypeOf"]);
983 }
984 return %_GetPrototype(obj);
985 } 982 }
986 983
987 // ES6 section 19.1.2.19. 984 // ES6 section 19.1.2.19.
988 function ObjectSetPrototypeOf(obj, proto) { 985 function ObjectSetPrototypeOf(obj, proto) {
989 CHECK_OBJECT_COERCIBLE(obj, "Object.setPrototypeOf"); 986 CHECK_OBJECT_COERCIBLE(obj, "Object.setPrototypeOf");
990 987
991 if (proto !== null && !IS_SPEC_OBJECT(proto)) { 988 if (proto !== null && !IS_SPEC_OBJECT(proto)) {
992 throw MakeTypeError("proto_object_or_null", [proto]); 989 throw MakeTypeError("proto_object_or_null", [proto]);
993 } 990 }
994 991
(...skipping 899 matching lines...) Expand 10 before | Expand all | Expand 10 after
1894 } 1891 }
1895 if (!IS_SPEC_FUNCTION(method)) { 1892 if (!IS_SPEC_FUNCTION(method)) {
1896 throw MakeTypeError('not_iterable', [obj]); 1893 throw MakeTypeError('not_iterable', [obj]);
1897 } 1894 }
1898 var iterator = %_CallFunction(obj, method); 1895 var iterator = %_CallFunction(obj, method);
1899 if (!IS_SPEC_OBJECT(iterator)) { 1896 if (!IS_SPEC_OBJECT(iterator)) {
1900 throw MakeTypeError('not_an_iterator', [iterator]); 1897 throw MakeTypeError('not_an_iterator', [iterator]);
1901 } 1898 }
1902 return iterator; 1899 return iterator;
1903 } 1900 }
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