OLD | NEW |
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/builtins.h" | 5 #include "src/builtins.h" |
6 | 6 |
7 #include "src/api.h" | 7 #include "src/api.h" |
8 #include "src/api-natives.h" | 8 #include "src/api-natives.h" |
9 #include "src/arguments.h" | 9 #include "src/arguments.h" |
10 #include "src/base/once.h" | 10 #include "src/base/once.h" |
(...skipping 2078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2089 result = DateParser::Parse(str_content.ToUC16Vector(), *tmp, | 2089 result = DateParser::Parse(str_content.ToUC16Vector(), *tmp, |
2090 isolate->unicode_cache()); | 2090 isolate->unicode_cache()); |
2091 } | 2091 } |
2092 if (!result) return std::numeric_limits<double>::quiet_NaN(); | 2092 if (!result) return std::numeric_limits<double>::quiet_NaN(); |
2093 double const day = MakeDay(tmp->get(0)->Number(), tmp->get(1)->Number(), | 2093 double const day = MakeDay(tmp->get(0)->Number(), tmp->get(1)->Number(), |
2094 tmp->get(2)->Number()); | 2094 tmp->get(2)->Number()); |
2095 double const time = MakeTime(tmp->get(3)->Number(), tmp->get(4)->Number(), | 2095 double const time = MakeTime(tmp->get(3)->Number(), tmp->get(4)->Number(), |
2096 tmp->get(5)->Number(), tmp->get(6)->Number()); | 2096 tmp->get(5)->Number(), tmp->get(6)->Number()); |
2097 double date = MakeDate(day, time); | 2097 double date = MakeDate(day, time); |
2098 if (tmp->get(7)->IsNull()) { | 2098 if (tmp->get(7)->IsNull()) { |
2099 date = isolate->date_cache()->ToUTC(static_cast<int64_t>(date)); | 2099 if (!std::isnan(date)) { |
| 2100 date = isolate->date_cache()->ToUTC(static_cast<int64_t>(date)); |
| 2101 } |
2100 } else { | 2102 } else { |
2101 date -= tmp->get(7)->Number() * 1000.0; | 2103 date -= tmp->get(7)->Number() * 1000.0; |
2102 } | 2104 } |
2103 return date; | 2105 return date; |
2104 } | 2106 } |
2105 | 2107 |
2106 | 2108 |
2107 // ES6 section 20.3.4.41.1 ToDateString(tv) | 2109 // ES6 section 20.3.4.41.1 ToDateString(tv) |
2108 void ToDateString(double time_val, Vector<char> str, DateCache* date_cache) { | 2110 void ToDateString(double time_val, Vector<char> str, DateCache* date_cache) { |
2109 if (std::isnan(time_val)) { | 2111 if (std::isnan(time_val)) { |
(...skipping 1199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3309 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) | 3311 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) |
3310 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) | 3312 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) |
3311 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) | 3313 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) |
3312 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 3314 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
3313 #undef DEFINE_BUILTIN_ACCESSOR_C | 3315 #undef DEFINE_BUILTIN_ACCESSOR_C |
3314 #undef DEFINE_BUILTIN_ACCESSOR_A | 3316 #undef DEFINE_BUILTIN_ACCESSOR_A |
3315 | 3317 |
3316 | 3318 |
3317 } // namespace internal | 3319 } // namespace internal |
3318 } // namespace v8 | 3320 } // namespace v8 |
OLD | NEW |