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

Side by Side Diff: src/date.cc

Issue 1566973002: [date] Date parser says true even for wrong dates, check twice. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 11 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
« no previous file with comments | « src/builtins.cc ('k') | test/mjsunit/regress/regress-crbug-575082.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/date.h" 5 #include "src/date.h"
6 6
7 #include "src/objects.h" 7 #include "src/objects.h"
8 #include "src/objects-inl.h" 8 #include "src/objects-inl.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 *day = new_day; 64 *day = new_day;
65 return; 65 return;
66 } 66 }
67 } 67 }
68 int save_days = days; 68 int save_days = days;
69 69
70 days += kDaysOffset; 70 days += kDaysOffset;
71 *year = 400 * (days / kDaysIn400Years) - kYearsOffset; 71 *year = 400 * (days / kDaysIn400Years) - kYearsOffset;
72 days %= kDaysIn400Years; 72 days %= kDaysIn400Years;
73 73
74 DCHECK(DaysFromYearMonth(*year, 0) + days == save_days); 74 DCHECK_EQ(save_days, DaysFromYearMonth(*year, 0) + days);
75 75
76 days--; 76 days--;
77 int yd1 = days / kDaysIn100Years; 77 int yd1 = days / kDaysIn100Years;
78 days %= kDaysIn100Years; 78 days %= kDaysIn100Years;
79 *year += 100 * yd1; 79 *year += 100 * yd1;
80 80
81 days++; 81 days++;
82 int yd2 = days / kDaysIn4Years; 82 int yd2 = days / kDaysIn4Years;
83 days %= kDaysIn4Years; 83 days %= kDaysIn4Years;
84 *year += 4 * yd2; 84 *year += 4 * yd2;
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 if (result == NULL || result->last_used > dst_[i].last_used) { 366 if (result == NULL || result->last_used > dst_[i].last_used) {
367 result = &dst_[i]; 367 result = &dst_[i];
368 } 368 }
369 } 369 }
370 ClearSegment(result); 370 ClearSegment(result);
371 return result; 371 return result;
372 } 372 }
373 373
374 } // namespace internal 374 } // namespace internal
375 } // namespace v8 375 } // namespace v8
OLDNEW
« no previous file with comments | « src/builtins.cc ('k') | test/mjsunit/regress/regress-crbug-575082.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698