OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 static const int kDays1970to2000 = 30 * 365 + 7; | 42 static const int kDays1970to2000 = 30 * 365 + 7; |
43 static const int kDaysOffset = 1000 * kDaysIn400Years + 5 * kDaysIn400Years - | 43 static const int kDaysOffset = 1000 * kDaysIn400Years + 5 * kDaysIn400Years - |
44 kDays1970to2000; | 44 kDays1970to2000; |
45 static const int kYearsOffset = 400000; | 45 static const int kYearsOffset = 400000; |
46 static const char kDaysInMonths[] = | 46 static const char kDaysInMonths[] = |
47 {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; | 47 {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; |
48 | 48 |
49 | 49 |
50 void DateCache::ResetDateCache() { | 50 void DateCache::ResetDateCache() { |
51 static const int kMaxStamp = Smi::kMaxValue; | 51 static const int kMaxStamp = Smi::kMaxValue; |
52 stamp_ = Smi::FromInt(stamp_->value() + 1); | 52 if (stamp_->value() >= kMaxStamp) { |
53 if (stamp_->value() > kMaxStamp) { | |
54 stamp_ = Smi::FromInt(0); | 53 stamp_ = Smi::FromInt(0); |
| 54 } else { |
| 55 stamp_ = Smi::FromInt(stamp_->value() + 1); |
55 } | 56 } |
56 ASSERT(stamp_ != Smi::FromInt(kInvalidStamp)); | 57 ASSERT(stamp_ != Smi::FromInt(kInvalidStamp)); |
57 for (int i = 0; i < kDSTSize; ++i) { | 58 for (int i = 0; i < kDSTSize; ++i) { |
58 ClearSegment(&dst_[i]); | 59 ClearSegment(&dst_[i]); |
59 } | 60 } |
60 dst_usage_counter_ = 0; | 61 dst_usage_counter_ = 0; |
61 before_ = &dst_[0]; | 62 before_ = &dst_[0]; |
62 after_ = &dst_[1]; | 63 after_ = &dst_[1]; |
63 local_offset_ms_ = kInvalidLocalOffsetInMs; | 64 local_offset_ms_ = kInvalidLocalOffsetInMs; |
64 ymd_valid_ = false; | 65 ymd_valid_ = false; |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 if (&dst_[i] == skip) continue; | 376 if (&dst_[i] == skip) continue; |
376 if (result == NULL || result->last_used > dst_[i].last_used) { | 377 if (result == NULL || result->last_used > dst_[i].last_used) { |
377 result = &dst_[i]; | 378 result = &dst_[i]; |
378 } | 379 } |
379 } | 380 } |
380 ClearSegment(result); | 381 ClearSegment(result); |
381 return result; | 382 return result; |
382 } | 383 } |
383 | 384 |
384 } } // namespace v8::internal | 385 } } // namespace v8::internal |
OLD | NEW |