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 989 matching lines...) Loading... |
1000 function DateToJSON(key) { | 1000 function DateToJSON(key) { |
1001 var o = ToObject(this); | 1001 var o = ToObject(this); |
1002 var tv = DefaultNumber(o); | 1002 var tv = DefaultNumber(o); |
1003 if (IS_NUMBER(tv) && !$isFinite(tv)) { | 1003 if (IS_NUMBER(tv) && !$isFinite(tv)) { |
1004 return null; | 1004 return null; |
1005 } | 1005 } |
1006 return o.toISOString(); | 1006 return o.toISOString(); |
1007 } | 1007 } |
1008 | 1008 |
1009 | 1009 |
| 1010 function ResetDateCache() { |
| 1011 |
| 1012 // Reset the local_time_offset: |
| 1013 local_time_offset = %DateLocalTimeOffset(); |
| 1014 |
| 1015 // Reset the DST offset cache: |
| 1016 var cache = DST_offset_cache; |
| 1017 cache.offset = 0; |
| 1018 cache.start = 0; |
| 1019 cache.end = -1; |
| 1020 cache.increment = 0; |
| 1021 cache.initial_increment = 19 * msPerDay; |
| 1022 |
| 1023 // Reset the timezone cache: |
| 1024 timezone_cache_time = $NaN; |
| 1025 timezone_cache_timezone = undefined; |
| 1026 |
| 1027 // Reset the ltcache: |
| 1028 ltcache.key = null; |
| 1029 ltcache.val = null; |
| 1030 |
| 1031 // Reset the ymd_from_time_cache: |
| 1032 ymd_from_time_cache = [$NaN, $NaN, $NaN]; |
| 1033 ymd_from_time_cached_time = $NaN; |
| 1034 |
| 1035 // Reset the date cache: |
| 1036 cache = Date_cache; |
| 1037 cache.time = $NaN; |
| 1038 cache.year = $NaN; |
| 1039 cache.string = null; |
| 1040 } |
| 1041 |
| 1042 |
1010 // ------------------------------------------------------------------- | 1043 // ------------------------------------------------------------------- |
1011 | 1044 |
1012 function SetupDate() { | 1045 function SetupDate() { |
1013 // Setup non-enumerable properties of the Date object itself. | 1046 // Setup non-enumerable properties of the Date object itself. |
1014 InstallFunctions($Date, DONT_ENUM, $Array( | 1047 InstallFunctions($Date, DONT_ENUM, $Array( |
1015 "UTC", DateUTC, | 1048 "UTC", DateUTC, |
1016 "parse", DateParse, | 1049 "parse", DateParse, |
1017 "now", DateNow | 1050 "now", DateNow |
1018 )); | 1051 )); |
1019 | 1052 |
(...skipping 46 matching lines...) Loading... |
1066 "toGMTString", DateToGMTString, | 1099 "toGMTString", DateToGMTString, |
1067 "toUTCString", DateToUTCString, | 1100 "toUTCString", DateToUTCString, |
1068 "getYear", DateGetYear, | 1101 "getYear", DateGetYear, |
1069 "setYear", DateSetYear, | 1102 "setYear", DateSetYear, |
1070 "toISOString", DateToISOString, | 1103 "toISOString", DateToISOString, |
1071 "toJSON", DateToJSON | 1104 "toJSON", DateToJSON |
1072 )); | 1105 )); |
1073 } | 1106 } |
1074 | 1107 |
1075 SetupDate(); | 1108 SetupDate(); |
OLD | NEW |