| 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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 function TimeInYear(year) { | 258 function TimeInYear(year) { |
| 259 return DaysInYear(year) * msPerDay; | 259 return DaysInYear(year) * msPerDay; |
| 260 } | 260 } |
| 261 | 261 |
| 262 | 262 |
| 263 var ymd_from_time_cache = [$NaN, $NaN, $NaN]; | 263 var ymd_from_time_cache = [$NaN, $NaN, $NaN]; |
| 264 var ymd_from_time_cached_time = $NaN; | 264 var ymd_from_time_cached_time = $NaN; |
| 265 | 265 |
| 266 function YearFromTime(t) { | 266 function YearFromTime(t) { |
| 267 if (t !== ymd_from_time_cached_time) { | 267 if (t !== ymd_from_time_cached_time) { |
| 268 // Limits according to ECMA 262 15.9.1.1 | 268 // Limits according to ECMA 262 15.9.1.1 |
| 269 if (!$isFinite(t) || t < -8640000000000000 || t > 8640000000000000) { | 269 if (!$isFinite(t) || t < -8640000000000000 || t > 8640000000000000) { |
| 270 return $NaN; | 270 return $NaN; |
| 271 } | 271 } |
| 272 | 272 |
| 273 %DateYMDFromTime(t, ymd_from_time_cache); | 273 %DateYMDFromTime(t, ymd_from_time_cache); |
| 274 ymd_from_time_cached_time = t | 274 ymd_from_time_cached_time = t |
| 275 } | 275 } |
| 276 | 276 |
| 277 return ymd_from_time_cache[0]; | 277 return ymd_from_time_cache[0]; |
| 278 } | 278 } |
| 279 | 279 |
| 280 function MonthFromTime(t) { | 280 function MonthFromTime(t) { |
| 281 if (t !== ymd_from_time_cached_time) { | 281 if (t !== ymd_from_time_cached_time) { |
| 282 // Limits according to ECMA 262 15.9.1.1 | 282 // Limits according to ECMA 262 15.9.1.1 |
| 283 if (!$isFinite(t) || t < -8640000000000000 || t > 8640000000000000) { | 283 if (!$isFinite(t) || t < -8640000000000000 || t > 8640000000000000) { |
| 284 return $NaN; | 284 return $NaN; |
| 285 } | 285 } |
| 286 %DateYMDFromTime(t, ymd_from_time_cache); | 286 %DateYMDFromTime(t, ymd_from_time_cache); |
| 287 ymd_from_time_cached_time = t | 287 ymd_from_time_cached_time = t |
| 288 } | 288 } |
| 289 | 289 |
| 290 return ymd_from_time_cache[1]; | 290 return ymd_from_time_cache[1]; |
| 291 } | 291 } |
| 292 | 292 |
| 293 function DateFromTime(t) { | 293 function DateFromTime(t) { |
| 294 if (t !== ymd_from_time_cached_time) { | 294 if (t !== ymd_from_time_cached_time) { |
| 295 // Limits according to ECMA 262 15.9.1.1 | 295 // Limits according to ECMA 262 15.9.1.1 |
| 296 if (!$isFinite(t) || t < -8640000000000000 || t > 8640000000000000) { | 296 if (!$isFinite(t) || t < -8640000000000000 || t > 8640000000000000) { |
| 297 return $NaN; | 297 return $NaN; |
| 298 } | 298 } |
| 299 | 299 |
| 300 %DateYMDFromTime(t, ymd_from_time_cache); | 300 %DateYMDFromTime(t, ymd_from_time_cache); |
| 301 ymd_from_time_cached_time = t | 301 ymd_from_time_cached_time = t |
| 302 } | 302 } |
| 303 | 303 |
| 304 return ymd_from_time_cache[2]; | 304 return ymd_from_time_cache[2]; |
| 305 } | 305 } |
| (...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1080 "toGMTString", DateToGMTString, | 1080 "toGMTString", DateToGMTString, |
| 1081 "toUTCString", DateToUTCString, | 1081 "toUTCString", DateToUTCString, |
| 1082 "getYear", DateGetYear, | 1082 "getYear", DateGetYear, |
| 1083 "setYear", DateSetYear, | 1083 "setYear", DateSetYear, |
| 1084 "toISOString", DateToISOString, | 1084 "toISOString", DateToISOString, |
| 1085 "toJSON", DateToJSON | 1085 "toJSON", DateToJSON |
| 1086 )); | 1086 )); |
| 1087 } | 1087 } |
| 1088 | 1088 |
| 1089 SetupDate(); | 1089 SetupDate(); |
| OLD | NEW |