Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: src/date-delay.js

Issue 660375: Revert change to EquivalentTime in date.js. The checks that I've removed in t... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/runtime.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 function EquivalentTime(t) { 107 function EquivalentTime(t) {
108 // The issue here is that some library calls don't work right for dates 108 // The issue here is that some library calls don't work right for dates
109 // that cannot be represented using a non-negative signed 32 bit integer 109 // that cannot be represented using a non-negative signed 32 bit integer
110 // (measured in whole seconds based on the 1970 epoch). 110 // (measured in whole seconds based on the 1970 epoch).
111 // We solve this by mapping the time to a year with same leap-year-ness 111 // We solve this by mapping the time to a year with same leap-year-ness
112 // and same starting day for the year. The ECMAscript specification says 112 // and same starting day for the year. The ECMAscript specification says
113 // we must do this, but for compatibility with other browsers, we use 113 // we must do this, but for compatibility with other browsers, we use
114 // the actual year if it is in the range 1970..2037 114 // the actual year if it is in the range 1970..2037
115 if (t >= 0 && t <= 2.1e12) return t; 115 if (t >= 0 && t <= 2.1e12) return t;
116 116
117 // We call the function from runtime.cc directly to avoid extra checks which 117 var day = MakeDay(EquivalentYear(YEAR_FROM_TIME(t)),
118 // are unneeded. 118 MONTH_FROM_TIME(t),
119 var day = %DateMakeDay(EquivalentYear(YEAR_FROM_TIME(t)), 119 DATE_FROM_TIME(t));
120 MONTH_FROM_TIME(t),
121 DATE_FROM_TIME(t));
122 return MakeDate(day, TimeWithinDay(t)); 120 return MakeDate(day, TimeWithinDay(t));
123 } 121 }
124 122
125 123
126 // Because computing the DST offset is a pretty expensive operation 124 // Because computing the DST offset is a pretty expensive operation
127 // we keep a cache of last computed offset along with a time interval 125 // we keep a cache of last computed offset along with a time interval
128 // where we know the cache is valid. 126 // where we know the cache is valid.
129 var DST_offset_cache = { 127 var DST_offset_cache = {
130 // Cached DST offset. 128 // Cached DST offset.
131 offset: 0, 129 offset: 0,
(...skipping 992 matching lines...) Expand 10 before | Expand all | Expand 10 after
1124 "toGMTString", DateToGMTString, 1122 "toGMTString", DateToGMTString,
1125 "toUTCString", DateToUTCString, 1123 "toUTCString", DateToUTCString,
1126 "getYear", DateGetYear, 1124 "getYear", DateGetYear,
1127 "setYear", DateSetYear, 1125 "setYear", DateSetYear,
1128 "toISOString", DateToISOString, 1126 "toISOString", DateToISOString,
1129 "toJSON", DateToJSON 1127 "toJSON", DateToJSON
1130 )); 1128 ));
1131 } 1129 }
1132 1130
1133 SetupDate(); 1131 SetupDate();
OLDNEW
« no previous file with comments | « no previous file | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698