OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 5713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5724 year += 4 * yd2; | 5724 year += 4 * yd2; |
5725 | 5725 |
5726 date--; | 5726 date--; |
5727 int yd3 = date / 365; | 5727 int yd3 = date / 365; |
5728 date %= 365; | 5728 date %= 365; |
5729 year += yd3; | 5729 year += yd3; |
5730 | 5730 |
5731 bool is_leap = (!yd1 || yd2) && !yd3; | 5731 bool is_leap = (!yd1 || yd2) && !yd3; |
5732 | 5732 |
5733 ASSERT(date >= -1); | 5733 ASSERT(date >= -1); |
5734 ASSERT(is_leap || date >= 0); | 5734 ASSERT(is_leap || (date >= 0)); |
5735 ASSERT(date < 365 || is_leap && date < 366); | 5735 ASSERT((date < 365) || (is_leap && (date < 366))); |
5736 ASSERT(is_leap == (year % 4 == 0 && (year % 100 || (year % 400 == 0)))); | 5736 ASSERT(is_leap == ((year % 4 == 0) && (year % 100 || (year % 400 == 0)))); |
5737 ASSERT(is_leap || MakeDay(year, 0, 1) + date == save_date); | 5737 ASSERT(is_leap || ((MakeDay(year, 0, 1) + date) == save_date)); |
5738 ASSERT(!is_leap || MakeDay(year, 0, 1) + date + 1 == save_date); | 5738 ASSERT(!is_leap || ((MakeDay(year, 0, 1) + date + 1) == save_date)); |
5739 | 5739 |
5740 if (is_leap) { | 5740 if (is_leap) { |
5741 day = kDayInYear[2*365 + 1 + date]; | 5741 day = kDayInYear[2*365 + 1 + date]; |
5742 month = kMonthInYear[2*365 + 1 + date]; | 5742 month = kMonthInYear[2*365 + 1 + date]; |
5743 } else { | 5743 } else { |
5744 day = kDayInYear[date]; | 5744 day = kDayInYear[date]; |
5745 month = kMonthInYear[date]; | 5745 month = kMonthInYear[date]; |
5746 } | 5746 } |
5747 | 5747 |
5748 ASSERT(MakeDay(year, month, day) == save_date); | 5748 ASSERT(MakeDay(year, month, day) == save_date); |
(...skipping 3675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9424 } else { | 9424 } else { |
9425 // Handle last resort GC and make sure to allow future allocations | 9425 // Handle last resort GC and make sure to allow future allocations |
9426 // to grow the heap without causing GCs (if possible). | 9426 // to grow the heap without causing GCs (if possible). |
9427 Counters::gc_last_resort_from_js.Increment(); | 9427 Counters::gc_last_resort_from_js.Increment(); |
9428 Heap::CollectAllGarbage(false); | 9428 Heap::CollectAllGarbage(false); |
9429 } | 9429 } |
9430 } | 9430 } |
9431 | 9431 |
9432 | 9432 |
9433 } } // namespace v8::internal | 9433 } } // namespace v8::internal |
OLD | NEW |