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

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

Issue 1422853004: [es6] Fix Object built-in subclassing. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@weak-subclass
Patch Set: Test updated Created 5 years, 1 month 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/es6/classes-subclass-builtins.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 (function(global, utils) { 5 (function(global, utils) {
6 6
7 %CheckIsBootstrapping(); 7 %CheckIsBootstrapping();
8 8
9 // ---------------------------------------------------------------------------- 9 // ----------------------------------------------------------------------------
10 // Imports 10 // Imports
(...skipping 1293 matching lines...) Expand 10 before | Expand all | Expand 10 after
1304 // ECMA-262, Edition 6, section B.2.2.1.2 1304 // ECMA-262, Edition 6, section B.2.2.1.2
1305 function ObjectSetProto(proto) { 1305 function ObjectSetProto(proto) {
1306 CHECK_OBJECT_COERCIBLE(this, "Object.prototype.__proto__"); 1306 CHECK_OBJECT_COERCIBLE(this, "Object.prototype.__proto__");
1307 1307
1308 if ((IS_SPEC_OBJECT(proto) || IS_NULL(proto)) && IS_SPEC_OBJECT(this)) { 1308 if ((IS_SPEC_OBJECT(proto) || IS_NULL(proto)) && IS_SPEC_OBJECT(this)) {
1309 %SetPrototype(this, proto); 1309 %SetPrototype(this, proto);
1310 } 1310 }
1311 } 1311 }
1312 1312
1313 1313
1314 // ECMA-262, Edition 6, section 19.1.1.1
1314 function ObjectConstructor(x) { 1315 function ObjectConstructor(x) {
1315 if (%_IsConstructCall()) { 1316 if (GlobalObject != new.target && !IS_UNDEFINED(new.target)) {
1316 if (x == null) return this; 1317 return this;
1317 return TO_OBJECT(x);
1318 } else {
1319 if (x == null) return { };
1320 return TO_OBJECT(x);
1321 } 1318 }
1319 if (IS_NULL(x) || IS_UNDEFINED(x)) return {};
1320 return TO_OBJECT(x);
1322 } 1321 }
1323 1322
1324 1323
1325 // ---------------------------------------------------------------------------- 1324 // ----------------------------------------------------------------------------
1326 // Object 1325 // Object
1327 1326
1328 %SetNativeFlag(GlobalObject); 1327 %SetNativeFlag(GlobalObject);
1329 %SetCode(GlobalObject, ObjectConstructor); 1328 %SetCode(GlobalObject, ObjectConstructor);
1330 1329
1331 %AddNamedProperty(GlobalObject.prototype, "constructor", GlobalObject, 1330 %AddNamedProperty(GlobalObject.prototype, "constructor", GlobalObject,
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
1849 1848
1850 %InstallToContext([ 1849 %InstallToContext([
1851 "global_eval_fun", GlobalEval, 1850 "global_eval_fun", GlobalEval,
1852 "object_value_of", ObjectValueOf, 1851 "object_value_of", ObjectValueOf,
1853 "object_to_string", ObjectToString, 1852 "object_to_string", ObjectToString,
1854 "object_get_own_property_descriptor", ObjectGetOwnPropertyDescriptor, 1853 "object_get_own_property_descriptor", ObjectGetOwnPropertyDescriptor,
1855 "to_complete_property_descriptor", ToCompletePropertyDescriptor, 1854 "to_complete_property_descriptor", ToCompletePropertyDescriptor,
1856 ]); 1855 ]);
1857 1856
1858 }) 1857 })
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/es6/classes-subclass-builtins.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698