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}
// Imports
var GlobalDate = global.Date;
+var GlobalObject = global.Object;
var InternalArray = utils.InternalArray;
var IsFinite;
var MathAbs;
// -------------------------------------------------------------------
%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, [
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;
'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 #####################
'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],
# 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