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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/mjsunit/es6/classes-subclass-builtins.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/js/v8natives.js
diff --git a/src/js/v8natives.js b/src/js/v8natives.js
index 8384c181f003a759f59ee9a410df62db61dfd8ab..d76b54eaf2bdbe4afcfca06aaaf9d3eb2a21a81f 100644
--- a/src/js/v8natives.js
+++ b/src/js/v8natives.js
@@ -1311,14 +1311,13 @@ function ObjectSetProto(proto) {
}
+// ECMA-262, Edition 6, section 19.1.1.1
function ObjectConstructor(x) {
- if (%_IsConstructCall()) {
- if (x == null) return this;
- return TO_OBJECT(x);
- } else {
- if (x == null) return { };
- return TO_OBJECT(x);
+ if (GlobalObject != new.target && !IS_UNDEFINED(new.target)) {
+ return this;
}
+ if (IS_NULL(x) || IS_UNDEFINED(x)) return {};
+ return TO_OBJECT(x);
}
« 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