Commit f65e61ef authored by littledan's avatar littledan Committed by Commit bot

Make Date.prototype an ordinary object

This is a change for ES2015. Date objects have mutable state, so having
a mutable prototype is bad for SES requirements, and it is an
inconsistency from the typical ES2015 class style of objects

BUG=v8:4004
LOG=Y
R=adamk

Review URL: https://codereview.chromium.org/1317403002

Cr-Commit-Position: refs/heads/master@{#30486}
parent 2b4ebd90
......@@ -16,6 +16,7 @@ var $createDate;
// Imports
var GlobalDate = global.Date;
var GlobalObject = global.Object;
var InternalArray = utils.InternalArray;
var IsFinite;
var MathAbs;
......@@ -822,7 +823,7 @@ function CreateDate(time) {
// -------------------------------------------------------------------
%SetCode(GlobalDate, DateConstructor);
%FunctionSetPrototype(GlobalDate, new GlobalDate(NAN));
%FunctionSetPrototype(GlobalDate, new GlobalObject());
// Set up non-enumerable properties of the Date object itself.
utils.InstallFunctions(GlobalDate, DONT_ENUM, [
......
......@@ -341,6 +341,11 @@ date.getYear();
assertThrows(function() { Date.prototype.getYear.call(""); }, TypeError);
assertUnoptimized(Date.prototype.getYear);
(function TestDatePrototypeOrdinaryObject() {
assertEquals(Object.prototype, Date.prototype.__proto__);
assertThrows(function () { Date.prototype.toString() }, TypeError);
})();
delete Date.prototype.getUTCFullYear;
delete Date.prototype.getUTCMonth;
delete Date.prototype.getUTCDate;
......
......@@ -85,6 +85,8 @@
'ecma/String/15.5.4.8-1': [FAIL],
'ecma/String/15.5.4.9-1': [FAIL],
# Date.prototype is an Object, not a Date
'ecma/Date/15.9.5': [FAIL],
##################### SKIPPED TESTS #####################
......
......@@ -295,9 +295,6 @@
'built-ins/Symbol/species/builtin-getter-name': [FAIL],
'built-ins/Symbol/species/subclassing': [FAIL],
# https://code.google.com/p/v8/issues/detail?id=4004
'built-ins/Date/prototype/setFullYear/15.9.5.40_1': [FAIL],
# https://code.google.com/p/v8/issues/detail?id=4002
'built-ins/Error/prototype/S15.11.4_A2': [FAIL],
......
......@@ -284,6 +284,9 @@
# ES6 says for dates to default to the local timezone if none is specified
'15.9.1.15-1': [FAIL],
# ES6 makes Date.prototype an Object, not a Date
'15.9.5.40_1': [FAIL],
######################## NEEDS INVESTIGATION ###########################
# These test failures are specific to the intl402 suite and need investigation
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment