| 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 4943 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4954 static const int day_from_month_leap[] = {0, 31, 60, 91, 121, 152, | 4954 static const int day_from_month_leap[] = {0, 31, 60, 91, 121, 152, |
| 4955 182, 213, 244, 274, 305, 335}; | 4955 182, 213, 244, 274, 305, 335}; |
| 4956 | 4956 |
| 4957 year += month / 12; | 4957 year += month / 12; |
| 4958 month %= 12; | 4958 month %= 12; |
| 4959 if (month < 0) { | 4959 if (month < 0) { |
| 4960 year--; | 4960 year--; |
| 4961 month += 12; | 4961 month += 12; |
| 4962 } | 4962 } |
| 4963 | 4963 |
| 4964 ASSERT(month >= 0); |
| 4965 ASSERT(month < 12); |
| 4966 |
| 4964 static const int base_day = 365*1969 + 1969/4 - 1969/100 + 1969/400; | 4967 static const int base_day = 365*1969 + 1969/4 - 1969/100 + 1969/400; |
| 4965 int year1 = year - 1; | 4968 int year1 = year - 1; |
| 4966 int day_from_year = 365 * year1 + year1 / 4 - year1 / 100 + year1 / 400 - | 4969 int day_from_year = 365 * year1 + year1 / 4 - year1 / 100 + year1 / 400 - |
| 4967 base_day; | 4970 base_day; |
| 4968 | 4971 |
| 4969 if (year % 4 || (year % 100 == 0 && year % 400 != 0)) { | 4972 if (year % 4 || (year % 100 == 0 && year % 400 != 0)) { |
| 4970 return Smi::FromInt(day_from_year + day_from_month[month] + date - 1); | 4973 return Smi::FromInt(day_from_year + day_from_month[month] + date - 1); |
| 4971 } else { | 4974 } else { |
| 4972 return Smi::FromInt(day_from_year + day_from_month_leap[month] + date - 1); | 4975 return Smi::FromInt(day_from_year + day_from_month_leap[month] + date - 1); |
| 4973 } | 4976 } |
| (...skipping 3417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8391 } else { | 8394 } else { |
| 8392 // Handle last resort GC and make sure to allow future allocations | 8395 // Handle last resort GC and make sure to allow future allocations |
| 8393 // to grow the heap without causing GCs (if possible). | 8396 // to grow the heap without causing GCs (if possible). |
| 8394 Counters::gc_last_resort_from_js.Increment(); | 8397 Counters::gc_last_resort_from_js.Increment(); |
| 8395 Heap::CollectAllGarbage(false); | 8398 Heap::CollectAllGarbage(false); |
| 8396 } | 8399 } |
| 8397 } | 8400 } |
| 8398 | 8401 |
| 8399 | 8402 |
| 8400 } } // namespace v8::internal | 8403 } } // namespace v8::internal |
| OLD | NEW |