| Index: src/date.h
|
| diff --git a/src/date.h b/src/date.h
|
| index fcd61db046715003564a6e0fa73e009001361ab9..e9c9d9cb06ae9f1442a0c33bcd25d67c2449190a 100644
|
| --- a/src/date.h
|
| +++ b/src/date.h
|
| @@ -62,11 +62,14 @@ class DateCache {
|
| // It is an invariant of DateCache that cache stamp is non-negative.
|
| static const int kInvalidStamp = -1;
|
|
|
| - DateCache() : stamp_(0) {
|
| + DateCache() : stamp_(0), tz_cache_(OS::CreateTimezoneCache()) {
|
| ResetDateCache();
|
| }
|
|
|
| - virtual ~DateCache() {}
|
| + virtual ~DateCache() {
|
| + OS::DisposeTimezoneCache(tz_cache_);
|
| + tz_cache_ = NULL;
|
| + }
|
|
|
|
|
| // Clears cached timezone information and increments the cache stamp.
|
| @@ -113,7 +116,7 @@ class DateCache {
|
| if (time_ms < 0 || time_ms > kMaxEpochTimeInMs) {
|
| time_ms = EquivalentTime(time_ms);
|
| }
|
| - return OS::LocalTimezone(static_cast<double>(time_ms));
|
| + return OS::LocalTimezone(static_cast<double>(time_ms), tz_cache_);
|
| }
|
|
|
| // ECMA 262 - 15.9.5.26
|
| @@ -182,11 +185,11 @@ class DateCache {
|
| // These functions are virtual so that we can override them when testing.
|
| virtual int GetDaylightSavingsOffsetFromOS(int64_t time_sec) {
|
| double time_ms = static_cast<double>(time_sec * 1000);
|
| - return static_cast<int>(OS::DaylightSavingsOffset(time_ms));
|
| + return static_cast<int>(OS::DaylightSavingsOffset(time_ms, tz_cache_));
|
| }
|
|
|
| virtual int GetLocalOffsetFromOS() {
|
| - double offset = OS::LocalTimeOffset();
|
| + double offset = OS::LocalTimeOffset(tz_cache_);
|
| ASSERT(offset < kInvalidLocalOffsetInMs);
|
| return static_cast<int>(offset);
|
| }
|
| @@ -253,6 +256,8 @@ class DateCache {
|
| int ymd_year_;
|
| int ymd_month_;
|
| int ymd_day_;
|
| +
|
| + TimezoneCache* tz_cache_;
|
| };
|
|
|
| } } // namespace v8::internal
|
|
|