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

Unified Diff: src/bootstrapper.cc

Issue 1579613002: [builtins] Refactor the remaining Date builtins. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 11 months 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 | src/builtins.h » ('j') | src/builtins.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/bootstrapper.cc
diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc
index 3ec9bb3711ec0d79066140a0f01900edf8de1361..086a48f280fdeb560d84d81ed80466450eadbbe9 100644
--- a/src/bootstrapper.cc
+++ b/src/bootstrapper.cc
@@ -2549,47 +2549,101 @@ bool Genesis::InstallNatives(ContextType context_type) {
JSObject::AddProperty(prototype, factory()->constructor_string(), date_fun,
DONT_ENUM);
- // Install the toISOString and valueOf functions.
+ // Install the Date.prototype methods.
+ SimpleInstallFunction(prototype, "toString",
+ Builtins::kDatePrototypeToString, 0, false);
+ SimpleInstallFunction(prototype, "toDateString",
+ Builtins::kDatePrototypeToDateString, 0, false);
+ SimpleInstallFunction(prototype, "toTimeString",
+ Builtins::kDatePrototypeToTimeString, 0, false);
+ SimpleInstallFunction(prototype, "toGMTString",
+ Builtins::kDatePrototypeToUTCString, 0, false);
SimpleInstallFunction(prototype, "toISOString",
Builtins::kDatePrototypeToISOString, 0, false);
+ SimpleInstallFunction(prototype, "toUTCString",
+ Builtins::kDatePrototypeToUTCString, 0, false);
SimpleInstallFunction(prototype, "getDate", Builtins::kDatePrototypeGetDate,
0, true);
+ SimpleInstallFunction(prototype, "setDate", Builtins::kDatePrototypeSetDate,
+ 1, false);
SimpleInstallFunction(prototype, "getDay", Builtins::kDatePrototypeGetDay,
0, true);
SimpleInstallFunction(prototype, "getFullYear",
Builtins::kDatePrototypeGetFullYear, 0, true);
+ SimpleInstallFunction(prototype, "setFullYear",
+ Builtins::kDatePrototypeSetFullYear, 3, false);
SimpleInstallFunction(prototype, "getHours",
Builtins::kDatePrototypeGetHours, 0, true);
+ SimpleInstallFunction(prototype, "setHours",
+ Builtins::kDatePrototypeSetHours, 4, false);
SimpleInstallFunction(prototype, "getMilliseconds",
Builtins::kDatePrototypeGetMilliseconds, 0, true);
+ SimpleInstallFunction(prototype, "setMilliseconds",
+ Builtins::kDatePrototypeSetMilliseconds, 1, false);
SimpleInstallFunction(prototype, "getMinutes",
Builtins::kDatePrototypeGetMinutes, 0, true);
+ SimpleInstallFunction(prototype, "setMinutes",
+ Builtins::kDatePrototypeSetMinutes, 3, false);
SimpleInstallFunction(prototype, "getMonth",
Builtins::kDatePrototypeGetMonth, 0, true);
+ SimpleInstallFunction(prototype, "setMonth",
+ Builtins::kDatePrototypeSetMonth, 2, false);
SimpleInstallFunction(prototype, "getSeconds",
Builtins::kDatePrototypeGetSeconds, 0, true);
+ SimpleInstallFunction(prototype, "setSeconds",
+ Builtins::kDatePrototypeSetSeconds, 2, false);
SimpleInstallFunction(prototype, "getTime", Builtins::kDatePrototypeGetTime,
0, true);
+ SimpleInstallFunction(prototype, "setTime", Builtins::kDatePrototypeSetTime,
+ 1, false);
SimpleInstallFunction(prototype, "getTimezoneOffset",
Builtins::kDatePrototypeGetTimezoneOffset, 0, true);
SimpleInstallFunction(prototype, "getUTCDate",
Builtins::kDatePrototypeGetUTCDate, 0, true);
+ SimpleInstallFunction(prototype, "setUTCDate",
+ Builtins::kDatePrototypeSetUTCDate, 1, false);
SimpleInstallFunction(prototype, "getUTCDay",
Builtins::kDatePrototypeGetUTCDay, 0, true);
SimpleInstallFunction(prototype, "getUTCFullYear",
Builtins::kDatePrototypeGetUTCFullYear, 0, true);
+ SimpleInstallFunction(prototype, "setUTCFullYear",
+ Builtins::kDatePrototypeSetUTCFullYear, 3, false);
SimpleInstallFunction(prototype, "getUTCHours",
Builtins::kDatePrototypeGetUTCHours, 0, true);
+ SimpleInstallFunction(prototype, "setUTCHours",
+ Builtins::kDatePrototypeSetUTCHours, 4, false);
SimpleInstallFunction(prototype, "getUTCMilliseconds",
Builtins::kDatePrototypeGetUTCMilliseconds, 0, true);
+ SimpleInstallFunction(prototype, "setUTCMilliseconds",
+ Builtins::kDatePrototypeSetUTCMilliseconds, 1, false);
SimpleInstallFunction(prototype, "getUTCMinutes",
Builtins::kDatePrototypeGetUTCMinutes, 0, true);
+ SimpleInstallFunction(prototype, "setUTCMinutes",
+ Builtins::kDatePrototypeSetUTCMinutes, 3, false);
SimpleInstallFunction(prototype, "getUTCMonth",
Builtins::kDatePrototypeGetUTCMonth, 0, true);
+ SimpleInstallFunction(prototype, "setUTCMonth",
+ Builtins::kDatePrototypeSetUTCMonth, 2, false);
SimpleInstallFunction(prototype, "getUTCSeconds",
Builtins::kDatePrototypeGetUTCSeconds, 0, true);
+ SimpleInstallFunction(prototype, "setUTCSeconds",
+ Builtins::kDatePrototypeSetUTCSeconds, 2, false);
SimpleInstallFunction(prototype, "valueOf", Builtins::kDatePrototypeValueOf,
0, false);
+ SimpleInstallFunction(prototype, "getYear", Builtins::kDatePrototypeGetYear,
+ 0, true);
+ SimpleInstallFunction(prototype, "setYear", Builtins::kDatePrototypeSetYear,
+ 1, false);
+
+#ifndef V8_I18N_SUPPORT
+ // Install i18n fallback functions.
+ SimpleInstallFunction(prototype, "toLocaleString",
+ Builtins::kDatePrototypeToString, 0, false);
+ SimpleInstallFunction(prototype, "toLocaleDateString",
+ Builtins::kDatePrototypeToDateString, 0, false);
+ SimpleInstallFunction(prototype, "toLocaleTimeString",
+ Builtins::kDatePrototypeToTimeString, 0, false);
+#endif // V8_I18N_SUPPORT
// Install the @@toPrimitive function.
Handle<JSFunction> to_primitive = InstallFunction(
« no previous file with comments | « no previous file | src/builtins.h » ('j') | src/builtins.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698