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

Side by Side Diff: src/date.js

Issue 2992001: Merge fixes for issue 736 and 764 to 2.1 branch for Chrome 5. (Closed) Base URL: http://v8.googlecode.com/svn/branches/2.1/
Patch Set: Created 10 years, 5 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/json.js » ('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 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 331
332 // Compute number of days given a year, month, date. 332 // Compute number of days given a year, month, date.
333 // Note that month and date can lie outside the normal range. 333 // Note that month and date can lie outside the normal range.
334 // For example: 334 // For example:
335 // MakeDay(2007, -4, 20) --> MakeDay(2006, 8, 20) 335 // MakeDay(2007, -4, 20) --> MakeDay(2006, 8, 20)
336 // MakeDay(2007, -33, 1) --> MakeDay(2004, 3, 1) 336 // MakeDay(2007, -33, 1) --> MakeDay(2004, 3, 1)
337 // MakeDay(2007, 14, -50) --> MakeDay(2007, 8, 11) 337 // MakeDay(2007, 14, -50) --> MakeDay(2007, 8, 11)
338 function MakeDay(year, month, date) { 338 function MakeDay(year, month, date) {
339 if (!$isFinite(year) || !$isFinite(month) || !$isFinite(date)) return $NaN; 339 if (!$isFinite(year) || !$isFinite(month) || !$isFinite(date)) return $NaN;
340 340
341 year = TO_INTEGER(year); 341 // Convert to integer and map -0 to 0.
342 month = TO_INTEGER(month); 342 year = TO_INTEGER_MAP_MINUS_ZERO(year);
343 date = TO_INTEGER(date); 343 month = TO_INTEGER_MAP_MINUS_ZERO(month);
344 date = TO_INTEGER_MAP_MINUS_ZERO(date);
344 345
345 if (year < kMinYear || year > kMaxYear || 346 if (year < kMinYear || year > kMaxYear ||
346 month < kMinMonth || month > kMaxMonth || 347 month < kMinMonth || month > kMaxMonth ||
347 date < kMinDate || date > kMaxDate) { 348 date < kMinDate || date > kMaxDate) {
348 return $NaN; 349 return $NaN;
349 } 350 }
350 351
351 // Now we rely on year, month and date being SMIs. 352 // Now we rely on year, month and date being SMIs.
352 return %DateMakeDay(year, month, date); 353 return %DateMakeDay(year, month, date);
353 } 354 }
(...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after
1104 "toGMTString", DateToGMTString, 1105 "toGMTString", DateToGMTString,
1105 "toUTCString", DateToUTCString, 1106 "toUTCString", DateToUTCString,
1106 "getYear", DateGetYear, 1107 "getYear", DateGetYear,
1107 "setYear", DateSetYear, 1108 "setYear", DateSetYear,
1108 "toISOString", DateToISOString, 1109 "toISOString", DateToISOString,
1109 "toJSON", DateToJSON 1110 "toJSON", DateToJSON
1110 )); 1111 ));
1111 } 1112 }
1112 1113
1113 SetupDate(); 1114 SetupDate();
OLDNEW
« no previous file with comments | « no previous file | src/json.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698