Reviewers: Sven Panne,

Description:
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

Please review this at https://codereview.chromium.org/216613003/

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

Affected files (+4, -2 lines):
  M src/api.cc
  M src/date.cc


Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index 5dcf592296f6f84d82491d3b1f3a4ca0381c6d3f..5d49cd9107b232c40360f9ea38d5541ed94d5050 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -5710,6 +5710,7 @@ double v8::Date::ValueOf() const {

 void v8::Date::DateTimeConfigurationChangeNotification(Isolate* isolate) {
   i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
+  if (!isolate->IsInitialized()) return;
ON_BAILOUT(i_isolate, "v8::Date::DateTimeConfigurationChangeNotification()",
              return);
   LOG_API(i_isolate, "Date::DateTimeConfigurationChangeNotification");
Index: src/date.cc
diff --git a/src/date.cc b/src/date.cc
index 70d6be989f0509f196cff01450be560fc738e74e..c22bc766734616671803fb30438a40e2ed1ebd7f 100644
--- a/src/date.cc
+++ b/src/date.cc
@@ -49,9 +49,10 @@ static const char kDaysInMonths[] =

 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