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

Side by Side Diff: src/date.js

Issue 2848038: Fix bug in date code where -0 was not mapped to 0. This caused the ... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
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/macros.py » ('j') | test/mjsunit/date.js » ('J')
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 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 340
341 // Compute number of days given a year, month, date. 341 // Compute number of days given a year, month, date.
342 // Note that month and date can lie outside the normal range. 342 // Note that month and date can lie outside the normal range.
343 // For example: 343 // For example:
344 // MakeDay(2007, -4, 20) --> MakeDay(2006, 8, 20) 344 // MakeDay(2007, -4, 20) --> MakeDay(2006, 8, 20)
345 // MakeDay(2007, -33, 1) --> MakeDay(2004, 3, 1) 345 // MakeDay(2007, -33, 1) --> MakeDay(2004, 3, 1)
346 // MakeDay(2007, 14, -50) --> MakeDay(2007, 8, 11) 346 // MakeDay(2007, 14, -50) --> MakeDay(2007, 8, 11)
347 function MakeDay(year, month, date) { 347 function MakeDay(year, month, date) {
348 if (!$isFinite(year) || !$isFinite(month) || !$isFinite(date)) return $NaN; 348 if (!$isFinite(year) || !$isFinite(month) || !$isFinite(date)) return $NaN;
349 349
350 year = TO_INTEGER(year); 350 // Convert to integer and map -0 to 0.
351 month = TO_INTEGER(month); 351 year = TO_INTEGER_MAP_MINUS_ZERO(year);
352 date = TO_INTEGER(date); 352 month = TO_INTEGER_MAP_MINUS_ZERO(month);
353 date = TO_INTEGER_MAP_MINUS_ZERO(date);
353 354
354 if (year < kMinYear || year > kMaxYear || 355 if (year < kMinYear || year > kMaxYear ||
355 month < kMinMonth || month > kMaxMonth || 356 month < kMinMonth || month > kMaxMonth ||
356 date < kMinDate || date > kMaxDate) { 357 date < kMinDate || date > kMaxDate) {
357 return $NaN; 358 return $NaN;
358 } 359 }
359 360
360 // Now we rely on year, month and date being SMIs. 361 // Now we rely on year, month and date being SMIs.
361 return %DateMakeDay(year, month, date); 362 return %DateMakeDay(year, month, date);
362 } 363 }
(...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after
1128 "toGMTString", DateToGMTString, 1129 "toGMTString", DateToGMTString,
1129 "toUTCString", DateToUTCString, 1130 "toUTCString", DateToUTCString,
1130 "getYear", DateGetYear, 1131 "getYear", DateGetYear,
1131 "setYear", DateSetYear, 1132 "setYear", DateSetYear,
1132 "toISOString", DateToISOString, 1133 "toISOString", DateToISOString,
1133 "toJSON", DateToJSON 1134 "toJSON", DateToJSON
1134 )); 1135 ));
1135 } 1136 }
1136 1137
1137 SetupDate(); 1138 SetupDate();
OLDNEW
« no previous file with comments | « no previous file | src/macros.py » ('j') | test/mjsunit/date.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698