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

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

Issue 968001: Remove unneeded date table from JS code. This table was moved to runtime.cc. (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 | no next file » | 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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 + TO_INTEGER(ms); 253 + TO_INTEGER(ms);
254 } 254 }
255 255
256 256
257 // ECMA 262 - 15.9.1.12 257 // ECMA 262 - 15.9.1.12
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 four_year_cycle_table = CalculateDateTable();
264
265
266 function CalculateDateTable() {
267 var month_lengths = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
268 var four_year_cycle_table = new $Array(1461);
269
270 var cumulative = 0;
271 var position = 0;
272 var leap_position = 0;
273 for (var month = 0; month < 12; month++) {
274 var month_bits = month << kMonthShift;
275 var length = month_lengths[month];
276 for (var day = 1; day <= length; day++) {
277 four_year_cycle_table[leap_position] =
278 month_bits + day;
279 four_year_cycle_table[366 + position] =
280 (1 << kYearShift) + month_bits + day;
281 four_year_cycle_table[731 + position] =
282 (2 << kYearShift) + month_bits + day;
283 four_year_cycle_table[1096 + position] =
284 (3 << kYearShift) + month_bits + day;
285 leap_position++;
286 position++;
287 }
288 if (month == 1) {
289 four_year_cycle_table[leap_position++] = month_bits + 29;
290 }
291 }
292 return four_year_cycle_table;
293 }
294
295
296 var ymd_from_time_cache = [$NaN, $NaN, $NaN]; 263 var ymd_from_time_cache = [$NaN, $NaN, $NaN];
297 var ymd_from_time_cached_time = $NaN; 264 var ymd_from_time_cached_time = $NaN;
298 265
299 function YearFromTime(t) { 266 function YearFromTime(t) {
300 if (t !== ymd_from_time_cached_time) { 267 if (t !== ymd_from_time_cached_time) {
301 // Limits according to ECMA 262 15.9.1.1 268 // Limits according to ECMA 262 15.9.1.1
302 if (!$isFinite(t) || t < -8640000000000000 || t > 8640000000000000) { 269 if (!$isFinite(t) || t < -8640000000000000 || t > 8640000000000000) {
303 return $NaN; 270 return $NaN;
304 } 271 }
305 272
(...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after
1113 "toGMTString", DateToGMTString, 1080 "toGMTString", DateToGMTString,
1114 "toUTCString", DateToUTCString, 1081 "toUTCString", DateToUTCString,
1115 "getYear", DateGetYear, 1082 "getYear", DateGetYear,
1116 "setYear", DateSetYear, 1083 "setYear", DateSetYear,
1117 "toISOString", DateToISOString, 1084 "toISOString", DateToISOString,
1118 "toJSON", DateToJSON 1085 "toJSON", DateToJSON
1119 )); 1086 ));
1120 } 1087 }
1121 1088
1122 SetupDate(); 1089 SetupDate();
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698