OLD | NEW |
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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/arguments.h" | 7 #include "src/arguments.h" |
8 #include "src/date.h" | 8 #include "src/date.h" |
9 #include "src/dateparser-inl.h" | 9 #include "src/dateparser-inl.h" |
10 #include "src/runtime/runtime-utils.h" | 10 #include "src/runtime/runtime-utils.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 HandleScope scope(isolate); | 63 HandleScope scope(isolate); |
64 DCHECK(args.length() == 0); | 64 DCHECK(args.length() == 0); |
65 THROW_NEW_ERROR_RETURN_FAILURE( | 65 THROW_NEW_ERROR_RETURN_FAILURE( |
66 isolate, NewTypeError("not_date_object", HandleVector<Object>(NULL, 0))); | 66 isolate, NewTypeError("not_date_object", HandleVector<Object>(NULL, 0))); |
67 } | 67 } |
68 | 68 |
69 | 69 |
70 RUNTIME_FUNCTION(Runtime_DateCurrentTime) { | 70 RUNTIME_FUNCTION(Runtime_DateCurrentTime) { |
71 HandleScope scope(isolate); | 71 HandleScope scope(isolate); |
72 DCHECK(args.length() == 0); | 72 DCHECK(args.length() == 0); |
73 if (FLAG_log_timer_events) LOG(isolate, CurrentTimeEvent()); | 73 if (FLAG_log_timer_events || FLAG_prof_cpp) LOG(isolate, CurrentTimeEvent()); |
74 | 74 |
75 // According to ECMA-262, section 15.9.1, page 117, the precision of | 75 // According to ECMA-262, section 15.9.1, page 117, the precision of |
76 // the number in a Date object representing a particular instant in | 76 // the number in a Date object representing a particular instant in |
77 // time is milliseconds. Therefore, we floor the result of getting | 77 // time is milliseconds. Therefore, we floor the result of getting |
78 // the OS time. | 78 // the OS time. |
79 double millis; | 79 double millis; |
80 if (FLAG_verify_predictable) { | 80 if (FLAG_verify_predictable) { |
81 millis = 1388534400000.0; // Jan 1 2014 00:00:00 GMT+0000 | 81 millis = 1388534400000.0; // Jan 1 2014 00:00:00 GMT+0000 |
82 millis += Floor(isolate->heap()->synthetic_time()); | 82 millis += Floor(isolate->heap()->synthetic_time()); |
83 } else { | 83 } else { |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 THROW_NEW_ERROR_RETURN_FAILURE( | 180 THROW_NEW_ERROR_RETURN_FAILURE( |
181 isolate, | 181 isolate, |
182 NewTypeError("not_date_object", HandleVector<Object>(NULL, 0))); | 182 NewTypeError("not_date_object", HandleVector<Object>(NULL, 0))); |
183 } | 183 } |
184 JSDate* date = JSDate::cast(obj); | 184 JSDate* date = JSDate::cast(obj); |
185 if (index == 0) return date->value(); | 185 if (index == 0) return date->value(); |
186 return JSDate::GetField(date, Smi::FromInt(index)); | 186 return JSDate::GetField(date, Smi::FromInt(index)); |
187 } | 187 } |
188 } | 188 } |
189 } // namespace v8::internal | 189 } // namespace v8::internal |
OLD | NEW |