Revision: 20323
Author:   [email protected]
Date:     Fri Mar 28 08:59:25 2014 UTC
Log: Don't crash if we get a timezone change notification on an uninitialized isolate

Also make the date cache's timestamp more robust.

BUG=357362
[email protected]
LOG=y

Review URL: https://codereview.chromium.org/216613003
http://code.google.com/p/v8/source/detail?r=20323

Modified:
 /branches/bleeding_edge/src/api.cc
 /branches/bleeding_edge/src/date.cc

=======================================
--- /branches/bleeding_edge/src/api.cc  Thu Mar 27 16:42:34 2014 UTC
+++ /branches/bleeding_edge/src/api.cc  Fri Mar 28 08:59:25 2014 UTC
@@ -5710,6 +5710,7 @@

 void v8::Date::DateTimeConfigurationChangeNotification(Isolate* isolate) {
   i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
+  if (!i_isolate->IsInitialized()) return;
ON_BAILOUT(i_isolate, "v8::Date::DateTimeConfigurationChangeNotification()",
              return);
   LOG_API(i_isolate, "Date::DateTimeConfigurationChangeNotification");
=======================================
--- /branches/bleeding_edge/src/date.cc Fri Mar 14 15:19:54 2014 UTC
+++ /branches/bleeding_edge/src/date.cc Fri Mar 28 08:59:25 2014 UTC
@@ -49,9 +49,10 @@

 void DateCache::ResetDateCache() {
   static const int kMaxStamp = Smi::kMaxValue;
-  stamp_ = Smi::FromInt(stamp_->value() + 1);
-  if (stamp_->value() > kMaxStamp) {
+  if (stamp_->value() >= kMaxStamp) {
     stamp_ = Smi::FromInt(0);
+  } else {
+    stamp_ = Smi::FromInt(stamp_->value() + 1);
   }
   ASSERT(stamp_ != Smi::FromInt(kInvalidStamp));
   for (int i = 0; i < kDSTSize; ++i) {

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to