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/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 21 matching lines...) Expand all Loading... |
32 HandleScope scope(isolate); | 32 HandleScope scope(isolate); |
33 DCHECK(args.length() == 3); | 33 DCHECK(args.length() == 3); |
34 | 34 |
35 CONVERT_ARG_HANDLE_CHECKED(JSDate, date, 0); | 35 CONVERT_ARG_HANDLE_CHECKED(JSDate, date, 0); |
36 CONVERT_DOUBLE_ARG_CHECKED(time, 1); | 36 CONVERT_DOUBLE_ARG_CHECKED(time, 1); |
37 CONVERT_SMI_ARG_CHECKED(is_utc, 2); | 37 CONVERT_SMI_ARG_CHECKED(is_utc, 2); |
38 | 38 |
39 DateCache* date_cache = isolate->date_cache(); | 39 DateCache* date_cache = isolate->date_cache(); |
40 | 40 |
41 Handle<Object> value; | 41 Handle<Object> value; |
42 ; | |
43 bool is_value_nan = false; | 42 bool is_value_nan = false; |
44 if (std::isnan(time)) { | 43 if (std::isnan(time)) { |
45 value = isolate->factory()->nan_value(); | 44 value = isolate->factory()->nan_value(); |
46 is_value_nan = true; | 45 is_value_nan = true; |
47 } else if (!is_utc && (time < -DateCache::kMaxTimeBeforeUTCInMs || | 46 } else if (!is_utc && (time < -DateCache::kMaxTimeBeforeUTCInMs || |
48 time > DateCache::kMaxTimeBeforeUTCInMs)) { | 47 time > DateCache::kMaxTimeBeforeUTCInMs)) { |
49 value = isolate->factory()->nan_value(); | 48 value = isolate->factory()->nan_value(); |
50 is_value_nan = true; | 49 is_value_nan = true; |
51 } else { | 50 } else { |
52 time = is_utc ? time : date_cache->ToUTC(static_cast<int64_t>(time)); | 51 time = is_utc ? time : date_cache->ToUTC(static_cast<int64_t>(time)); |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 DCHECK_EQ(2, args.length()); | 190 DCHECK_EQ(2, args.length()); |
192 CONVERT_ARG_CHECKED(JSDate, date, 0); | 191 CONVERT_ARG_CHECKED(JSDate, date, 0); |
193 CONVERT_SMI_ARG_CHECKED(index, 1); | 192 CONVERT_SMI_ARG_CHECKED(index, 1); |
194 DCHECK_LE(0, index); | 193 DCHECK_LE(0, index); |
195 if (index == 0) return date->value(); | 194 if (index == 0) return date->value(); |
196 return JSDate::GetField(date, Smi::FromInt(index)); | 195 return JSDate::GetField(date, Smi::FromInt(index)); |
197 } | 196 } |
198 | 197 |
199 } // namespace internal | 198 } // namespace internal |
200 } // namespace v8 | 199 } // namespace v8 |
OLD | NEW |