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

Side by Side Diff: src/v8natives.js

Issue 756423006: Optimize GetPrototype (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add test and add back Push/Pop Created 6 years 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/runtime/runtime.h ('k') | test/cctest/test-api.cc » ('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 955 matching lines...) Expand 10 before | Expand all | Expand 10 after
966 return DefineObjectProperty(obj, p, desc, should_throw); 966 return DefineObjectProperty(obj, p, desc, should_throw);
967 } 967 }
968 } 968 }
969 969
970 970
971 // ES5 section 15.2.3.2. 971 // ES5 section 15.2.3.2.
972 function ObjectGetPrototypeOf(obj) { 972 function ObjectGetPrototypeOf(obj) {
973 if (!IS_SPEC_OBJECT(obj)) { 973 if (!IS_SPEC_OBJECT(obj)) {
974 throw MakeTypeError("called_on_non_object", ["Object.getPrototypeOf"]); 974 throw MakeTypeError("called_on_non_object", ["Object.getPrototypeOf"]);
975 } 975 }
976 return %GetPrototype(obj); 976 return %_GetPrototype(obj);
977 } 977 }
978 978
979 // ES6 section 19.1.2.19. 979 // ES6 section 19.1.2.19.
980 function ObjectSetPrototypeOf(obj, proto) { 980 function ObjectSetPrototypeOf(obj, proto) {
981 CHECK_OBJECT_COERCIBLE(obj, "Object.setPrototypeOf"); 981 CHECK_OBJECT_COERCIBLE(obj, "Object.setPrototypeOf");
982 982
983 if (proto !== null && !IS_SPEC_OBJECT(proto)) { 983 if (proto !== null && !IS_SPEC_OBJECT(proto)) {
984 throw MakeTypeError("proto_object_or_null", [proto]); 984 throw MakeTypeError("proto_object_or_null", [proto]);
985 } 985 }
986 986
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
1354 1354
1355 1355
1356 // ECMA-262, Edition 6, section 19.1.2.10 1356 // ECMA-262, Edition 6, section 19.1.2.10
1357 function ObjectIs(obj1, obj2) { 1357 function ObjectIs(obj1, obj2) {
1358 return SameValue(obj1, obj2); 1358 return SameValue(obj1, obj2);
1359 } 1359 }
1360 1360
1361 1361
1362 // ECMA-262, Edition 6, section B.2.2.1.1 1362 // ECMA-262, Edition 6, section B.2.2.1.1
1363 function ObjectGetProto() { 1363 function ObjectGetProto() {
1364 return %GetPrototype(ToObject(this)); 1364 return %_GetPrototype(ToObject(this));
1365 } 1365 }
1366 1366
1367 1367
1368 // ECMA-262, Edition 6, section B.2.2.1.2 1368 // ECMA-262, Edition 6, section B.2.2.1.2
1369 function ObjectSetProto(proto) { 1369 function ObjectSetProto(proto) {
1370 CHECK_OBJECT_COERCIBLE(this, "Object.prototype.__proto__"); 1370 CHECK_OBJECT_COERCIBLE(this, "Object.prototype.__proto__");
1371 1371
1372 if ((IS_SPEC_OBJECT(proto) || IS_NULL(proto)) && IS_SPEC_OBJECT(this)) { 1372 if ((IS_SPEC_OBJECT(proto) || IS_NULL(proto)) && IS_SPEC_OBJECT(this)) {
1373 %SetPrototype(this, proto); 1373 %SetPrototype(this, proto);
1374 } 1374 }
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
1890 } 1890 }
1891 if (!IS_SPEC_FUNCTION(method)) { 1891 if (!IS_SPEC_FUNCTION(method)) {
1892 throw MakeTypeError('not_iterable', [obj]); 1892 throw MakeTypeError('not_iterable', [obj]);
1893 } 1893 }
1894 var iterator = %_CallFunction(obj, method); 1894 var iterator = %_CallFunction(obj, method);
1895 if (!IS_SPEC_OBJECT(iterator)) { 1895 if (!IS_SPEC_OBJECT(iterator)) {
1896 throw MakeTypeError('not_an_iterator', [iterator]); 1896 throw MakeTypeError('not_an_iterator', [iterator]);
1897 } 1897 }
1898 return iterator; 1898 return iterator;
1899 } 1899 }
OLDNEW
« no previous file with comments | « src/runtime/runtime.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698