Index: src/date.js |
diff --git a/src/date.js b/src/date.js |
index 5e3f5c1a5ebd896fc9443e00c739058c68e0da3b..3f5c8b5c689c1e16b9fe082ad7eb0093c6862cb2 100644 |
--- a/src/date.js |
+++ b/src/date.js |
@@ -47,6 +47,7 @@ var timezone_cache_timezone; |
function LocalTimezone(t, timezone_offset) { |
if (NUMBER_IS_NAN(t)) return ""; |
+ CheckDateCacheCurrent(); |
if (t == timezone_cache_time && |
timezone_offset == timezone_cache_timezone_offset) { |
return timezone_cache_timezone; |
@@ -159,6 +160,7 @@ function DateConstructor(year, month, date, hours, minutes, seconds, ms) { |
} else if (IS_STRING(year)) { |
// Probe the Date cache. If we already have a time value for the |
// given time, we re-use that instead of parsing the string again. |
+ CheckDateCacheCurrent(); |
var cache = Date_cache; |
if (cache.string === year) { |
value = cache.time; |
@@ -745,7 +747,19 @@ function DateToJSON(key) { |
} |
-function ResetDateCache() { |
+var date_cache_version_holder; |
+var date_cache_version = NAN; |
+ |
+ |
+function CheckDateCacheCurrent() { |
+ if (!date_cache_version_holder) { |
+ date_cache_version_holder = %DateCacheVersion(); |
+ } |
+ if (date_cache_version_holder[0] == date_cache_version) { |
+ return; |
+ } |
+ date_cache_version = date_cache_version_holder[0]; |
+ |
// Reset the timezone cache: |
timezone_cache_time = NAN; |
timezone_cache_timezone = undefined; |