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

Side by Side Diff: src/runtime/runtime-date.cc

Issue 1415383004: Fixing --verify-predictable mode. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixed shared build Created 5 years, 1 month 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/isolate.cc ('k') | 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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/runtime/runtime-utils.h" 5 #include "src/runtime/runtime-utils.h"
6 6
7 #include "src/arguments.h" 7 #include "src/arguments.h"
8 #include "src/conversions-inl.h" 8 #include "src/conversions-inl.h"
9 #include "src/date.h" 9 #include "src/date.h"
10 #include "src/dateparser-inl.h" 10 #include "src/dateparser-inl.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 HandleScope scope(isolate); 81 HandleScope scope(isolate);
82 DCHECK(args.length() == 0); 82 DCHECK(args.length() == 0);
83 if (FLAG_log_timer_events || FLAG_prof_cpp) LOG(isolate, CurrentTimeEvent()); 83 if (FLAG_log_timer_events || FLAG_prof_cpp) LOG(isolate, CurrentTimeEvent());
84 84
85 // According to ECMA-262, section 15.9.1, page 117, the precision of 85 // According to ECMA-262, section 15.9.1, page 117, the precision of
86 // the number in a Date object representing a particular instant in 86 // the number in a Date object representing a particular instant in
87 // time is milliseconds. Therefore, we floor the result of getting 87 // time is milliseconds. Therefore, we floor the result of getting
88 // the OS time. 88 // the OS time.
89 double millis; 89 double millis;
90 if (FLAG_verify_predictable) { 90 if (FLAG_verify_predictable) {
91 millis = 1388534400000.0; // Jan 1 2014 00:00:00 GMT+0000 91 millis = Floor(isolate->heap()->MonotonicallyIncreasingTimeInMs());
92 millis += Floor(isolate->heap()->synthetic_time());
93 } else { 92 } else {
94 millis = Floor(base::OS::TimeCurrentMillis()); 93 millis = Floor(base::OS::TimeCurrentMillis());
95 } 94 }
96 return *isolate->factory()->NewNumber(millis); 95 return *isolate->factory()->NewNumber(millis);
97 } 96 }
98 97
99 98
100 RUNTIME_FUNCTION(Runtime_DateParseString) { 99 RUNTIME_FUNCTION(Runtime_DateParseString) {
101 HandleScope scope(isolate); 100 HandleScope scope(isolate);
102 DCHECK_EQ(2, args.length()); 101 DCHECK_EQ(2, args.length());
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 DCHECK_EQ(2, args.length()); 189 DCHECK_EQ(2, args.length());
191 CONVERT_ARG_CHECKED(JSDate, date, 0); 190 CONVERT_ARG_CHECKED(JSDate, date, 0);
192 CONVERT_SMI_ARG_CHECKED(index, 1); 191 CONVERT_SMI_ARG_CHECKED(index, 1);
193 DCHECK_LE(0, index); 192 DCHECK_LE(0, index);
194 if (index == 0) return date->value(); 193 if (index == 0) return date->value();
195 return JSDate::GetField(date, Smi::FromInt(index)); 194 return JSDate::GetField(date, Smi::FromInt(index));
196 } 195 }
197 196
198 } // namespace internal 197 } // namespace internal
199 } // namespace v8 198 } // namespace v8
OLDNEW
« no previous file with comments | « src/isolate.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698