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

Side by Side Diff: src/date.h

Issue 1545883003: Fix 'illegal access' in Date constructor edge case (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Switch back to the original JS limit, which is now vindicated, with additional tests Created 4 years, 12 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 | « no previous file | test/mjsunit/regress/regress-4640.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 #ifndef V8_DATE_H_ 5 #ifndef V8_DATE_H_
6 #define V8_DATE_H_ 6 #define V8_DATE_H_
7 7
8 #include "src/allocation.h" 8 #include "src/allocation.h"
9 #include "src/base/platform/platform.h" 9 #include "src/base/platform/platform.h"
10 #include "src/globals.h" 10 #include "src/globals.h"
11 11
12 12
13 namespace v8 { 13 namespace v8 {
14 namespace internal { 14 namespace internal {
15 15
16 class DateCache { 16 class DateCache {
17 public: 17 public:
18 static const int kMsPerMin = 60 * 1000; 18 static const int kMsPerMin = 60 * 1000;
19 static const int kSecPerDay = 24 * 60 * 60; 19 static const int kSecPerDay = 24 * 60 * 60;
20 static const int64_t kMsPerDay = kSecPerDay * 1000; 20 static const int64_t kMsPerDay = kSecPerDay * 1000;
21 static const int64_t kMsPerMonth = kMsPerDay * 30;
21 22
22 // The largest time that can be passed to OS date-time library functions. 23 // The largest time that can be passed to OS date-time library functions.
23 static const int kMaxEpochTimeInSec = kMaxInt; 24 static const int kMaxEpochTimeInSec = kMaxInt;
24 static const int64_t kMaxEpochTimeInMs = 25 static const int64_t kMaxEpochTimeInMs =
25 static_cast<int64_t>(kMaxInt) * 1000; 26 static_cast<int64_t>(kMaxInt) * 1000;
26 27
27 // The largest time that can be stored in JSDate. 28 // The largest time that can be stored in JSDate.
28 static const int64_t kMaxTimeInMs = 29 static const int64_t kMaxTimeInMs =
29 static_cast<int64_t>(864000000) * 10000000; 30 static_cast<int64_t>(864000000) * 10000000;
30 31
31 // Conservative upper bound on time that can be stored in JSDate 32 // Conservative upper bound on time that can be stored in JSDate
32 // before UTC conversion. 33 // before UTC conversion.
33 static const int64_t kMaxTimeBeforeUTCInMs = 34 static const int64_t kMaxTimeBeforeUTCInMs = kMaxTimeInMs + kMsPerMonth;
34 kMaxTimeInMs + 10 * kMsPerDay;
35 35
36 // Sentinel that denotes an invalid local offset. 36 // Sentinel that denotes an invalid local offset.
37 static const int kInvalidLocalOffsetInMs = kMaxInt; 37 static const int kInvalidLocalOffsetInMs = kMaxInt;
38 // Sentinel that denotes an invalid cache stamp. 38 // Sentinel that denotes an invalid cache stamp.
39 // It is an invariant of DateCache that cache stamp is non-negative. 39 // It is an invariant of DateCache that cache stamp is non-negative.
40 static const int kInvalidStamp = -1; 40 static const int kInvalidStamp = -1;
41 41
42 DateCache() : stamp_(0), tz_cache_(base::OS::CreateTimezoneCache()) { 42 DateCache() : stamp_(0), tz_cache_(base::OS::CreateTimezoneCache()) {
43 ResetDateCache(); 43 ResetDateCache();
44 } 44 }
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 int ymd_month_; 273 int ymd_month_;
274 int ymd_day_; 274 int ymd_day_;
275 275
276 base::TimezoneCache* tz_cache_; 276 base::TimezoneCache* tz_cache_;
277 }; 277 };
278 278
279 } // namespace internal 279 } // namespace internal
280 } // namespace v8 280 } // namespace v8
281 281
282 #endif 282 #endif
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-4640.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698