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

Unified Diff: src/js/v8natives.js

Issue 1448933002: Introduce a BuiltinsConstructStub that sets up new.target and does a [[call]] per ES6 9.3.2 (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: More accurate regexp 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
Index: src/js/v8natives.js
diff --git a/src/js/v8natives.js b/src/js/v8natives.js
index 06c315b8906c2df04135c4f9b849095bd69ee64e..21e15427d9a8feaac55b6515f3fb3ae3e3374341 100644
--- a/src/js/v8natives.js
+++ b/src/js/v8natives.js
@@ -1374,11 +1374,11 @@ function NumberConstructor(x) {
// TODO(bmeurer): Move this to toplevel.
"use strict";
var value = %_ArgumentsLength() == 0 ? 0 : TO_NUMBER(x);
- if (%_IsConstructCall()) {
- %_SetValueOf(this, value);
- } else {
- return value;
- }
+ if (IS_UNDEFINED(new.target)) return value;
+
+ var result = %NewObject(GlobalNumber, new.target);
+ %_SetValueOf(result, value);
+ return result;
}

Powered by Google App Engine
This is Rietveld 408576698