Commit d239fbfa authored by dslomov@chromium.org's avatar dslomov@chromium.org

Revert "Check and clear date cache in DateCurrentTime, DateLocalTimezone and getTimezoneOffset."

This reverts commit r19711 for breaking WebKit tests.
http://build.chromium.org/p/tryserver.chromium/builders/win_rel/builds/278551/steps/content_browsertests/logs/AccessibilityMessagesQueueWhileSwappedOut

TBR=ulan@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19765 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 1634e7de
...@@ -122,13 +122,6 @@ class DateCache { ...@@ -122,13 +122,6 @@ class DateCache {
return static_cast<int>((time_ms - local_ms) / kMsPerMin); return static_cast<int>((time_ms - local_ms) / kMsPerMin);
} }
void CheckTimezone() {
if (local_offset_ms_ != kInvalidLocalOffsetInMs &&
local_offset_ms_ != GetLocalOffsetFromOS()) {
ResetDateCache();
}
}
// ECMA 262 - 15.9.1.9 // ECMA 262 - 15.9.1.9
int64_t ToLocal(int64_t time_ms) { int64_t ToLocal(int64_t time_ms) {
return time_ms + LocalOffsetInMs() + DaylightSavingsOffsetInMs(time_ms); return time_ms + LocalOffsetInMs() + DaylightSavingsOffsetInMs(time_ms);
......
...@@ -42,19 +42,16 @@ function ThrowDateTypeError() { ...@@ -42,19 +42,16 @@ function ThrowDateTypeError() {
var timezone_cache_time = NAN; var timezone_cache_time = NAN;
var timezone_cache_timezone_offset = NAN;
var timezone_cache_timezone; var timezone_cache_timezone;
function LocalTimezone(t, timezone_offset) { function LocalTimezone(t) {
if (NUMBER_IS_NAN(t)) return ""; if (NUMBER_IS_NAN(t)) return "";
if (t == timezone_cache_time && if (t == timezone_cache_time) {
timezone_offset == timezone_cache_timezone_offset) {
return timezone_cache_timezone; return timezone_cache_timezone;
} }
var timezone = %DateLocalTimezone(t); var timezone = %DateLocalTimezone(t);
timezone_cache_time = t; timezone_cache_time = t;
timezone_cache_timezone = timezone; timezone_cache_timezone = timezone;
timezone_cache_timezone_offset = timezone_offset;
return timezone; return timezone;
} }
...@@ -248,8 +245,9 @@ function TimeStringUTC(date) { ...@@ -248,8 +245,9 @@ function TimeStringUTC(date) {
function LocalTimezoneString(date) { function LocalTimezoneString(date) {
var timezone = LocalTimezone(UTC_DATE_VALUE(date));
var timezoneOffset = -TIMEZONE_OFFSET(date); var timezoneOffset = -TIMEZONE_OFFSET(date);
var timezone = LocalTimezone(UTC_DATE_VALUE(date), timezoneOffset);
var sign = (timezoneOffset >= 0) ? 1 : -1; var sign = (timezoneOffset >= 0) ? 1 : -1;
var hours = FLOOR((sign * timezoneOffset)/60); var hours = FLOOR((sign * timezoneOffset)/60);
var min = FLOOR((sign * timezoneOffset)%60); var min = FLOOR((sign * timezoneOffset)%60);
......
...@@ -16342,7 +16342,6 @@ Object* JSDate::GetUTCField(FieldIndex index, ...@@ -16342,7 +16342,6 @@ Object* JSDate::GetUTCField(FieldIndex index,
int64_t time_ms = static_cast<int64_t>(value); int64_t time_ms = static_cast<int64_t>(value);
if (index == kTimezoneOffset) { if (index == kTimezoneOffset) {
date_cache->CheckTimezone();
return Smi::FromInt(date_cache->TimezoneOffset(time_ms)); return Smi::FromInt(date_cache->TimezoneOffset(time_ms));
} }
......
...@@ -9549,7 +9549,6 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DateCurrentTime) { ...@@ -9549,7 +9549,6 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DateCurrentTime) {
// time is milliseconds. Therefore, we floor the result of getting // time is milliseconds. Therefore, we floor the result of getting
// the OS time. // the OS time.
double millis = std::floor(OS::TimeCurrentMillis()); double millis = std::floor(OS::TimeCurrentMillis());
isolate->date_cache()->CheckTimezone();
return isolate->heap()->NumberFromDouble(millis); return isolate->heap()->NumberFromDouble(millis);
} }
...@@ -9596,7 +9595,6 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DateLocalTimezone) { ...@@ -9596,7 +9595,6 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DateLocalTimezone) {
ASSERT(args.length() == 1); ASSERT(args.length() == 1);
CONVERT_DOUBLE_ARG_CHECKED(x, 0); CONVERT_DOUBLE_ARG_CHECKED(x, 0);
isolate->date_cache()->CheckTimezone();
int64_t time = isolate->date_cache()->EquivalentTime(static_cast<int64_t>(x)); int64_t time = isolate->date_cache()->EquivalentTime(static_cast<int64_t>(x));
const char* zone = OS::LocalTimezone(static_cast<double>(time)); const char* zone = OS::LocalTimezone(static_cast<double>(time));
return isolate->heap()->AllocateStringFromUtf8(CStrVector(zone)); return isolate->heap()->AllocateStringFromUtf8(CStrVector(zone));
......
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