[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.16-1409-g5afdf4d
ggaren at apple.com
ggaren at apple.com
Thu Dec 3 13:30:33 UTC 2009
The following commit has been merged in the webkit-1.1 branch:
commit 41a2c57333b9d81fd0b18298a3058416331f5420
Author: ggaren at apple.com <ggaren at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Nov 10 03:39:19 2009 +0000
Some manual inlining and constant propogation in Date code.
Reviewed by Sam Weinig.
SunSpider reports a 0.4% speedup on date-*, no overall speedup. Shark
says some previously evident stalls are now gone.
* runtime/DateConstructor.cpp:
(JSC::callDate):
* runtime/DateConversion.cpp:
(JSC::formatTime):
(JSC::formatTimeUTC): Split formatTime into UTC and non-UTC variants.
* runtime/DateConversion.h:
* runtime/DateInstance.cpp:
(JSC::DateInstance::calculateGregorianDateTime):
(JSC::DateInstance::calculateGregorianDateTimeUTC):
* runtime/DateInstance.h:
(JSC::DateInstance::gregorianDateTime):
(JSC::DateInstance::gregorianDateTimeUTC): Split gregorianDateTime into
a UTC and non-UTC variant, and split each variant into a fast inline
case and a slow out-of-line case.
* runtime/DatePrototype.cpp:
(JSC::formatLocaleDate):
(JSC::dateProtoFuncToString):
(JSC::dateProtoFuncToUTCString):
(JSC::dateProtoFuncToISOString):
(JSC::dateProtoFuncToDateString):
(JSC::dateProtoFuncToTimeString):
(JSC::dateProtoFuncGetFullYear):
(JSC::dateProtoFuncGetUTCFullYear):
(JSC::dateProtoFuncToGMTString):
(JSC::dateProtoFuncGetMonth):
(JSC::dateProtoFuncGetUTCMonth):
(JSC::dateProtoFuncGetDate):
(JSC::dateProtoFuncGetUTCDate):
(JSC::dateProtoFuncGetDay):
(JSC::dateProtoFuncGetUTCDay):
(JSC::dateProtoFuncGetHours):
(JSC::dateProtoFuncGetUTCHours):
(JSC::dateProtoFuncGetMinutes):
(JSC::dateProtoFuncGetUTCMinutes):
(JSC::dateProtoFuncGetSeconds):
(JSC::dateProtoFuncGetUTCSeconds):
(JSC::dateProtoFuncGetTimezoneOffset):
(JSC::setNewValueFromTimeArgs):
(JSC::setNewValueFromDateArgs):
(JSC::dateProtoFuncSetYear):
(JSC::dateProtoFuncGetYear): Updated for the gregorianDateTime change above.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@50708 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index 810c3ef..ea2c5cb 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,5 +1,58 @@
2009-11-09 Geoffrey Garen <ggaren at apple.com>
+ Reviewed by Sam Weinig.
+
+ Some manual inlining and constant propogation in Date code.
+
+ SunSpider reports a 0.4% speedup on date-*, no overall speedup. Shark
+ says some previously evident stalls are now gone.
+
+ * runtime/DateConstructor.cpp:
+ (JSC::callDate):
+ * runtime/DateConversion.cpp:
+ (JSC::formatTime):
+ (JSC::formatTimeUTC): Split formatTime into UTC and non-UTC variants.
+
+ * runtime/DateConversion.h:
+ * runtime/DateInstance.cpp:
+ (JSC::DateInstance::calculateGregorianDateTime):
+ (JSC::DateInstance::calculateGregorianDateTimeUTC):
+ * runtime/DateInstance.h:
+ (JSC::DateInstance::gregorianDateTime):
+ (JSC::DateInstance::gregorianDateTimeUTC): Split gregorianDateTime into
+ a UTC and non-UTC variant, and split each variant into a fast inline
+ case and a slow out-of-line case.
+
+ * runtime/DatePrototype.cpp:
+ (JSC::formatLocaleDate):
+ (JSC::dateProtoFuncToString):
+ (JSC::dateProtoFuncToUTCString):
+ (JSC::dateProtoFuncToISOString):
+ (JSC::dateProtoFuncToDateString):
+ (JSC::dateProtoFuncToTimeString):
+ (JSC::dateProtoFuncGetFullYear):
+ (JSC::dateProtoFuncGetUTCFullYear):
+ (JSC::dateProtoFuncToGMTString):
+ (JSC::dateProtoFuncGetMonth):
+ (JSC::dateProtoFuncGetUTCMonth):
+ (JSC::dateProtoFuncGetDate):
+ (JSC::dateProtoFuncGetUTCDate):
+ (JSC::dateProtoFuncGetDay):
+ (JSC::dateProtoFuncGetUTCDay):
+ (JSC::dateProtoFuncGetHours):
+ (JSC::dateProtoFuncGetUTCHours):
+ (JSC::dateProtoFuncGetMinutes):
+ (JSC::dateProtoFuncGetUTCMinutes):
+ (JSC::dateProtoFuncGetSeconds):
+ (JSC::dateProtoFuncGetUTCSeconds):
+ (JSC::dateProtoFuncGetTimezoneOffset):
+ (JSC::setNewValueFromTimeArgs):
+ (JSC::setNewValueFromDateArgs):
+ (JSC::dateProtoFuncSetYear):
+ (JSC::dateProtoFuncGetYear): Updated for the gregorianDateTime change above.
+
+2009-11-09 Geoffrey Garen <ggaren at apple.com>
+
Build fix: export a new symbol.
* JavaScriptCore.exp:
diff --git a/JavaScriptCore/runtime/DateConstructor.cpp b/JavaScriptCore/runtime/DateConstructor.cpp
index 01c5fea..d76daa2 100644
--- a/JavaScriptCore/runtime/DateConstructor.cpp
+++ b/JavaScriptCore/runtime/DateConstructor.cpp
@@ -133,7 +133,7 @@ static JSValue JSC_HOST_CALL callDate(ExecState* exec, JSObject*, JSValue, const
tm localTM;
getLocalTime(&localTime, &localTM);
GregorianDateTime ts(exec, localTM);
- return jsNontrivialString(exec, formatDate(ts) + " " + formatTime(ts, false));
+ return jsNontrivialString(exec, formatDate(ts) + " " + formatTime(ts));
}
CallType DateConstructor::getCallData(CallData& callData)
diff --git a/JavaScriptCore/runtime/DateConversion.cpp b/JavaScriptCore/runtime/DateConversion.cpp
index dba5551..b9d0e02 100644
--- a/JavaScriptCore/runtime/DateConversion.cpp
+++ b/JavaScriptCore/runtime/DateConversion.cpp
@@ -80,28 +80,31 @@ UString formatDateUTCVariant(const GregorianDateTime &t)
return buffer;
}
-UString formatTime(const GregorianDateTime &t, bool utc)
+UString formatTime(const GregorianDateTime &t)
{
char buffer[100];
- if (utc) {
- snprintf(buffer, sizeof(buffer), "%02d:%02d:%02d GMT", t.hour, t.minute, t.second);
- } else {
- int offset = abs(gmtoffset(t));
- char timeZoneName[70];
- struct tm gtm = t;
- strftime(timeZoneName, sizeof(timeZoneName), "%Z", >m);
+ int offset = abs(gmtoffset(t));
+ char timeZoneName[70];
+ struct tm gtm = t;
+ strftime(timeZoneName, sizeof(timeZoneName), "%Z", >m);
- if (timeZoneName[0]) {
- snprintf(buffer, sizeof(buffer), "%02d:%02d:%02d GMT%c%02d%02d (%s)",
- t.hour, t.minute, t.second,
- gmtoffset(t) < 0 ? '-' : '+', offset / (60*60), (offset / 60) % 60, timeZoneName);
- } else {
- snprintf(buffer, sizeof(buffer), "%02d:%02d:%02d GMT%c%02d%02d",
- t.hour, t.minute, t.second,
- gmtoffset(t) < 0 ? '-' : '+', offset / (60*60), (offset / 60) % 60);
- }
+ if (timeZoneName[0]) {
+ snprintf(buffer, sizeof(buffer), "%02d:%02d:%02d GMT%c%02d%02d (%s)",
+ t.hour, t.minute, t.second,
+ gmtoffset(t) < 0 ? '-' : '+', offset / (60*60), (offset / 60) % 60, timeZoneName);
+ } else {
+ snprintf(buffer, sizeof(buffer), "%02d:%02d:%02d GMT%c%02d%02d",
+ t.hour, t.minute, t.second,
+ gmtoffset(t) < 0 ? '-' : '+', offset / (60*60), (offset / 60) % 60);
}
return UString(buffer);
}
+UString formatTimeUTC(const GregorianDateTime &t)
+{
+ char buffer[100];
+ snprintf(buffer, sizeof(buffer), "%02d:%02d:%02d GMT", t.hour, t.minute, t.second);
+ return UString(buffer);
+}
+
} // namespace JSC
diff --git a/JavaScriptCore/runtime/DateConversion.h b/JavaScriptCore/runtime/DateConversion.h
index d44afe0..dc980d3 100644
--- a/JavaScriptCore/runtime/DateConversion.h
+++ b/JavaScriptCore/runtime/DateConversion.h
@@ -51,7 +51,8 @@ struct GregorianDateTime;
double parseDate(ExecState* exec, const UString&);
UString formatDate(const GregorianDateTime&);
UString formatDateUTCVariant(const GregorianDateTime&);
-UString formatTime(const GregorianDateTime&, bool inputIsUTC);
+UString formatTime(const GregorianDateTime&);
+UString formatTimeUTC(const GregorianDateTime&);
} // namespace JSC
diff --git a/JavaScriptCore/runtime/DateInstance.cpp b/JavaScriptCore/runtime/DateInstance.cpp
index e28b379..77a92be 100644
--- a/JavaScriptCore/runtime/DateInstance.cpp
+++ b/JavaScriptCore/runtime/DateInstance.cpp
@@ -46,7 +46,7 @@ DateInstance::DateInstance(ExecState* exec, double time)
setInternalValue(jsNumber(exec, timeClip(time)));
}
-const GregorianDateTime* DateInstance::gregorianDateTime(ExecState* exec, bool outputIsUTC) const
+const GregorianDateTime* DateInstance::calculateGregorianDateTime(ExecState* exec) const
{
double milli = internalNumber();
if (isnan(milli))
@@ -55,19 +55,27 @@ const GregorianDateTime* DateInstance::gregorianDateTime(ExecState* exec, bool o
if (!m_data)
m_data = exec->globalData().dateInstanceCache.add(milli);
- if (outputIsUTC) {
- if (m_data->m_gregorianDateTimeUTCCachedForMS != milli) {
- msToGregorianDateTime(exec, internalNumber(), true, m_data->m_cachedGregorianDateTimeUTC);
- m_data->m_gregorianDateTimeUTCCachedForMS = milli;
- }
- return &m_data->m_cachedGregorianDateTimeUTC;
- }
-
if (m_data->m_gregorianDateTimeCachedForMS != milli) {
- msToGregorianDateTime(exec, internalNumber(), false, m_data->m_cachedGregorianDateTime);
+ msToGregorianDateTime(exec, milli, false, m_data->m_cachedGregorianDateTime);
m_data->m_gregorianDateTimeCachedForMS = milli;
}
return &m_data->m_cachedGregorianDateTime;
}
+const GregorianDateTime* DateInstance::calculateGregorianDateTimeUTC(ExecState* exec) const
+{
+ double milli = internalNumber();
+ if (isnan(milli))
+ return 0;
+
+ if (!m_data)
+ m_data = exec->globalData().dateInstanceCache.add(milli);
+
+ if (m_data->m_gregorianDateTimeUTCCachedForMS != milli) {
+ msToGregorianDateTime(exec, milli, true, m_data->m_cachedGregorianDateTimeUTC);
+ m_data->m_gregorianDateTimeUTCCachedForMS = milli;
+ }
+ return &m_data->m_cachedGregorianDateTimeUTC;
+}
+
} // namespace JSC
diff --git a/JavaScriptCore/runtime/DateInstance.h b/JavaScriptCore/runtime/DateInstance.h
index ca5bbe4..44b7521 100644
--- a/JavaScriptCore/runtime/DateInstance.h
+++ b/JavaScriptCore/runtime/DateInstance.h
@@ -38,7 +38,19 @@ namespace JSC {
static JS_EXPORTDATA const ClassInfo info;
- const GregorianDateTime* gregorianDateTime(ExecState*, bool outputIsUTC) const;
+ const GregorianDateTime* gregorianDateTime(ExecState* exec) const
+ {
+ if (m_data && m_data->m_gregorianDateTimeCachedForMS == internalNumber())
+ return &m_data->m_cachedGregorianDateTime;
+ return calculateGregorianDateTime(exec);
+ }
+
+ const GregorianDateTime* gregorianDateTimeUTC(ExecState* exec) const
+ {
+ if (m_data && m_data->m_gregorianDateTimeUTCCachedForMS == internalNumber())
+ return &m_data->m_cachedGregorianDateTimeUTC;
+ return calculateGregorianDateTimeUTC(exec);
+ }
static PassRefPtr<Structure> createStructure(JSValue prototype)
{
@@ -49,6 +61,8 @@ namespace JSC {
static const unsigned StructureFlags = OverridesMarkChildren | JSWrapperObject::StructureFlags;
private:
+ const GregorianDateTime* calculateGregorianDateTime(ExecState*) const;
+ const GregorianDateTime* calculateGregorianDateTimeUTC(ExecState*) const;
virtual const ClassInfo* classInfo() const { return &info; }
mutable RefPtr<DateInstanceData> m_data;
diff --git a/JavaScriptCore/runtime/DatePrototype.cpp b/JavaScriptCore/runtime/DatePrototype.cpp
index 89610ac..fe85873 100644
--- a/JavaScriptCore/runtime/DatePrototype.cpp
+++ b/JavaScriptCore/runtime/DatePrototype.cpp
@@ -253,8 +253,7 @@ static JSCell* formatLocaleDate(ExecState* exec, const GregorianDateTime& gdt, L
static JSCell* formatLocaleDate(ExecState* exec, DateInstance* dateObject, double, LocaleDateTimeFormat format, const ArgList&)
{
- const bool outputIsUTC = false;
- const GregorianDateTime* gregorianDateTime = dateObject->gregorianDateTime(exec, outputIsUTC);
+ const GregorianDateTime* gregorianDateTime = dateObject->gregorianDateTime(exec);
if (!gregorianDateTime)
return jsNontrivialString(exec, "Invalid Date");
return formatLocaleDate(exec, *gregorianDateTime, format);
@@ -420,14 +419,12 @@ JSValue JSC_HOST_CALL dateProtoFuncToString(ExecState* exec, JSObject*, JSValue
if (!thisValue.inherits(&DateInstance::info))
return throwError(exec, TypeError);
- const bool outputIsUTC = false;
-
DateInstance* thisDateObj = asDateInstance(thisValue);
- const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec, outputIsUTC);
+ const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec);
if (!gregorianDateTime)
return jsNontrivialString(exec, "Invalid Date");
- return jsNontrivialString(exec, formatDate(*gregorianDateTime) + " " + formatTime(*gregorianDateTime, outputIsUTC));
+ return jsNontrivialString(exec, formatDate(*gregorianDateTime) + " " + formatTime(*gregorianDateTime));
}
JSValue JSC_HOST_CALL dateProtoFuncToUTCString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
@@ -435,14 +432,12 @@ JSValue JSC_HOST_CALL dateProtoFuncToUTCString(ExecState* exec, JSObject*, JSVal
if (!thisValue.inherits(&DateInstance::info))
return throwError(exec, TypeError);
- const bool outputIsUTC = true;
-
DateInstance* thisDateObj = asDateInstance(thisValue);
- const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec, outputIsUTC);
+ const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec);
if (!gregorianDateTime)
return jsNontrivialString(exec, "Invalid Date");
- return jsNontrivialString(exec, formatDateUTCVariant(*gregorianDateTime) + " " + formatTime(*gregorianDateTime, outputIsUTC));
+ return jsNontrivialString(exec, formatDateUTCVariant(*gregorianDateTime) + " " + formatTimeUTC(*gregorianDateTime));
}
JSValue JSC_HOST_CALL dateProtoFuncToISOString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
@@ -450,11 +445,9 @@ JSValue JSC_HOST_CALL dateProtoFuncToISOString(ExecState* exec, JSObject*, JSVal
if (!thisValue.inherits(&DateInstance::info))
return throwError(exec, TypeError);
- const bool outputIsUTC = true;
-
DateInstance* thisDateObj = asDateInstance(thisValue);
- const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec, outputIsUTC);
+ const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec);
if (!gregorianDateTime)
return jsNontrivialString(exec, "Invalid Date");
// Maximum amount of space we need in buffer: 6 (max. digits in year) + 2 * 5 (2 characters each for month, day, hour, minute, second) + 4 (. + 3 digits for milliseconds)
@@ -470,11 +463,9 @@ JSValue JSC_HOST_CALL dateProtoFuncToDateString(ExecState* exec, JSObject*, JSVa
if (!thisValue.inherits(&DateInstance::info))
return throwError(exec, TypeError);
- const bool outputIsUTC = false;
-
DateInstance* thisDateObj = asDateInstance(thisValue);
- const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec, outputIsUTC);
+ const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec);
if (!gregorianDateTime)
return jsNontrivialString(exec, "Invalid Date");
return jsNontrivialString(exec, formatDate(*gregorianDateTime));
@@ -485,14 +476,12 @@ JSValue JSC_HOST_CALL dateProtoFuncToTimeString(ExecState* exec, JSObject*, JSVa
if (!thisValue.inherits(&DateInstance::info))
return throwError(exec, TypeError);
- const bool outputIsUTC = false;
-
DateInstance* thisDateObj = asDateInstance(thisValue);
- const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec, outputIsUTC);
+ const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec);
if (!gregorianDateTime)
return jsNontrivialString(exec, "Invalid Date");
- return jsNontrivialString(exec, formatTime(*gregorianDateTime, outputIsUTC));
+ return jsNontrivialString(exec, formatTime(*gregorianDateTime));
}
JSValue JSC_HOST_CALL dateProtoFuncToLocaleString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
@@ -535,11 +524,9 @@ JSValue JSC_HOST_CALL dateProtoFuncGetFullYear(ExecState* exec, JSObject*, JSVal
if (!thisValue.inherits(&DateInstance::info))
return throwError(exec, TypeError);
- const bool outputIsUTC = false;
-
DateInstance* thisDateObj = asDateInstance(thisValue);
- const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec, outputIsUTC);
+ const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec);
if (!gregorianDateTime)
return jsNaN(exec);
return jsNumber(exec, 1900 + gregorianDateTime->year);
@@ -550,11 +537,9 @@ JSValue JSC_HOST_CALL dateProtoFuncGetUTCFullYear(ExecState* exec, JSObject*, JS
if (!thisValue.inherits(&DateInstance::info))
return throwError(exec, TypeError);
- const bool outputIsUTC = true;
-
DateInstance* thisDateObj = asDateInstance(thisValue);
- const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec, outputIsUTC);
+ const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec);
if (!gregorianDateTime)
return jsNaN(exec);
return jsNumber(exec, 1900 + gregorianDateTime->year);
@@ -565,14 +550,12 @@ JSValue JSC_HOST_CALL dateProtoFuncToGMTString(ExecState* exec, JSObject*, JSVal
if (!thisValue.inherits(&DateInstance::info))
return throwError(exec, TypeError);
- const bool outputIsUTC = true;
-
DateInstance* thisDateObj = asDateInstance(thisValue);
- const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec, outputIsUTC);
+ const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec);
if (!gregorianDateTime)
return jsNontrivialString(exec, "Invalid Date");
- return jsNontrivialString(exec, formatDateUTCVariant(*gregorianDateTime) + " " + formatTime(*gregorianDateTime, outputIsUTC));
+ return jsNontrivialString(exec, formatDateUTCVariant(*gregorianDateTime) + " " + formatTimeUTC(*gregorianDateTime));
}
JSValue JSC_HOST_CALL dateProtoFuncGetMonth(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
@@ -580,11 +563,9 @@ JSValue JSC_HOST_CALL dateProtoFuncGetMonth(ExecState* exec, JSObject*, JSValue
if (!thisValue.inherits(&DateInstance::info))
return throwError(exec, TypeError);
- const bool outputIsUTC = false;
-
DateInstance* thisDateObj = asDateInstance(thisValue);
- const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec, outputIsUTC);
+ const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec);
if (!gregorianDateTime)
return jsNaN(exec);
return jsNumber(exec, gregorianDateTime->month);
@@ -595,11 +576,9 @@ JSValue JSC_HOST_CALL dateProtoFuncGetUTCMonth(ExecState* exec, JSObject*, JSVal
if (!thisValue.inherits(&DateInstance::info))
return throwError(exec, TypeError);
- const bool outputIsUTC = true;
-
DateInstance* thisDateObj = asDateInstance(thisValue);
- const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec, outputIsUTC);
+ const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec);
if (!gregorianDateTime)
return jsNaN(exec);
return jsNumber(exec, gregorianDateTime->month);
@@ -610,11 +589,9 @@ JSValue JSC_HOST_CALL dateProtoFuncGetDate(ExecState* exec, JSObject*, JSValue t
if (!thisValue.inherits(&DateInstance::info))
return throwError(exec, TypeError);
- const bool outputIsUTC = false;
-
DateInstance* thisDateObj = asDateInstance(thisValue);
- const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec, outputIsUTC);
+ const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec);
if (!gregorianDateTime)
return jsNaN(exec);
return jsNumber(exec, gregorianDateTime->monthDay);
@@ -625,11 +602,9 @@ JSValue JSC_HOST_CALL dateProtoFuncGetUTCDate(ExecState* exec, JSObject*, JSValu
if (!thisValue.inherits(&DateInstance::info))
return throwError(exec, TypeError);
- const bool outputIsUTC = true;
-
DateInstance* thisDateObj = asDateInstance(thisValue);
- const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec, outputIsUTC);
+ const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec);
if (!gregorianDateTime)
return jsNaN(exec);
return jsNumber(exec, gregorianDateTime->monthDay);
@@ -640,11 +615,9 @@ JSValue JSC_HOST_CALL dateProtoFuncGetDay(ExecState* exec, JSObject*, JSValue th
if (!thisValue.inherits(&DateInstance::info))
return throwError(exec, TypeError);
- const bool outputIsUTC = false;
-
DateInstance* thisDateObj = asDateInstance(thisValue);
- const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec, outputIsUTC);
+ const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec);
if (!gregorianDateTime)
return jsNaN(exec);
return jsNumber(exec, gregorianDateTime->weekDay);
@@ -655,11 +628,9 @@ JSValue JSC_HOST_CALL dateProtoFuncGetUTCDay(ExecState* exec, JSObject*, JSValue
if (!thisValue.inherits(&DateInstance::info))
return throwError(exec, TypeError);
- const bool outputIsUTC = true;
-
DateInstance* thisDateObj = asDateInstance(thisValue);
- const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec, outputIsUTC);
+ const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec);
if (!gregorianDateTime)
return jsNaN(exec);
return jsNumber(exec, gregorianDateTime->weekDay);
@@ -670,11 +641,9 @@ JSValue JSC_HOST_CALL dateProtoFuncGetHours(ExecState* exec, JSObject*, JSValue
if (!thisValue.inherits(&DateInstance::info))
return throwError(exec, TypeError);
- const bool outputIsUTC = false;
-
DateInstance* thisDateObj = asDateInstance(thisValue);
- const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec, outputIsUTC);
+ const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec);
if (!gregorianDateTime)
return jsNaN(exec);
return jsNumber(exec, gregorianDateTime->hour);
@@ -685,11 +654,9 @@ JSValue JSC_HOST_CALL dateProtoFuncGetUTCHours(ExecState* exec, JSObject*, JSVal
if (!thisValue.inherits(&DateInstance::info))
return throwError(exec, TypeError);
- const bool outputIsUTC = true;
-
DateInstance* thisDateObj = asDateInstance(thisValue);
- const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec, outputIsUTC);
+ const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec);
if (!gregorianDateTime)
return jsNaN(exec);
return jsNumber(exec, gregorianDateTime->hour);
@@ -700,11 +667,9 @@ JSValue JSC_HOST_CALL dateProtoFuncGetMinutes(ExecState* exec, JSObject*, JSValu
if (!thisValue.inherits(&DateInstance::info))
return throwError(exec, TypeError);
- const bool outputIsUTC = false;
-
DateInstance* thisDateObj = asDateInstance(thisValue);
- const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec, outputIsUTC);
+ const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec);
if (!gregorianDateTime)
return jsNaN(exec);
return jsNumber(exec, gregorianDateTime->minute);
@@ -715,11 +680,9 @@ JSValue JSC_HOST_CALL dateProtoFuncGetUTCMinutes(ExecState* exec, JSObject*, JSV
if (!thisValue.inherits(&DateInstance::info))
return throwError(exec, TypeError);
- const bool outputIsUTC = true;
-
DateInstance* thisDateObj = asDateInstance(thisValue);
- const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec, outputIsUTC);
+ const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec);
if (!gregorianDateTime)
return jsNaN(exec);
return jsNumber(exec, gregorianDateTime->minute);
@@ -730,11 +693,9 @@ JSValue JSC_HOST_CALL dateProtoFuncGetSeconds(ExecState* exec, JSObject*, JSValu
if (!thisValue.inherits(&DateInstance::info))
return throwError(exec, TypeError);
- const bool outputIsUTC = false;
-
DateInstance* thisDateObj = asDateInstance(thisValue);
- const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec, outputIsUTC);
+ const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec);
if (!gregorianDateTime)
return jsNaN(exec);
return jsNumber(exec, gregorianDateTime->second);
@@ -745,11 +706,9 @@ JSValue JSC_HOST_CALL dateProtoFuncGetUTCSeconds(ExecState* exec, JSObject*, JSV
if (!thisValue.inherits(&DateInstance::info))
return throwError(exec, TypeError);
- const bool outputIsUTC = true;
-
DateInstance* thisDateObj = asDateInstance(thisValue);
- const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec, outputIsUTC);
+ const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec);
if (!gregorianDateTime)
return jsNaN(exec);
return jsNumber(exec, gregorianDateTime->second);
@@ -790,11 +749,9 @@ JSValue JSC_HOST_CALL dateProtoFuncGetTimezoneOffset(ExecState* exec, JSObject*,
if (!thisValue.inherits(&DateInstance::info))
return throwError(exec, TypeError);
- const bool outputIsUTC = false;
-
DateInstance* thisDateObj = asDateInstance(thisValue);
- const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec, outputIsUTC);
+ const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec);
if (!gregorianDateTime)
return jsNaN(exec);
return jsNumber(exec, -gregorianDateTime->utcOffset / minutesPerHour);
@@ -830,7 +787,9 @@ static JSValue setNewValueFromTimeArgs(ExecState* exec, JSValue thisValue, const
double secs = floor(milli / msPerSecond);
double ms = milli - secs * msPerSecond;
- const GregorianDateTime* other = thisDateObj->gregorianDateTime(exec, inputIsUTC);
+ const GregorianDateTime* other = inputIsUTC
+ ? thisDateObj->gregorianDateTimeUTC(exec)
+ : thisDateObj->gregorianDateTime(exec);
if (!other)
return jsNaN(exec);
@@ -867,7 +826,9 @@ static JSValue setNewValueFromDateArgs(ExecState* exec, JSValue thisValue, const
msToGregorianDateTime(exec, 0, true, gregorianDateTime);
else {
ms = milli - floor(milli / msPerSecond) * msPerSecond;
- const GregorianDateTime* other = thisDateObj->gregorianDateTime(exec, inputIsUTC);
+ const GregorianDateTime* other = inputIsUTC
+ ? thisDateObj->gregorianDateTimeUTC(exec)
+ : thisDateObj->gregorianDateTime(exec);
if (!other)
return jsNaN(exec);
gregorianDateTime.copyFrom(*other);
@@ -973,8 +934,6 @@ JSValue JSC_HOST_CALL dateProtoFuncSetYear(ExecState* exec, JSObject*, JSValue t
if (!thisValue.inherits(&DateInstance::info))
return throwError(exec, TypeError);
- const bool outputIsUTC = false;
-
DateInstance* thisDateObj = asDateInstance(thisValue);
if (args.isEmpty()) {
JSValue result = jsNaN(exec);
@@ -993,7 +952,7 @@ JSValue JSC_HOST_CALL dateProtoFuncSetYear(ExecState* exec, JSObject*, JSValue t
else {
double secs = floor(milli / msPerSecond);
ms = milli - secs * msPerSecond;
- if (const GregorianDateTime* other = thisDateObj->gregorianDateTime(exec, outputIsUTC))
+ if (const GregorianDateTime* other = thisDateObj->gregorianDateTime(exec))
gregorianDateTime.copyFrom(*other);
}
@@ -1006,7 +965,7 @@ JSValue JSC_HOST_CALL dateProtoFuncSetYear(ExecState* exec, JSObject*, JSValue t
}
gregorianDateTime.year = (year > 99 || year < 0) ? year - 1900 : year;
- JSValue result = jsNumber(exec, gregorianDateTimeToMS(exec, gregorianDateTime, ms, outputIsUTC));
+ JSValue result = jsNumber(exec, gregorianDateTimeToMS(exec, gregorianDateTime, ms, false));
thisDateObj->setInternalValue(result);
return result;
}
@@ -1016,11 +975,9 @@ JSValue JSC_HOST_CALL dateProtoFuncGetYear(ExecState* exec, JSObject*, JSValue t
if (!thisValue.inherits(&DateInstance::info))
return throwError(exec, TypeError);
- const bool outputIsUTC = false;
-
DateInstance* thisDateObj = asDateInstance(thisValue);
- const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec, outputIsUTC);
+ const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec);
if (!gregorianDateTime)
return jsNaN(exec);
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list