| 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 24 matching lines...) Expand all Loading... |
| 35 | 35 |
| 36 // This file contains date support implemented in JavaScript. | 36 // This file contains date support implemented in JavaScript. |
| 37 | 37 |
| 38 // Helper function to throw error. | 38 // Helper function to throw error. |
| 39 function ThrowDateTypeError() { | 39 function ThrowDateTypeError() { |
| 40 throw new $TypeError('this is not a Date object.'); | 40 throw new $TypeError('this is not a Date object.'); |
| 41 } | 41 } |
| 42 | 42 |
| 43 | 43 |
| 44 var timezone_cache_time = NAN; | 44 var timezone_cache_time = NAN; |
| 45 var timezone_cache_timezone_offset = NAN; |
| 45 var timezone_cache_timezone; | 46 var timezone_cache_timezone; |
| 46 | 47 |
| 47 function LocalTimezone(t) { | 48 function LocalTimezone(t) { |
| 48 if (NUMBER_IS_NAN(t)) return ""; | 49 if (NUMBER_IS_NAN(t)) return ""; |
| 49 if (t == timezone_cache_time) { | 50 if (t == timezone_cache_time && |
| 51 TIMEZONE_OFFSET(t) = timezone_cache_timezone_offset) { |
| 50 return timezone_cache_timezone; | 52 return timezone_cache_timezone; |
| 51 } | 53 } |
| 52 var timezone = %DateLocalTimezone(t); | 54 var timezone = %DateLocalTimezone(t); |
| 53 timezone_cache_time = t; | 55 timezone_cache_time = t; |
| 54 timezone_cache_timezone = timezone; | 56 timezone_cache_timezone = timezone; |
| 57 timezone_cache_timezone_offset = TIMEZONE_OFFSET(t); |
| 55 return timezone; | 58 return timezone; |
| 56 } | 59 } |
| 57 | 60 |
| 58 | 61 |
| 59 function UTC(time) { | 62 function UTC(time) { |
| 60 if (NUMBER_IS_NAN(time)) return time; | 63 if (NUMBER_IS_NAN(time)) return time; |
| 61 // local_time_offset is needed before the call to DaylightSavingsOffset, | 64 // local_time_offset is needed before the call to DaylightSavingsOffset, |
| 62 // so it may be uninitialized. | 65 // so it may be uninitialized. |
| 63 return %DateToUTC(time); | 66 return %DateToUTC(time); |
| 64 } | 67 } |
| (...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 819 "toGMTString", DateToGMTString, | 822 "toGMTString", DateToGMTString, |
| 820 "toUTCString", DateToUTCString, | 823 "toUTCString", DateToUTCString, |
| 821 "getYear", DateGetYear, | 824 "getYear", DateGetYear, |
| 822 "setYear", DateSetYear, | 825 "setYear", DateSetYear, |
| 823 "toISOString", DateToISOString, | 826 "toISOString", DateToISOString, |
| 824 "toJSON", DateToJSON | 827 "toJSON", DateToJSON |
| 825 )); | 828 )); |
| 826 } | 829 } |
| 827 | 830 |
| 828 SetUpDate(); | 831 SetUpDate(); |
| OLD | NEW |