| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 year = TO_INTEGER_MAP_MINUS_ZERO(year); | 100 year = TO_INTEGER_MAP_MINUS_ZERO(year); |
| 101 month = TO_INTEGER_MAP_MINUS_ZERO(month); | 101 month = TO_INTEGER_MAP_MINUS_ZERO(month); |
| 102 date = TO_INTEGER_MAP_MINUS_ZERO(date); | 102 date = TO_INTEGER_MAP_MINUS_ZERO(date); |
| 103 | 103 |
| 104 if (year < kMinYear || year > kMaxYear || | 104 if (year < kMinYear || year > kMaxYear || |
| 105 month < kMinMonth || month > kMaxMonth) { | 105 month < kMinMonth || month > kMaxMonth) { |
| 106 return $NaN; | 106 return $NaN; |
| 107 } | 107 } |
| 108 | 108 |
| 109 // Now we rely on year and month being SMIs. | 109 // Now we rely on year and month being SMIs. |
| 110 return %DateMakeDay(year, month) + date - 1; | 110 return %DateMakeDay(year | 0, month | 0) + date - 1; |
| 111 } | 111 } |
| 112 | 112 |
| 113 | 113 |
| 114 // ECMA 262 - 15.9.1.13 | 114 // ECMA 262 - 15.9.1.13 |
| 115 function MakeDate(day, time) { | 115 function MakeDate(day, time) { |
| 116 var time = day * msPerDay + time; | 116 var time = day * msPerDay + time; |
| 117 // Some of our runtime funtions for computing UTC(time) rely on | 117 // Some of our runtime funtions for computing UTC(time) rely on |
| 118 // times not being significantly larger than MAX_TIME_MS. If there | 118 // times not being significantly larger than MAX_TIME_MS. If there |
| 119 // is no way that the time can be within range even after UTC | 119 // is no way that the time can be within range even after UTC |
| 120 // conversion we return NaN immediately instead of relying on | 120 // conversion we return NaN immediately instead of relying on |
| (...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 823 "toGMTString", DateToGMTString, | 823 "toGMTString", DateToGMTString, |
| 824 "toUTCString", DateToUTCString, | 824 "toUTCString", DateToUTCString, |
| 825 "getYear", DateGetYear, | 825 "getYear", DateGetYear, |
| 826 "setYear", DateSetYear, | 826 "setYear", DateSetYear, |
| 827 "toISOString", DateToISOString, | 827 "toISOString", DateToISOString, |
| 828 "toJSON", DateToJSON | 828 "toJSON", DateToJSON |
| 829 )); | 829 )); |
| 830 } | 830 } |
| 831 | 831 |
| 832 SetUpDate(); | 832 SetUpDate(); |
| OLD | NEW |