summaryrefslogtreecommitdiffstats
path: root/JavaScriptCore/runtime/DatePrototype.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'JavaScriptCore/runtime/DatePrototype.cpp')
-rw-r--r--JavaScriptCore/runtime/DatePrototype.cpp386
1 files changed, 175 insertions, 211 deletions
diff --git a/JavaScriptCore/runtime/DatePrototype.cpp b/JavaScriptCore/runtime/DatePrototype.cpp
index a3e792e..b325070 100644
--- a/JavaScriptCore/runtime/DatePrototype.cpp
+++ b/JavaScriptCore/runtime/DatePrototype.cpp
@@ -58,50 +58,49 @@ namespace JSC {
ASSERT_CLASS_FITS_IN_CELL(DatePrototype);
-static JSValue* dateProtoFuncGetDate(ExecState*, JSObject*, JSValue*, const ArgList&);
-static JSValue* dateProtoFuncGetDay(ExecState*, JSObject*, JSValue*, const ArgList&);
-static JSValue* dateProtoFuncGetFullYear(ExecState*, JSObject*, JSValue*, const ArgList&);
-static JSValue* dateProtoFuncGetHours(ExecState*, JSObject*, JSValue*, const ArgList&);
-static JSValue* dateProtoFuncGetMilliSeconds(ExecState*, JSObject*, JSValue*, const ArgList&);
-static JSValue* dateProtoFuncGetMinutes(ExecState*, JSObject*, JSValue*, const ArgList&);
-static JSValue* dateProtoFuncGetMonth(ExecState*, JSObject*, JSValue*, const ArgList&);
-static JSValue* dateProtoFuncGetSeconds(ExecState*, JSObject*, JSValue*, const ArgList&);
-static JSValue* dateProtoFuncGetTime(ExecState*, JSObject*, JSValue*, const ArgList&);
-static JSValue* dateProtoFuncGetTimezoneOffset(ExecState*, JSObject*, JSValue*, const ArgList&);
-static JSValue* dateProtoFuncGetUTCDate(ExecState*, JSObject*, JSValue*, const ArgList&);
-static JSValue* dateProtoFuncGetUTCDay(ExecState*, JSObject*, JSValue*, const ArgList&);
-static JSValue* dateProtoFuncGetUTCFullYear(ExecState*, JSObject*, JSValue*, const ArgList&);
-static JSValue* dateProtoFuncGetUTCHours(ExecState*, JSObject*, JSValue*, const ArgList&);
-static JSValue* dateProtoFuncGetUTCMilliseconds(ExecState*, JSObject*, JSValue*, const ArgList&);
-static JSValue* dateProtoFuncGetUTCMinutes(ExecState*, JSObject*, JSValue*, const ArgList&);
-static JSValue* dateProtoFuncGetUTCMonth(ExecState*, JSObject*, JSValue*, const ArgList&);
-static JSValue* dateProtoFuncGetUTCSeconds(ExecState*, JSObject*, JSValue*, const ArgList&);
-static JSValue* dateProtoFuncGetYear(ExecState*, JSObject*, JSValue*, const ArgList&);
-static JSValue* dateProtoFuncSetDate(ExecState*, JSObject*, JSValue*, const ArgList&);
-static JSValue* dateProtoFuncSetFullYear(ExecState*, JSObject*, JSValue*, const ArgList&);
-static JSValue* dateProtoFuncSetHours(ExecState*, JSObject*, JSValue*, const ArgList&);
-static JSValue* dateProtoFuncSetMilliSeconds(ExecState*, JSObject*, JSValue*, const ArgList&);
-static JSValue* dateProtoFuncSetMinutes(ExecState*, JSObject*, JSValue*, const ArgList&);
-static JSValue* dateProtoFuncSetMonth(ExecState*, JSObject*, JSValue*, const ArgList&);
-static JSValue* dateProtoFuncSetSeconds(ExecState*, JSObject*, JSValue*, const ArgList&);
-static JSValue* dateProtoFuncSetTime(ExecState*, JSObject*, JSValue*, const ArgList&);
-static JSValue* dateProtoFuncSetUTCDate(ExecState*, JSObject*, JSValue*, const ArgList&);
-static JSValue* dateProtoFuncSetUTCFullYear(ExecState*, JSObject*, JSValue*, const ArgList&);
-static JSValue* dateProtoFuncSetUTCHours(ExecState*, JSObject*, JSValue*, const ArgList&);
-static JSValue* dateProtoFuncSetUTCMilliseconds(ExecState*, JSObject*, JSValue*, const ArgList&);
-static JSValue* dateProtoFuncSetUTCMinutes(ExecState*, JSObject*, JSValue*, const ArgList&);
-static JSValue* dateProtoFuncSetUTCMonth(ExecState*, JSObject*, JSValue*, const ArgList&);
-static JSValue* dateProtoFuncSetUTCSeconds(ExecState*, JSObject*, JSValue*, const ArgList&);
-static JSValue* dateProtoFuncSetYear(ExecState*, JSObject*, JSValue*, const ArgList&);
-static JSValue* dateProtoFuncToDateString(ExecState*, JSObject*, JSValue*, const ArgList&);
-static JSValue* dateProtoFuncToGMTString(ExecState*, JSObject*, JSValue*, const ArgList&);
-static JSValue* dateProtoFuncToLocaleDateString(ExecState*, JSObject*, JSValue*, const ArgList&);
-static JSValue* dateProtoFuncToLocaleString(ExecState*, JSObject*, JSValue*, const ArgList&);
-static JSValue* dateProtoFuncToLocaleTimeString(ExecState*, JSObject*, JSValue*, const ArgList&);
-static JSValue* dateProtoFuncToString(ExecState*, JSObject*, JSValue*, const ArgList&);
-static JSValue* dateProtoFuncToTimeString(ExecState*, JSObject*, JSValue*, const ArgList&);
-static JSValue* dateProtoFuncToUTCString(ExecState*, JSObject*, JSValue*, const ArgList&);
-static JSValue* dateProtoFuncValueOf(ExecState*, JSObject*, JSValue*, const ArgList&);
+static JSValuePtr dateProtoFuncGetDate(ExecState*, JSObject*, JSValuePtr, const ArgList&);
+static JSValuePtr dateProtoFuncGetDay(ExecState*, JSObject*, JSValuePtr, const ArgList&);
+static JSValuePtr dateProtoFuncGetFullYear(ExecState*, JSObject*, JSValuePtr, const ArgList&);
+static JSValuePtr dateProtoFuncGetHours(ExecState*, JSObject*, JSValuePtr, const ArgList&);
+static JSValuePtr dateProtoFuncGetMilliSeconds(ExecState*, JSObject*, JSValuePtr, const ArgList&);
+static JSValuePtr dateProtoFuncGetMinutes(ExecState*, JSObject*, JSValuePtr, const ArgList&);
+static JSValuePtr dateProtoFuncGetMonth(ExecState*, JSObject*, JSValuePtr, const ArgList&);
+static JSValuePtr dateProtoFuncGetSeconds(ExecState*, JSObject*, JSValuePtr, const ArgList&);
+static JSValuePtr dateProtoFuncGetTime(ExecState*, JSObject*, JSValuePtr, const ArgList&);
+static JSValuePtr dateProtoFuncGetTimezoneOffset(ExecState*, JSObject*, JSValuePtr, const ArgList&);
+static JSValuePtr dateProtoFuncGetUTCDate(ExecState*, JSObject*, JSValuePtr, const ArgList&);
+static JSValuePtr dateProtoFuncGetUTCDay(ExecState*, JSObject*, JSValuePtr, const ArgList&);
+static JSValuePtr dateProtoFuncGetUTCFullYear(ExecState*, JSObject*, JSValuePtr, const ArgList&);
+static JSValuePtr dateProtoFuncGetUTCHours(ExecState*, JSObject*, JSValuePtr, const ArgList&);
+static JSValuePtr dateProtoFuncGetUTCMilliseconds(ExecState*, JSObject*, JSValuePtr, const ArgList&);
+static JSValuePtr dateProtoFuncGetUTCMinutes(ExecState*, JSObject*, JSValuePtr, const ArgList&);
+static JSValuePtr dateProtoFuncGetUTCMonth(ExecState*, JSObject*, JSValuePtr, const ArgList&);
+static JSValuePtr dateProtoFuncGetUTCSeconds(ExecState*, JSObject*, JSValuePtr, const ArgList&);
+static JSValuePtr dateProtoFuncGetYear(ExecState*, JSObject*, JSValuePtr, const ArgList&);
+static JSValuePtr dateProtoFuncSetDate(ExecState*, JSObject*, JSValuePtr, const ArgList&);
+static JSValuePtr dateProtoFuncSetFullYear(ExecState*, JSObject*, JSValuePtr, const ArgList&);
+static JSValuePtr dateProtoFuncSetHours(ExecState*, JSObject*, JSValuePtr, const ArgList&);
+static JSValuePtr dateProtoFuncSetMilliSeconds(ExecState*, JSObject*, JSValuePtr, const ArgList&);
+static JSValuePtr dateProtoFuncSetMinutes(ExecState*, JSObject*, JSValuePtr, const ArgList&);
+static JSValuePtr dateProtoFuncSetMonth(ExecState*, JSObject*, JSValuePtr, const ArgList&);
+static JSValuePtr dateProtoFuncSetSeconds(ExecState*, JSObject*, JSValuePtr, const ArgList&);
+static JSValuePtr dateProtoFuncSetTime(ExecState*, JSObject*, JSValuePtr, const ArgList&);
+static JSValuePtr dateProtoFuncSetUTCDate(ExecState*, JSObject*, JSValuePtr, const ArgList&);
+static JSValuePtr dateProtoFuncSetUTCFullYear(ExecState*, JSObject*, JSValuePtr, const ArgList&);
+static JSValuePtr dateProtoFuncSetUTCHours(ExecState*, JSObject*, JSValuePtr, const ArgList&);
+static JSValuePtr dateProtoFuncSetUTCMilliseconds(ExecState*, JSObject*, JSValuePtr, const ArgList&);
+static JSValuePtr dateProtoFuncSetUTCMinutes(ExecState*, JSObject*, JSValuePtr, const ArgList&);
+static JSValuePtr dateProtoFuncSetUTCMonth(ExecState*, JSObject*, JSValuePtr, const ArgList&);
+static JSValuePtr dateProtoFuncSetUTCSeconds(ExecState*, JSObject*, JSValuePtr, const ArgList&);
+static JSValuePtr dateProtoFuncSetYear(ExecState*, JSObject*, JSValuePtr, const ArgList&);
+static JSValuePtr dateProtoFuncToDateString(ExecState*, JSObject*, JSValuePtr, const ArgList&);
+static JSValuePtr dateProtoFuncToGMTString(ExecState*, JSObject*, JSValuePtr, const ArgList&);
+static JSValuePtr dateProtoFuncToLocaleDateString(ExecState*, JSObject*, JSValuePtr, const ArgList&);
+static JSValuePtr dateProtoFuncToLocaleString(ExecState*, JSObject*, JSValuePtr, const ArgList&);
+static JSValuePtr dateProtoFuncToLocaleTimeString(ExecState*, JSObject*, JSValuePtr, const ArgList&);
+static JSValuePtr dateProtoFuncToString(ExecState*, JSObject*, JSValuePtr, const ArgList&);
+static JSValuePtr dateProtoFuncToTimeString(ExecState*, JSObject*, JSValuePtr, const ArgList&);
+static JSValuePtr dateProtoFuncToUTCString(ExecState*, JSObject*, JSValuePtr, const ArgList&);
}
@@ -109,8 +108,13 @@ static JSValue* dateProtoFuncValueOf(ExecState*, JSObject*, JSValue*, const ArgL
namespace JSC {
+enum LocaleDateTimeFormat { LocaleDateAndTime, LocaleDate, LocaleTime };
+
#if PLATFORM(MAC)
+// FIXME: Since this is superior to the strftime-based version, why limit this to PLATFORM(MAC)?
+// Instead we should consider using this whenever PLATFORM(CF) is true.
+
static CFDateFormatterStyle styleFromArgString(const UString& string, CFDateFormatterStyle defaultStyle)
{
if (string == "short")
@@ -124,24 +128,24 @@ static CFDateFormatterStyle styleFromArgString(const UString& string, CFDateForm
return defaultStyle;
}
-static UString formatLocaleDate(ExecState* exec, double time, bool includeDate, bool includeTime, const ArgList& args)
+static JSCell* formatLocaleDate(ExecState* exec, DateInstance*, double timeInMilliseconds, LocaleDateTimeFormat format, const ArgList& args)
{
- CFDateFormatterStyle dateStyle = (includeDate ? kCFDateFormatterLongStyle : kCFDateFormatterNoStyle);
- CFDateFormatterStyle timeStyle = (includeTime ? kCFDateFormatterLongStyle : kCFDateFormatterNoStyle);
+ CFDateFormatterStyle dateStyle = (format != LocaleTime ? kCFDateFormatterLongStyle : kCFDateFormatterNoStyle);
+ CFDateFormatterStyle timeStyle = (format != LocaleDate ? kCFDateFormatterLongStyle : kCFDateFormatterNoStyle);
bool useCustomFormat = false;
UString customFormatString;
- UString arg0String = args.at(exec, 0)->toString(exec);
- if (arg0String == "custom" && !args.at(exec, 1)->isUndefined()) {
+ UString arg0String = args.at(exec, 0).toString(exec);
+ if (arg0String == "custom" && !args.at(exec, 1).isUndefined()) {
useCustomFormat = true;
- customFormatString = args.at(exec, 1)->toString(exec);
- } else if (includeDate && includeTime && !args.at(exec, 1)->isUndefined()) {
+ customFormatString = args.at(exec, 1).toString(exec);
+ } else if (format == LocaleDateAndTime && !args.at(exec, 1).isUndefined()) {
dateStyle = styleFromArgString(arg0String, dateStyle);
- timeStyle = styleFromArgString(args.at(exec, 1)->toString(exec), timeStyle);
- } else if (includeDate && !args.at(exec, 0)->isUndefined())
+ timeStyle = styleFromArgString(args.at(exec, 1).toString(exec), timeStyle);
+ } else if (format != LocaleTime && !args.at(exec, 0).isUndefined())
dateStyle = styleFromArgString(arg0String, dateStyle);
- else if (includeTime && !args.at(exec, 0)->isUndefined())
+ else if (format != LocaleDate && !args.at(exec, 0).isUndefined())
timeStyle = styleFromArgString(arg0String, timeStyle);
CFLocaleRef locale = CFLocaleCopyCurrent();
@@ -149,12 +153,12 @@ static UString formatLocaleDate(ExecState* exec, double time, bool includeDate,
CFRelease(locale);
if (useCustomFormat) {
- CFStringRef customFormatCFString = CFStringCreateWithCharacters(0, (UniChar *)customFormatString.data(), customFormatString.size());
+ CFStringRef customFormatCFString = CFStringCreateWithCharacters(0, customFormatString.data(), customFormatString.size());
CFDateFormatterSetFormat(formatter, customFormatCFString);
CFRelease(customFormatCFString);
}
- CFStringRef string = CFDateFormatterCreateStringWithAbsoluteTime(0, formatter, time - kCFAbsoluteTimeIntervalSince1970);
+ CFStringRef string = CFDateFormatterCreateStringWithAbsoluteTime(0, formatter, floor(timeInMilliseconds / msPerSecond) - kCFAbsoluteTimeIntervalSince1970);
CFRelease(formatter);
@@ -166,20 +170,18 @@ static UString formatLocaleDate(ExecState* exec, double time, bool includeDate,
ASSERT(length <= bufferLength);
if (length > bufferLength)
length = bufferLength;
- CFStringGetCharacters(string, CFRangeMake(0, length), reinterpret_cast<UniChar *>(buffer));
+ CFStringGetCharacters(string, CFRangeMake(0, length), buffer);
CFRelease(string);
- return UString(buffer, length);
+ return jsNontrivialString(exec, UString(buffer, length));
}
-#else
+#else // !PLATFORM(MAC)
-enum LocaleDateTimeFormat { LocaleDateAndTime, LocaleDate, LocaleTime };
-
-static JSCell* formatLocaleDate(ExecState* exec, const GregorianDateTime& gdt, const LocaleDateTimeFormat format)
+static JSCell* formatLocaleDate(ExecState* exec, const GregorianDateTime& gdt, LocaleDateTimeFormat format)
{
- static const char* formatStrings[] = {"%#c", "%#x", "%X"};
+ static const char* const formatStrings[] = { "%#c", "%#x", "%X" };
// Offset year if needed
struct tm localTM = gdt;
@@ -211,7 +213,15 @@ static JSCell* formatLocaleDate(ExecState* exec, const GregorianDateTime& gdt, c
return jsNontrivialString(exec, timebuffer);
}
-#endif // PLATFORM(WIN_OS)
+static JSCell* formatLocaleDate(ExecState* exec, DateInstance* dateObject, double timeInMilliseconds, LocaleDateTimeFormat format, const ArgList&)
+{
+ GregorianDateTime gregorianDateTime;
+ const bool notUTC = false;
+ dateObject->msToGregorianDateTime(timeInMilliseconds, notUTC, gregorianDateTime);
+ return formatLocaleDate(exec, gregorianDateTime, format);
+}
+
+#endif // !PLATFORM(MAC)
// Converts a list of arguments sent to a Date member function into milliseconds, updating
// ms (representing milliseconds) and t (representing the rest of the date structure) appropriately.
@@ -231,19 +241,19 @@ static bool fillStructuresUsingTimeArgs(ExecState* exec, const ArgList& args, in
// hours
if (maxArgs >= 4 && idx < numArgs) {
t->hour = 0;
- milliseconds += args.at(exec, idx++)->toInt32(exec, ok) * msPerHour;
+ milliseconds += args.at(exec, idx++).toInt32(exec, ok) * msPerHour;
}
// minutes
if (maxArgs >= 3 && idx < numArgs && ok) {
t->minute = 0;
- milliseconds += args.at(exec, idx++)->toInt32(exec, ok) * msPerMinute;
+ milliseconds += args.at(exec, idx++).toInt32(exec, ok) * msPerMinute;
}
// seconds
if (maxArgs >= 2 && idx < numArgs && ok) {
t->second = 0;
- milliseconds += args.at(exec, idx++)->toInt32(exec, ok) * msPerSecond;
+ milliseconds += args.at(exec, idx++).toInt32(exec, ok) * msPerSecond;
}
if (!ok)
@@ -251,7 +261,7 @@ static bool fillStructuresUsingTimeArgs(ExecState* exec, const ArgList& args, in
// milliseconds
if (idx < numArgs) {
- double millis = args.at(exec, idx)->toNumber(exec);
+ double millis = args.at(exec, idx).toNumber(exec);
ok = isfinite(millis);
milliseconds += millis;
} else
@@ -277,16 +287,16 @@ static bool fillStructuresUsingDateArgs(ExecState *exec, const ArgList& args, in
// years
if (maxArgs >= 3 && idx < numArgs)
- t->year = args.at(exec, idx++)->toInt32(exec, ok) - 1900;
+ t->year = args.at(exec, idx++).toInt32(exec, ok) - 1900;
// months
if (maxArgs >= 2 && idx < numArgs && ok)
- t->month = args.at(exec, idx++)->toInt32(exec, ok);
+ t->month = args.at(exec, idx++).toInt32(exec, ok);
// days
if (idx < numArgs && ok) {
t->monthDay = 0;
- *ms += args.at(exec, idx)->toInt32(exec, ok) * msPerDay;
+ *ms += args.at(exec, idx).toInt32(exec, ok) * msPerDay;
}
return ok;
@@ -295,7 +305,6 @@ static bool fillStructuresUsingDateArgs(ExecState *exec, const ArgList& args, in
const ClassInfo DatePrototype::info = {"Date", &DateInstance::info, 0, ExecState::dateTable};
/* Source for DatePrototype.lut.h
- FIXME: We could use templates to simplify the UTC variants.
@begin dateTable
toString dateProtoFuncToString DontEnum|Function 0
toUTCString dateProtoFuncToUTCString DontEnum|Function 0
@@ -304,7 +313,7 @@ const ClassInfo DatePrototype::info = {"Date", &DateInstance::info, 0, ExecState
toLocaleString dateProtoFuncToLocaleString DontEnum|Function 0
toLocaleDateString dateProtoFuncToLocaleDateString DontEnum|Function 0
toLocaleTimeString dateProtoFuncToLocaleTimeString DontEnum|Function 0
- valueOf dateProtoFuncValueOf DontEnum|Function 0
+ valueOf dateProtoFuncGetTime DontEnum|Function 0
getTime dateProtoFuncGetTime DontEnum|Function 0
getFullYear dateProtoFuncGetFullYear DontEnum|Function 0
getUTCFullYear dateProtoFuncGetUTCFullYear DontEnum|Function 0
@@ -343,9 +352,10 @@ const ClassInfo DatePrototype::info = {"Date", &DateInstance::info, 0, ExecState
getYear dateProtoFuncGetYear DontEnum|Function 0
@end
*/
+
// ECMA 15.9.4
-DatePrototype::DatePrototype(ExecState* exec, PassRefPtr<StructureID> structure)
+DatePrototype::DatePrototype(ExecState* exec, PassRefPtr<Structure> structure)
: DateInstance(structure)
{
setInternalValue(jsNaN(exec));
@@ -359,9 +369,9 @@ bool DatePrototype::getOwnPropertySlot(ExecState* exec, const Identifier& proper
// Functions
-JSValue* dateProtoFuncToString(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList&)
+JSValuePtr dateProtoFuncToString(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList&)
{
- if (!thisValue->isObject(&DateInstance::info))
+ if (!thisValue.isObject(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = false;
@@ -376,9 +386,9 @@ JSValue* dateProtoFuncToString(ExecState* exec, JSObject*, JSValue* thisValue, c
return jsNontrivialString(exec, formatDate(t) + " " + formatTime(t, utc));
}
-JSValue* dateProtoFuncToUTCString(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList&)
+JSValuePtr dateProtoFuncToUTCString(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList&)
{
- if (!thisValue->isObject(&DateInstance::info))
+ if (!thisValue.isObject(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = true;
@@ -393,9 +403,9 @@ JSValue* dateProtoFuncToUTCString(ExecState* exec, JSObject*, JSValue* thisValue
return jsNontrivialString(exec, formatDateUTCVariant(t) + " " + formatTime(t, utc));
}
-JSValue* dateProtoFuncToDateString(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList&)
+JSValuePtr dateProtoFuncToDateString(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList&)
{
- if (!thisValue->isObject(&DateInstance::info))
+ if (!thisValue.isObject(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = false;
@@ -410,9 +420,9 @@ JSValue* dateProtoFuncToDateString(ExecState* exec, JSObject*, JSValue* thisValu
return jsNontrivialString(exec, formatDate(t));
}
-JSValue* dateProtoFuncToTimeString(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList&)
+JSValuePtr dateProtoFuncToTimeString(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList&)
{
- if (!thisValue->isObject(&DateInstance::info))
+ if (!thisValue.isObject(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = false;
@@ -427,9 +437,9 @@ JSValue* dateProtoFuncToTimeString(ExecState* exec, JSObject*, JSValue* thisValu
return jsNontrivialString(exec, formatTime(t, utc));
}
-JSValue* dateProtoFuncToLocaleString(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args)
+JSValuePtr dateProtoFuncToLocaleString(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList& args)
{
- if (!thisValue->isObject(&DateInstance::info))
+ if (!thisValue.isObject(&DateInstance::info))
return throwError(exec, TypeError);
DateInstance* thisDateObj = asDateInstance(thisValue);
@@ -437,23 +447,12 @@ JSValue* dateProtoFuncToLocaleString(ExecState* exec, JSObject*, JSValue* thisVa
if (isnan(milli))
return jsNontrivialString(exec, "Invalid Date");
-#if PLATFORM(MAC)
- double secs = floor(milli / msPerSecond);
- return jsNontrivialString(exec, formatLocaleDate(exec, secs, true, true, args));
-#else
- UNUSED_PARAM(args);
-
- const bool utc = false;
-
- GregorianDateTime t;
- thisDateObj->msToGregorianDateTime(milli, utc, t);
- return formatLocaleDate(exec, t, LocaleDateAndTime);
-#endif
+ return formatLocaleDate(exec, thisDateObj, milli, LocaleDateAndTime, args);
}
-JSValue* dateProtoFuncToLocaleDateString(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args)
+JSValuePtr dateProtoFuncToLocaleDateString(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList& args)
{
- if (!thisValue->isObject(&DateInstance::info))
+ if (!thisValue.isObject(&DateInstance::info))
return throwError(exec, TypeError);
DateInstance* thisDateObj = asDateInstance(thisValue);
@@ -461,23 +460,12 @@ JSValue* dateProtoFuncToLocaleDateString(ExecState* exec, JSObject*, JSValue* th
if (isnan(milli))
return jsNontrivialString(exec, "Invalid Date");
-#if PLATFORM(MAC)
- double secs = floor(milli / msPerSecond);
- return jsNontrivialString(exec, formatLocaleDate(exec, secs, true, false, args));
-#else
- UNUSED_PARAM(args);
-
- const bool utc = false;
-
- GregorianDateTime t;
- thisDateObj->msToGregorianDateTime(milli, utc, t);
- return formatLocaleDate(exec, t, LocaleDate);
-#endif
+ return formatLocaleDate(exec, thisDateObj, milli, LocaleDate, args);
}
-JSValue* dateProtoFuncToLocaleTimeString(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args)
+JSValuePtr dateProtoFuncToLocaleTimeString(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList& args)
{
- if (!thisValue->isObject(&DateInstance::info))
+ if (!thisValue.isObject(&DateInstance::info))
return throwError(exec, TypeError);
DateInstance* thisDateObj = asDateInstance(thisValue);
@@ -485,36 +473,12 @@ JSValue* dateProtoFuncToLocaleTimeString(ExecState* exec, JSObject*, JSValue* th
if (isnan(milli))
return jsNontrivialString(exec, "Invalid Date");
-#if PLATFORM(MAC)
- double secs = floor(milli / msPerSecond);
- return jsNontrivialString(exec, formatLocaleDate(exec, secs, false, true, args));
-#else
- UNUSED_PARAM(args);
-
- const bool utc = false;
-
- GregorianDateTime t;
- thisDateObj->msToGregorianDateTime(milli, utc, t);
- return formatLocaleDate(exec, t, LocaleTime);
-#endif
-}
-
-JSValue* dateProtoFuncValueOf(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList&)
-{
- if (!thisValue->isObject(&DateInstance::info))
- return throwError(exec, TypeError);
-
- DateInstance* thisDateObj = asDateInstance(thisValue);
- double milli = thisDateObj->internalNumber();
- if (isnan(milli))
- return jsNaN(exec);
-
- return jsNumber(exec, milli);
+ return formatLocaleDate(exec, thisDateObj, milli, LocaleTime, args);
}
-JSValue* dateProtoFuncGetTime(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList&)
+JSValuePtr dateProtoFuncGetTime(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList&)
{
- if (!thisValue->isObject(&DateInstance::info))
+ if (!thisValue.isObject(&DateInstance::info))
return throwError(exec, TypeError);
DateInstance* thisDateObj = asDateInstance(thisValue);
@@ -525,9 +489,9 @@ JSValue* dateProtoFuncGetTime(ExecState* exec, JSObject*, JSValue* thisValue, co
return jsNumber(exec, milli);
}
-JSValue* dateProtoFuncGetFullYear(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList&)
+JSValuePtr dateProtoFuncGetFullYear(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList&)
{
- if (!thisValue->isObject(&DateInstance::info))
+ if (!thisValue.isObject(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = false;
@@ -542,9 +506,9 @@ JSValue* dateProtoFuncGetFullYear(ExecState* exec, JSObject*, JSValue* thisValue
return jsNumber(exec, 1900 + t.year);
}
-JSValue* dateProtoFuncGetUTCFullYear(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList&)
+JSValuePtr dateProtoFuncGetUTCFullYear(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList&)
{
- if (!thisValue->isObject(&DateInstance::info))
+ if (!thisValue.isObject(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = true;
@@ -559,9 +523,9 @@ JSValue* dateProtoFuncGetUTCFullYear(ExecState* exec, JSObject*, JSValue* thisVa
return jsNumber(exec, 1900 + t.year);
}
-JSValue* dateProtoFuncToGMTString(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList&)
+JSValuePtr dateProtoFuncToGMTString(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList&)
{
- if (!thisValue->isObject(&DateInstance::info))
+ if (!thisValue.isObject(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = true;
@@ -576,9 +540,9 @@ JSValue* dateProtoFuncToGMTString(ExecState* exec, JSObject*, JSValue* thisValue
return jsNontrivialString(exec, formatDateUTCVariant(t) + " " + formatTime(t, utc));
}
-JSValue* dateProtoFuncGetMonth(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList&)
+JSValuePtr dateProtoFuncGetMonth(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList&)
{
- if (!thisValue->isObject(&DateInstance::info))
+ if (!thisValue.isObject(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = false;
@@ -593,9 +557,9 @@ JSValue* dateProtoFuncGetMonth(ExecState* exec, JSObject*, JSValue* thisValue, c
return jsNumber(exec, t.month);
}
-JSValue* dateProtoFuncGetUTCMonth(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList&)
+JSValuePtr dateProtoFuncGetUTCMonth(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList&)
{
- if (!thisValue->isObject(&DateInstance::info))
+ if (!thisValue.isObject(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = true;
@@ -610,9 +574,9 @@ JSValue* dateProtoFuncGetUTCMonth(ExecState* exec, JSObject*, JSValue* thisValue
return jsNumber(exec, t.month);
}
-JSValue* dateProtoFuncGetDate(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList&)
+JSValuePtr dateProtoFuncGetDate(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList&)
{
- if (!thisValue->isObject(&DateInstance::info))
+ if (!thisValue.isObject(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = false;
@@ -627,9 +591,9 @@ JSValue* dateProtoFuncGetDate(ExecState* exec, JSObject*, JSValue* thisValue, co
return jsNumber(exec, t.monthDay);
}
-JSValue* dateProtoFuncGetUTCDate(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList&)
+JSValuePtr dateProtoFuncGetUTCDate(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList&)
{
- if (!thisValue->isObject(&DateInstance::info))
+ if (!thisValue.isObject(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = true;
@@ -644,9 +608,9 @@ JSValue* dateProtoFuncGetUTCDate(ExecState* exec, JSObject*, JSValue* thisValue,
return jsNumber(exec, t.monthDay);
}
-JSValue* dateProtoFuncGetDay(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList&)
+JSValuePtr dateProtoFuncGetDay(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList&)
{
- if (!thisValue->isObject(&DateInstance::info))
+ if (!thisValue.isObject(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = false;
@@ -661,9 +625,9 @@ JSValue* dateProtoFuncGetDay(ExecState* exec, JSObject*, JSValue* thisValue, con
return jsNumber(exec, t.weekDay);
}
-JSValue* dateProtoFuncGetUTCDay(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList&)
+JSValuePtr dateProtoFuncGetUTCDay(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList&)
{
- if (!thisValue->isObject(&DateInstance::info))
+ if (!thisValue.isObject(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = true;
@@ -678,9 +642,9 @@ JSValue* dateProtoFuncGetUTCDay(ExecState* exec, JSObject*, JSValue* thisValue,
return jsNumber(exec, t.weekDay);
}
-JSValue* dateProtoFuncGetHours(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList&)
+JSValuePtr dateProtoFuncGetHours(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList&)
{
- if (!thisValue->isObject(&DateInstance::info))
+ if (!thisValue.isObject(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = false;
@@ -695,9 +659,9 @@ JSValue* dateProtoFuncGetHours(ExecState* exec, JSObject*, JSValue* thisValue, c
return jsNumber(exec, t.hour);
}
-JSValue* dateProtoFuncGetUTCHours(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList&)
+JSValuePtr dateProtoFuncGetUTCHours(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList&)
{
- if (!thisValue->isObject(&DateInstance::info))
+ if (!thisValue.isObject(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = true;
@@ -712,9 +676,9 @@ JSValue* dateProtoFuncGetUTCHours(ExecState* exec, JSObject*, JSValue* thisValue
return jsNumber(exec, t.hour);
}
-JSValue* dateProtoFuncGetMinutes(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList&)
+JSValuePtr dateProtoFuncGetMinutes(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList&)
{
- if (!thisValue->isObject(&DateInstance::info))
+ if (!thisValue.isObject(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = false;
@@ -729,9 +693,9 @@ JSValue* dateProtoFuncGetMinutes(ExecState* exec, JSObject*, JSValue* thisValue,
return jsNumber(exec, t.minute);
}
-JSValue* dateProtoFuncGetUTCMinutes(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList&)
+JSValuePtr dateProtoFuncGetUTCMinutes(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList&)
{
- if (!thisValue->isObject(&DateInstance::info))
+ if (!thisValue.isObject(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = true;
@@ -746,9 +710,9 @@ JSValue* dateProtoFuncGetUTCMinutes(ExecState* exec, JSObject*, JSValue* thisVal
return jsNumber(exec, t.minute);
}
-JSValue* dateProtoFuncGetSeconds(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList&)
+JSValuePtr dateProtoFuncGetSeconds(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList&)
{
- if (!thisValue->isObject(&DateInstance::info))
+ if (!thisValue.isObject(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = false;
@@ -763,9 +727,9 @@ JSValue* dateProtoFuncGetSeconds(ExecState* exec, JSObject*, JSValue* thisValue,
return jsNumber(exec, t.second);
}
-JSValue* dateProtoFuncGetUTCSeconds(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList&)
+JSValuePtr dateProtoFuncGetUTCSeconds(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList&)
{
- if (!thisValue->isObject(&DateInstance::info))
+ if (!thisValue.isObject(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = true;
@@ -780,9 +744,9 @@ JSValue* dateProtoFuncGetUTCSeconds(ExecState* exec, JSObject*, JSValue* thisVal
return jsNumber(exec, t.second);
}
-JSValue* dateProtoFuncGetMilliSeconds(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList&)
+JSValuePtr dateProtoFuncGetMilliSeconds(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList&)
{
- if (!thisValue->isObject(&DateInstance::info))
+ if (!thisValue.isObject(&DateInstance::info))
return throwError(exec, TypeError);
DateInstance* thisDateObj = asDateInstance(thisValue);
@@ -795,9 +759,9 @@ JSValue* dateProtoFuncGetMilliSeconds(ExecState* exec, JSObject*, JSValue* thisV
return jsNumber(exec, ms);
}
-JSValue* dateProtoFuncGetUTCMilliseconds(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList&)
+JSValuePtr dateProtoFuncGetUTCMilliseconds(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList&)
{
- if (!thisValue->isObject(&DateInstance::info))
+ if (!thisValue.isObject(&DateInstance::info))
return throwError(exec, TypeError);
DateInstance* thisDateObj = asDateInstance(thisValue);
@@ -810,9 +774,9 @@ JSValue* dateProtoFuncGetUTCMilliseconds(ExecState* exec, JSObject*, JSValue* th
return jsNumber(exec, ms);
}
-JSValue* dateProtoFuncGetTimezoneOffset(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList&)
+JSValuePtr dateProtoFuncGetTimezoneOffset(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList&)
{
- if (!thisValue->isObject(&DateInstance::info))
+ if (!thisValue.isObject(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = false;
@@ -827,29 +791,29 @@ JSValue* dateProtoFuncGetTimezoneOffset(ExecState* exec, JSObject*, JSValue* thi
return jsNumber(exec, -gmtoffset(t) / minutesPerHour);
}
-JSValue* dateProtoFuncSetTime(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args)
+JSValuePtr dateProtoFuncSetTime(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList& args)
{
- if (!thisValue->isObject(&DateInstance::info))
+ if (!thisValue.isObject(&DateInstance::info))
return throwError(exec, TypeError);
DateInstance* thisDateObj = asDateInstance(thisValue);
- double milli = timeClip(args.at(exec, 0)->toNumber(exec));
- JSValue* result = jsNumber(exec, milli);
+ double milli = timeClip(args.at(exec, 0).toNumber(exec));
+ JSValuePtr result = jsNumber(exec, milli);
thisDateObj->setInternalValue(result);
return result;
}
-static JSValue* setNewValueFromTimeArgs(ExecState* exec, JSValue* thisValue, const ArgList& args, int numArgsToUse, bool inputIsUTC)
+static JSValuePtr setNewValueFromTimeArgs(ExecState* exec, JSValuePtr thisValue, const ArgList& args, int numArgsToUse, bool inputIsUTC)
{
- if (!thisValue->isObject(&DateInstance::info))
+ if (!thisValue.isObject(&DateInstance::info))
return throwError(exec, TypeError);
DateInstance* thisDateObj = asDateInstance(thisValue);
double milli = thisDateObj->internalNumber();
if (args.isEmpty() || isnan(milli)) {
- JSValue* result = jsNaN(exec);
+ JSValuePtr result = jsNaN(exec);
thisDateObj->setInternalValue(result);
return result;
}
@@ -861,24 +825,24 @@ static JSValue* setNewValueFromTimeArgs(ExecState* exec, JSValue* thisValue, con
thisDateObj->msToGregorianDateTime(milli, inputIsUTC, t);
if (!fillStructuresUsingTimeArgs(exec, args, numArgsToUse, &ms, &t)) {
- JSValue* result = jsNaN(exec);
+ JSValuePtr result = jsNaN(exec);
thisDateObj->setInternalValue(result);
return result;
}
- JSValue* result = jsNumber(exec, gregorianDateTimeToMS(t, ms, inputIsUTC));
+ JSValuePtr result = jsNumber(exec, gregorianDateTimeToMS(t, ms, inputIsUTC));
thisDateObj->setInternalValue(result);
return result;
}
-static JSValue* setNewValueFromDateArgs(ExecState* exec, JSValue* thisValue, const ArgList& args, int numArgsToUse, bool inputIsUTC)
+static JSValuePtr setNewValueFromDateArgs(ExecState* exec, JSValuePtr thisValue, const ArgList& args, int numArgsToUse, bool inputIsUTC)
{
- if (!thisValue->isObject(&DateInstance::info))
+ if (!thisValue.isObject(&DateInstance::info))
return throwError(exec, TypeError);
DateInstance* thisDateObj = asDateInstance(thisValue);
if (args.isEmpty()) {
- JSValue* result = jsNaN(exec);
+ JSValuePtr result = jsNaN(exec);
thisDateObj->setInternalValue(result);
return result;
}
@@ -898,110 +862,110 @@ static JSValue* setNewValueFromDateArgs(ExecState* exec, JSValue* thisValue, con
}
if (!fillStructuresUsingDateArgs(exec, args, numArgsToUse, &ms, &t)) {
- JSValue* result = jsNaN(exec);
+ JSValuePtr result = jsNaN(exec);
thisDateObj->setInternalValue(result);
return result;
}
- JSValue* result = jsNumber(exec, gregorianDateTimeToMS(t, ms, inputIsUTC));
+ JSValuePtr result = jsNumber(exec, gregorianDateTimeToMS(t, ms, inputIsUTC));
thisDateObj->setInternalValue(result);
return result;
}
-JSValue* dateProtoFuncSetMilliSeconds(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args)
+JSValuePtr dateProtoFuncSetMilliSeconds(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList& args)
{
const bool inputIsUTC = false;
return setNewValueFromTimeArgs(exec, thisValue, args, 1, inputIsUTC);
}
-JSValue* dateProtoFuncSetUTCMilliseconds(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args)
+JSValuePtr dateProtoFuncSetUTCMilliseconds(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList& args)
{
const bool inputIsUTC = true;
return setNewValueFromTimeArgs(exec, thisValue, args, 1, inputIsUTC);
}
-JSValue* dateProtoFuncSetSeconds(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args)
+JSValuePtr dateProtoFuncSetSeconds(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList& args)
{
const bool inputIsUTC = false;
return setNewValueFromTimeArgs(exec, thisValue, args, 2, inputIsUTC);
}
-JSValue* dateProtoFuncSetUTCSeconds(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args)
+JSValuePtr dateProtoFuncSetUTCSeconds(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList& args)
{
const bool inputIsUTC = true;
return setNewValueFromTimeArgs(exec, thisValue, args, 2, inputIsUTC);
}
-JSValue* dateProtoFuncSetMinutes(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args)
+JSValuePtr dateProtoFuncSetMinutes(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList& args)
{
const bool inputIsUTC = false;
return setNewValueFromTimeArgs(exec, thisValue, args, 3, inputIsUTC);
}
-JSValue* dateProtoFuncSetUTCMinutes(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args)
+JSValuePtr dateProtoFuncSetUTCMinutes(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList& args)
{
const bool inputIsUTC = true;
return setNewValueFromTimeArgs(exec, thisValue, args, 3, inputIsUTC);
}
-JSValue* dateProtoFuncSetHours(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args)
+JSValuePtr dateProtoFuncSetHours(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList& args)
{
const bool inputIsUTC = false;
return setNewValueFromTimeArgs(exec, thisValue, args, 4, inputIsUTC);
}
-JSValue* dateProtoFuncSetUTCHours(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args)
+JSValuePtr dateProtoFuncSetUTCHours(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList& args)
{
const bool inputIsUTC = true;
return setNewValueFromTimeArgs(exec, thisValue, args, 4, inputIsUTC);
}
-JSValue* dateProtoFuncSetDate(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args)
+JSValuePtr dateProtoFuncSetDate(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList& args)
{
const bool inputIsUTC = false;
return setNewValueFromDateArgs(exec, thisValue, args, 1, inputIsUTC);
}
-JSValue* dateProtoFuncSetUTCDate(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args)
+JSValuePtr dateProtoFuncSetUTCDate(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList& args)
{
const bool inputIsUTC = true;
return setNewValueFromDateArgs(exec, thisValue, args, 1, inputIsUTC);
}
-JSValue* dateProtoFuncSetMonth(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args)
+JSValuePtr dateProtoFuncSetMonth(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList& args)
{
const bool inputIsUTC = false;
return setNewValueFromDateArgs(exec, thisValue, args, 2, inputIsUTC);
}
-JSValue* dateProtoFuncSetUTCMonth(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args)
+JSValuePtr dateProtoFuncSetUTCMonth(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList& args)
{
const bool inputIsUTC = true;
return setNewValueFromDateArgs(exec, thisValue, args, 2, inputIsUTC);
}
-JSValue* dateProtoFuncSetFullYear(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args)
+JSValuePtr dateProtoFuncSetFullYear(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList& args)
{
const bool inputIsUTC = false;
return setNewValueFromDateArgs(exec, thisValue, args, 3, inputIsUTC);
}
-JSValue* dateProtoFuncSetUTCFullYear(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args)
+JSValuePtr dateProtoFuncSetUTCFullYear(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList& args)
{
const bool inputIsUTC = true;
return setNewValueFromDateArgs(exec, thisValue, args, 3, inputIsUTC);
}
-JSValue* dateProtoFuncSetYear(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args)
+JSValuePtr dateProtoFuncSetYear(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList& args)
{
- if (!thisValue->isObject(&DateInstance::info))
+ if (!thisValue.isObject(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = false;
DateInstance* thisDateObj = asDateInstance(thisValue);
if (args.isEmpty()) {
- JSValue* result = jsNaN(exec);
+ JSValuePtr result = jsNaN(exec);
thisDateObj->setInternalValue(result);
return result;
}
@@ -1021,22 +985,22 @@ JSValue* dateProtoFuncSetYear(ExecState* exec, JSObject*, JSValue* thisValue, co
}
bool ok = true;
- int32_t year = args.at(exec, 0)->toInt32(exec, ok);
+ int32_t year = args.at(exec, 0).toInt32(exec, ok);
if (!ok) {
- JSValue* result = jsNaN(exec);
+ JSValuePtr result = jsNaN(exec);
thisDateObj->setInternalValue(result);
return result;
}
t.year = (year > 99 || year < 0) ? year - 1900 : year;
- JSValue* result = jsNumber(exec, gregorianDateTimeToMS(t, ms, utc));
+ JSValuePtr result = jsNumber(exec, gregorianDateTimeToMS(t, ms, utc));
thisDateObj->setInternalValue(result);
return result;
}
-JSValue* dateProtoFuncGetYear(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList&)
+JSValuePtr dateProtoFuncGetYear(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList&)
{
- if (!thisValue->isObject(&DateInstance::info))
+ if (!thisValue.isObject(&DateInstance::info))
return throwError(exec, TypeError);
const bool utc = false;