From ec58ea62e85a3a2cbecfaf4679818eb008568d70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Tue, 5 Jun 2018 11:08:12 +0200 Subject: [PATCH] deps: patch V8 to 6.7.288.44 Refs: https://github.com/v8/v8/compare/6.7.288.43...6.7.288.44 PR-URL: https://github.com/nodejs/node/pull/21146 Reviewed-By: Ben Noordhuis Reviewed-By: Colin Ihrig --- deps/v8/include/v8-version.h | 2 +- deps/v8/src/builtins/builtins-date.cc | 2 ++ deps/v8/src/intl.cc | 14 +++++++------- deps/v8/src/intl.h | 7 ++++--- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/deps/v8/include/v8-version.h b/deps/v8/include/v8-version.h index f871c8fa676968..ed513b5b80d74a 100644 --- a/deps/v8/include/v8-version.h +++ b/deps/v8/include/v8-version.h @@ -11,7 +11,7 @@ #define V8_MAJOR_VERSION 6 #define V8_MINOR_VERSION 7 #define V8_BUILD_NUMBER 288 -#define V8_PATCH_LEVEL 43 +#define V8_PATCH_LEVEL 44 // Use 1 for candidates and 0 otherwise. // (Boolean macro values are not supported by all preprocessors.) diff --git a/deps/v8/src/builtins/builtins-date.cc b/deps/v8/src/builtins/builtins-date.cc index c60275d94eafee..73c7098c06be6c 100644 --- a/deps/v8/src/builtins/builtins-date.cc +++ b/deps/v8/src/builtins/builtins-date.cc @@ -166,11 +166,13 @@ void ToDateString(double time_val, Vector str, DateCache* date_cache, kShortMonths[month], day, year); return; case kTimeOnly: + // TODO(842085): str may be silently truncated. SNPrintF(str, "%02d:%02d:%02d GMT%c%02d%02d (%s)", hour, min, sec, (timezone_offset < 0) ? '-' : '+', timezone_hour, timezone_min, local_timezone); return; case kDateAndTime: + // TODO(842085): str may be silently truncated. SNPrintF(str, "%s %s %02d %04d %02d:%02d:%02d GMT%c%02d%02d (%s)", kShortWeekDays[weekday], kShortMonths[month], day, year, hour, min, sec, (timezone_offset < 0) ? '-' : '+', timezone_hour, diff --git a/deps/v8/src/intl.cc b/deps/v8/src/intl.cc index 5c2cb4e8fe1e4f..139bb4daf549ea 100644 --- a/deps/v8/src/intl.cc +++ b/deps/v8/src/intl.cc @@ -358,17 +358,17 @@ ICUTimezoneCache::~ICUTimezoneCache() { Clear(); } const char* ICUTimezoneCache::LocalTimezone(double time_ms) { bool is_dst = DaylightSavingsOffset(time_ms) != 0; - char* name = is_dst ? dst_timezone_name_ : timezone_name_; - if (name[0] == '\0') { + std::string* name = is_dst ? &dst_timezone_name_ : &timezone_name_; + if (name->empty()) { icu::UnicodeString result; GetTimeZone()->getDisplayName(is_dst, icu::TimeZone::LONG, result); result += '\0'; - icu::CheckedArrayByteSink byte_sink(name, kMaxTimezoneChars); + icu::StringByteSink byte_sink(name); result.toUTF8(byte_sink); - CHECK(!byte_sink.Overflowed()); } - return const_cast(name); + DCHECK(!name->empty()); + return name->c_str(); } icu::TimeZone* ICUTimezoneCache::GetTimeZone() { @@ -418,8 +418,8 @@ double ICUTimezoneCache::LocalTimeOffset(double time_ms, bool is_utc) { void ICUTimezoneCache::Clear() { delete timezone_; timezone_ = nullptr; - timezone_name_[0] = '\0'; - dst_timezone_name_[0] = '\0'; + timezone_name_.clear(); + dst_timezone_name_.clear(); } } // namespace internal diff --git a/deps/v8/src/intl.h b/deps/v8/src/intl.h index 967a3e927773c2..627cb4980de76e 100644 --- a/deps/v8/src/intl.h +++ b/deps/v8/src/intl.h @@ -9,6 +9,8 @@ #ifndef V8_INTL_H_ #define V8_INTL_H_ +#include + #include "src/base/timezone-cache.h" #include "src/objects.h" #include "src/objects/string.h" @@ -64,9 +66,8 @@ class ICUTimezoneCache : public base::TimezoneCache { icu::TimeZone* timezone_; - static const int32_t kMaxTimezoneChars = 100; - char timezone_name_[kMaxTimezoneChars]; - char dst_timezone_name_[kMaxTimezoneChars]; + std::string timezone_name_; + std::string dst_timezone_name_; }; } // namespace internal