Reviewers: Vyacheslav Egorov,

Description:
Fix time zone cache so it is not initialized when the snapshot is built.

Please review this at http://codereview.chromium.org/1576002

SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/

Affected files:
  M     src/date.js


Index: src/date.js
===================================================================
--- src/date.js (revision 4317)
+++ src/date.js (working copy)
@@ -215,11 +215,22 @@
   return Modulo(DAY(time) + 4, 7);
 }

-var local_time_offset = %DateLocalTimeOffset();

+var local_time_offset;
+
+
+function LocalTimeOffset() {
+  if (IS_UNDEFINED(local_time_offset)) {
+    local_time_offset = %DateLocalTimeOffset();
+  }
+  return local_time_offset;
+}
+
+
+
 function LocalTime(time) {
   if (NUMBER_IS_NAN(time)) return time;
-  return time + local_time_offset + DaylightSavingsOffset(time);
+  return time + LocalTimeOffset() + DaylightSavingsOffset(time);
 }

 function LocalTimeNoCheck(time) {
@@ -234,13 +245,13 @@
   } else {
     var dst_offset = DaylightSavingsOffset(time);
   }
-  return time + local_time_offset + dst_offset;
+  return time + LocalTimeOffset() + dst_offset;
 }


 function UTC(time) {
   if (NUMBER_IS_NAN(time)) return time;
-  var tmp = time - local_time_offset;
+  var tmp = time - LocalTimeOffset();
   return tmp - DaylightSavingsOffset(tmp);
 }

@@ -566,7 +577,7 @@

 function LocalTimezoneString(time) {
   var timezoneOffset =
-      (local_time_offset + DaylightSavingsOffset(time)) / msPerMinute;
+      (LocalTimeOffset() + DaylightSavingsOffset(time)) / msPerMinute;
   var sign = (timezoneOffset >= 0) ? 1 : -1;
   var hours = FLOOR((sign * timezoneOffset)/60);
   var min   = FLOOR((sign * timezoneOffset)%60);


--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

To unsubscribe from this group, send email to v8-dev+unsubscribegooglegroups.com or reply 
to this email with the words "REMOVE ME" as the subject.

Reply via email to