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; |
} |