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
R=svenpanne@chromium.org
LOG=y

Review URL: https://codereview.chromium.org/216613003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20323 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
jochen@chromium.org 2014-03-28 08:59:25 +00:00
parent 3579968e86
commit 6781deae0a
2 changed files with 4 additions and 2 deletions

View File

@ -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 (!i_isolate->IsInitialized()) return;
ON_BAILOUT(i_isolate, "v8::Date::DateTimeConfigurationChangeNotification()",
return);
LOG_API(i_isolate, "Date::DateTimeConfigurationChangeNotification");

View File

@ -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) {