diff options
Diffstat (limited to 'deps/v8/src/date')
-rw-r--r-- | deps/v8/src/date/dateparser-inl.h | 3 | ||||
-rw-r--r-- | deps/v8/src/date/dateparser.cc | 24 | ||||
-rw-r--r-- | deps/v8/src/date/dateparser.h | 32 |
3 files changed, 29 insertions, 30 deletions
diff --git a/deps/v8/src/date/dateparser-inl.h b/deps/v8/src/date/dateparser-inl.h index b2099ca88d..436b144478 100644 --- a/deps/v8/src/date/dateparser-inl.h +++ b/deps/v8/src/date/dateparser-inl.h @@ -13,8 +13,7 @@ namespace v8 { namespace internal { template <typename Char> -bool DateParser::Parse(Isolate* isolate, Vector<Char> str, FixedArray out) { - DCHECK(out.length() >= OUTPUT_SIZE); +bool DateParser::Parse(Isolate* isolate, Vector<Char> str, double* out) { InputReader<Char> in(str); DateStringTokenizer<Char> scanner(&in); TimeZoneComposer tz; diff --git a/deps/v8/src/date/dateparser.cc b/deps/v8/src/date/dateparser.cc index 252fe54e5b..f7ea4c726c 100644 --- a/deps/v8/src/date/dateparser.cc +++ b/deps/v8/src/date/dateparser.cc @@ -10,7 +10,7 @@ namespace v8 { namespace internal { -bool DateParser::DayComposer::Write(FixedArray output) { +bool DateParser::DayComposer::Write(double* output) { if (index_ < 1) return false; // Day and month defaults to 1. while (index_ < kSize) { @@ -58,13 +58,13 @@ bool DateParser::DayComposer::Write(FixedArray output) { if (!Smi::IsValid(year) || !IsMonth(month) || !IsDay(day)) return false; - output.set(YEAR, Smi::FromInt(year)); - output.set(MONTH, Smi::FromInt(month - 1)); // 0-based - output.set(DAY, Smi::FromInt(day)); + output[YEAR] = year; + output[MONTH] = month - 1; // 0-based + output[DAY] = day; return true; } -bool DateParser::TimeComposer::Write(FixedArray output) { +bool DateParser::TimeComposer::Write(double* output) { // All time slots default to 0 while (index_ < kSize) { comp_[index_++] = 0; @@ -89,14 +89,14 @@ bool DateParser::TimeComposer::Write(FixedArray output) { } } - output.set(HOUR, Smi::FromInt(hour)); - output.set(MINUTE, Smi::FromInt(minute)); - output.set(SECOND, Smi::FromInt(second)); - output.set(MILLISECOND, Smi::FromInt(millisecond)); + output[HOUR] = hour; + output[MINUTE] = minute; + output[SECOND] = second; + output[MILLISECOND] = millisecond; return true; } -bool DateParser::TimeZoneComposer::Write(FixedArray output) { +bool DateParser::TimeZoneComposer::Write(double* output) { if (sign_ != kNone) { if (hour_ == kNone) hour_ = 0; if (minute_ == kNone) minute_ = 0; @@ -109,9 +109,9 @@ bool DateParser::TimeZoneComposer::Write(FixedArray output) { total_seconds = -total_seconds; } DCHECK(Smi::IsValid(total_seconds)); - output.set(UTC_OFFSET, Smi::FromInt(total_seconds)); + output[UTC_OFFSET] = total_seconds; } else { - output.set_null(UTC_OFFSET); + output[UTC_OFFSET] = std::numeric_limits<double>::quiet_NaN(); } return true; } diff --git a/deps/v8/src/date/dateparser.h b/deps/v8/src/date/dateparser.h index ac6be47692..a32db8f9c8 100644 --- a/deps/v8/src/date/dateparser.h +++ b/deps/v8/src/date/dateparser.h @@ -13,6 +13,18 @@ namespace internal { class DateParser : public AllStatic { public: + enum { + YEAR, + MONTH, + DAY, + HOUR, + MINUTE, + SECOND, + MILLISECOND, + UTC_OFFSET, + OUTPUT_SIZE + }; + // Parse the string as a date. If parsing succeeds, return true after // filling out the output array as follows (all integers are Smis): // [0]: year @@ -25,19 +37,7 @@ class DateParser : public AllStatic { // [7]: UTC offset in seconds, or null value if no timezone specified // If parsing fails, return false (content of output array is not defined). template <typename Char> - static bool Parse(Isolate* isolate, Vector<Char> str, FixedArray output); - - enum { - YEAR, - MONTH, - DAY, - HOUR, - MINUTE, - SECOND, - MILLISECOND, - UTC_OFFSET, - OUTPUT_SIZE - }; + static bool Parse(Isolate* isolate, Vector<Char> str, double* output); private: // Range testing @@ -274,7 +274,7 @@ class DateParser : public AllStatic { return hour_ != kNone && minute_ == kNone && TimeComposer::IsMinute(n); } bool IsUTC() const { return hour_ == 0 && minute_ == 0; } - bool Write(FixedArray output); + bool Write(double* output); bool IsEmpty() { return hour_ == kNone; } private: @@ -300,7 +300,7 @@ class DateParser : public AllStatic { return true; } void SetHourOffset(int n) { hour_offset_ = n; } - bool Write(FixedArray output); + bool Write(double* output); static bool IsMinute(int x) { return Between(x, 0, 59); } static bool IsHour(int x) { return Between(x, 0, 23); } @@ -329,7 +329,7 @@ class DateParser : public AllStatic { return false; } void SetNamedMonth(int n) { named_month_ = n; } - bool Write(FixedArray output); + bool Write(double* output); void set_iso_date() { is_iso_date_ = true; } static bool IsMonth(int x) { return Between(x, 1, 12); } static bool IsDay(int x) { return Between(x, 1, 31); } |