OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/date.h" | 5 #include "src/date.h" |
6 | 6 |
7 #include "src/objects.h" | 7 #include "src/objects.h" |
8 #include "src/objects-inl.h" | 8 #include "src/objects-inl.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 *day = new_day; | 64 *day = new_day; |
65 return; | 65 return; |
66 } | 66 } |
67 } | 67 } |
68 int save_days = days; | 68 int save_days = days; |
69 | 69 |
70 days += kDaysOffset; | 70 days += kDaysOffset; |
71 *year = 400 * (days / kDaysIn400Years) - kYearsOffset; | 71 *year = 400 * (days / kDaysIn400Years) - kYearsOffset; |
72 days %= kDaysIn400Years; | 72 days %= kDaysIn400Years; |
73 | 73 |
74 DCHECK(DaysFromYearMonth(*year, 0) + days == save_days); | 74 DCHECK_EQ(save_days, DaysFromYearMonth(*year, 0) + days); |
75 | 75 |
76 days--; | 76 days--; |
77 int yd1 = days / kDaysIn100Years; | 77 int yd1 = days / kDaysIn100Years; |
78 days %= kDaysIn100Years; | 78 days %= kDaysIn100Years; |
79 *year += 100 * yd1; | 79 *year += 100 * yd1; |
80 | 80 |
81 days++; | 81 days++; |
82 int yd2 = days / kDaysIn4Years; | 82 int yd2 = days / kDaysIn4Years; |
83 days %= kDaysIn4Years; | 83 days %= kDaysIn4Years; |
84 *year += 4 * yd2; | 84 *year += 4 * yd2; |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 if (result == NULL || result->last_used > dst_[i].last_used) { | 366 if (result == NULL || result->last_used > dst_[i].last_used) { |
367 result = &dst_[i]; | 367 result = &dst_[i]; |
368 } | 368 } |
369 } | 369 } |
370 ClearSegment(result); | 370 ClearSegment(result); |
371 return result; | 371 return result; |
372 } | 372 } |
373 | 373 |
374 } // namespace internal | 374 } // namespace internal |
375 } // namespace v8 | 375 } // namespace v8 |
OLD | NEW |