Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/v14.x-staging' into v14.x-staging
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasmichaelwallace committed Jul 11, 2021
2 parents 3e269f2 + 752817c commit 8b2bb24
Show file tree
Hide file tree
Showing 18 changed files with 196 additions and 52 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ release.
</tr>
<tr>
<td valign="top">
<b><a href="doc/changelogs/CHANGELOG_V14.md#14.17.1">14.17.1</a></b><br/>
<b><a href="doc/changelogs/CHANGELOG_V14.md#14.17.3">14.17.3</a></b><br/>
<a href="doc/changelogs/CHANGELOG_V14.md#14.17.2">14.17.2</a><br/>
<a href="doc/changelogs/CHANGELOG_V14.md#14.17.1">14.17.1</a><br/>
<a href="doc/changelogs/CHANGELOG_V14.md#14.17.0">14.17.0</a><br/>
<a href="doc/changelogs/CHANGELOG_V14.md#14.16.1">14.16.1</a><br/>
<a href="doc/changelogs/CHANGELOG_V14.md#14.16.0">14.16.0</a><br/>
Expand Down
2 changes: 1 addition & 1 deletion common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

# Reset this number to 0 on major V8 upgrades.
# Increment by one for each non-official patch applied to deps/v8.
'v8_embedder_string': '-node.68',
'v8_embedder_string': '-node.73',

##### V8 defaults for Node.js #####

Expand Down
49 changes: 36 additions & 13 deletions deps/uv/src/idna.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

#include "uv.h"
#include "idna.h"
#include <assert.h>
#include <string.h>

static unsigned uv__utf8_decode1_slow(const char** p,
Expand All @@ -32,7 +33,7 @@ static unsigned uv__utf8_decode1_slow(const char** p,
if (a > 0xF7)
return -1;

switch (*p - pe) {
switch (pe - *p) {
default:
if (a > 0xEF) {
min = 0x10000;
Expand Down Expand Up @@ -62,6 +63,8 @@ static unsigned uv__utf8_decode1_slow(const char** p,
a = 0;
break;
}
/* Fall through. */
case 0:
return -1; /* Invalid continuation byte. */
}

Expand All @@ -88,6 +91,8 @@ static unsigned uv__utf8_decode1_slow(const char** p,
unsigned uv__utf8_decode1(const char** p, const char* pe) {
unsigned a;

assert(*p < pe);

a = (unsigned char) *(*p)++;

if (a < 128)
Expand All @@ -96,9 +101,6 @@ unsigned uv__utf8_decode1(const char** p, const char* pe) {
return uv__utf8_decode1_slow(p, pe, a);
}

#define foreach_codepoint(c, p, pe) \
for (; (void) (*p <= pe && (c = uv__utf8_decode1(p, pe))), *p <= pe;)

static int uv__idna_toascii_label(const char* s, const char* se,
char** d, char* de) {
static const char alphabet[] = "abcdefghijklmnopqrstuvwxyz0123456789";
Expand All @@ -121,25 +123,36 @@ static int uv__idna_toascii_label(const char* s, const char* se,
ss = s;
todo = 0;

foreach_codepoint(c, &s, se) {
/* Note: after this loop we've visited all UTF-8 characters and know
* they're legal so we no longer need to check for decode errors.
*/
while (s < se) {
c = uv__utf8_decode1(&s, se);

if (c == -1u)
return UV_EINVAL;

if (c < 128)
h++;
else if (c == (unsigned) -1)
return UV_EINVAL;
else
todo++;
}

/* Only write "xn--" when there are non-ASCII characters. */
if (todo > 0) {
if (*d < de) *(*d)++ = 'x';
if (*d < de) *(*d)++ = 'n';
if (*d < de) *(*d)++ = '-';
if (*d < de) *(*d)++ = '-';
}

/* Write ASCII characters. */
x = 0;
s = ss;
foreach_codepoint(c, &s, se) {
while (s < se) {
c = uv__utf8_decode1(&s, se);
assert(c != -1u);

if (c > 127)
continue;

Expand All @@ -166,10 +179,15 @@ static int uv__idna_toascii_label(const char* s, const char* se,
while (todo > 0) {
m = -1;
s = ss;
foreach_codepoint(c, &s, se)

while (s < se) {
c = uv__utf8_decode1(&s, se);
assert(c != -1u);

if (c >= n)
if (c < m)
m = c;
}

x = m - n;
y = h + 1;
Expand All @@ -181,7 +199,10 @@ static int uv__idna_toascii_label(const char* s, const char* se,
n = m;

s = ss;
foreach_codepoint(c, &s, se) {
while (s < se) {
c = uv__utf8_decode1(&s, se);
assert(c != -1u);

if (c < n)
if (++delta == 0)
return UV_E2BIG; /* Overflow. */
Expand Down Expand Up @@ -245,8 +266,6 @@ static int uv__idna_toascii_label(const char* s, const char* se,
return 0;
}

#undef foreach_codepoint

long uv__idna_toascii(const char* s, const char* se, char* d, char* de) {
const char* si;
const char* st;
Expand All @@ -256,10 +275,14 @@ long uv__idna_toascii(const char* s, const char* se, char* d, char* de) {

ds = d;

for (si = s; si < se; /* empty */) {
si = s;
while (si < se) {
st = si;
c = uv__utf8_decode1(&si, se);

if (c == -1u)
return UV_EINVAL;

if (c != '.')
if (c != 0x3002) /* 。 */
if (c != 0xFF0E) /* . */
Expand Down
19 changes: 19 additions & 0 deletions deps/uv/test/test-idna.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,25 @@ TEST_IMPL(utf8_decode1) {
return 0;
}

TEST_IMPL(utf8_decode1_overrun) {
const char* p;
char b[1];

/* Single byte. */
p = b;
b[0] = 0x7F;
ASSERT_EQ(0x7F, uv__utf8_decode1(&p, b + 1));
ASSERT_EQ(p, b + 1);

/* Multi-byte. */
p = b;
b[0] = 0xC0;
ASSERT_EQ((unsigned) -1, uv__utf8_decode1(&p, b + 1));
ASSERT_EQ(p, b + 1);

return 0;
}

/* Doesn't work on z/OS because that platform uses EBCDIC, not ASCII. */
#ifndef __MVS__

Expand Down
2 changes: 2 additions & 0 deletions deps/uv/test/test-list.h
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,7 @@ TEST_DECLARE (fork_threadpool_queue_work_simple)

TEST_DECLARE (idna_toascii)
TEST_DECLARE (utf8_decode1)
TEST_DECLARE (utf8_decode1_overrun)
TEST_DECLARE (uname)

TEST_DECLARE (metrics_idle_time)
Expand Down Expand Up @@ -1120,6 +1121,7 @@ TASK_LIST_START
#endif

TEST_ENTRY (utf8_decode1)
TEST_ENTRY (utf8_decode1_overrun)
TEST_ENTRY (uname)

/* Doesn't work on z/OS because that platform uses EBCDIC, not ASCII. */
Expand Down
12 changes: 8 additions & 4 deletions deps/v8/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,8 @@ v8_toolset_for_shell = "host"
#

config("internal_config_base") {
visibility = [ ":*" ] # Only targets in this file can depend on this.
# Only targets in this file and its subdirs can depend on this.
visibility = [ "./*" ]

configs = [ ":v8_tracing_config" ]

Expand All @@ -321,7 +322,8 @@ config("internal_config_base") {

config("internal_config") {
defines = []
visibility = [ ":*" ] # Only targets in this file can depend on this.
# Only targets in this file and its subdirs can depend on this.
visibility = [ "./*" ]

configs = [
"//build/config/compiler:wexit_time_destructors",
Expand Down Expand Up @@ -429,7 +431,8 @@ config("v8_header_features") {
# Put defines here that are only used in our internal files and NEVER in
# external headers that embedders (such as chromium and node) might include.
config("features") {
visibility = [ ":*" ] # Only targets in this file can depend on this.
# Only targets in this file and its subdirs can depend on this.
visibility = [ "./*" ]

defines = []

Expand Down Expand Up @@ -559,7 +562,8 @@ config("features") {
}

config("toolchain") {
visibility = [ ":*" ] # Only targets in this file can depend on this.
# Only targets in this file and its subdirs can depend on this.
visibility = [ "./*" ]

defines = []
cflags = []
Expand Down
12 changes: 6 additions & 6 deletions deps/v8/DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,15 @@ vars = {

deps = {
'v8/build':
Var('chromium_url') + '/chromium/src/build.git' + '@' + '1b904cc30093c25d5fd48389bd58e3f7409bcf80',
Var('chromium_url') + '/chromium/src/build.git' + '@' + 'c854b8178a7e0a20b168ffded4f2d2cb1e136e42',
'v8/third_party/depot_tools':
Var('chromium_url') + '/chromium/tools/depot_tools.git' + '@' + '454f4ba4b3a69feb03c73f93d789062033433b4c',
Var('chromium_url') + '/chromium/tools/depot_tools.git' + '@' + 'd4e6fb6573e0955110a2c69be29557f6626d9ae6',
'v8/third_party/icu':
Var('chromium_url') + '/chromium/deps/icu.git' + '@' + 'f2223961702f00a8833874b0560d615a2cc42738',
'v8/third_party/instrumented_libraries':
Var('chromium_url') + '/chromium/src/third_party/instrumented_libraries.git' + '@' + 'bb3f1802c237dd19105dd0f7919f99e536a39d10',
'v8/buildtools':
Var('chromium_url') + '/chromium/src/buildtools.git' + '@' + '204a35a2a64f7179f8b76d7a0385653690839e21',
Var('chromium_url') + '/chromium/src/buildtools.git' + '@' + '6302c1175607a436e18947a5abe9df2209e845fc',
'v8/buildtools/clang_format/script':
Var('chromium_url') + '/chromium/llvm-project/cfe/tools/clang-format.git' + '@' + '96636aa0e9f047f17447f2d45a094d0b59ed7917',
'v8/buildtools/linux64': {
Expand Down Expand Up @@ -168,7 +168,7 @@ deps = {
'dep_type': 'cipd',
},
'v8/third_party/catapult': {
'url': Var('chromium_url') + '/catapult.git' + '@' + 'e9a8d378c950ee44beec5dd5207e151f48e5b5be',
'url': Var('chromium_url') + '/catapult.git' + '@' + 'f92a7636da65f28dad15bc524e6b681d1c311de0',
'condition': 'checkout_android',
},
'v8/third_party/colorama/src': {
Expand Down Expand Up @@ -236,7 +236,7 @@ deps = {
'dep_type': 'cipd',
},
'v8/tools/clang':
Var('chromium_url') + '/chromium/src/tools/clang.git' + '@' + 'de3e20662b84f0ee361a5ae11c99a9513df7c8e8',
Var('chromium_url') + '/chromium/src/tools/clang.git' + '@' + 'c72342ce992ebd9cc02c0d65f0af5941d29eb217',
'v8/tools/luci-go': {
'packages': [
{
Expand Down Expand Up @@ -266,7 +266,7 @@ deps = {
'dep_type': 'cipd',
},
'v8/third_party/perfetto':
Var('android_url') + '/platform/external/perfetto.git' + '@' + 'ff70e0d273ed10995866c803f23e11250eb3dc52',
Var('android_url') + '/platform/external/perfetto.git' + '@' + '7cdc44f903d3bcfd1d0f67188bfa797a24756868',
'v8/third_party/protobuf':
Var('chromium_url') + '/external/github.com/google/protobuf'+ '@' + 'b68a347f56137b4b1a746e8c7438495a6ac1bd91',
'v8/third_party/zlib':
Expand Down
11 changes: 6 additions & 5 deletions deps/v8/gni/proto_library.gni
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ template("proto_library") {
assert(defined(invoker.sources))
proto_sources = invoker.sources

set_sources_assignment_filter([])

if (host_os == "win") {
host_executable_suffix = ".exe"
} else {
Expand Down Expand Up @@ -141,6 +139,12 @@ template("proto_library") {
]
}

if (defined(invoker.import_dirs)) {
foreach(path, invoker.import_dirs) {
args += [ "--import-dir=" + rebase_path(path, root_build_dir) ]
}
}

if (generate_with_plugin) {
plugin_path_rebased = rebase_path(plugin_path, root_build_dir)
plugin_out_args = ""
Expand Down Expand Up @@ -187,10 +191,7 @@ template("proto_library") {
"visibility",
])

# Exclude the config.descriptor file which is an output for some reason.
set_sources_assignment_filter([ "*.descriptor" ])
sources = get_target_outputs(":$action_name")
set_sources_assignment_filter(sources_assignment_filter)

# configs -= [ "//gn/standalone:extra_warnings" ]
if (defined(invoker.extra_configs)) {
Expand Down
4 changes: 2 additions & 2 deletions deps/v8/src/base/macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -339,14 +339,14 @@ inline T RoundDown(T x, intptr_t m) {
STATIC_ASSERT(std::is_integral<T>::value);
// m must be a power of two.
DCHECK(m != 0 && ((m & (m - 1)) == 0));
return x & -m;
return x & static_cast<T>(-m);
}
template <intptr_t m, typename T>
constexpr inline T RoundDown(T x) {
STATIC_ASSERT(std::is_integral<T>::value);
// m must be a power of two.
STATIC_ASSERT(m != 0 && ((m & (m - 1)) == 0));
return x & -m;
return x & static_cast<T>(-m);
}

// Return the smallest multiple of m which is >= x.
Expand Down
7 changes: 7 additions & 0 deletions deps/v8/test/cctest/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ v8_header_set("cctest_headers") {
sources = [ "cctest.h" ]
}

config("cctest_sources_config") {
if (is_clang) {
cflags = [ "-Wno-string-concatenation" ]
}
}

v8_source_set("cctest_sources") {
testonly = true

Expand Down Expand Up @@ -398,6 +404,7 @@ v8_source_set("cctest_sources") {
"../..:external_config",
"../..:internal_config_base",
"../..:v8_tracing_config",
":cctest_sources_config",
]

public_deps = [
Expand Down
9 changes: 5 additions & 4 deletions deps/v8/test/cctest/libplatform/test-tracing.cc
Original file line number Diff line number Diff line change
Expand Up @@ -860,10 +860,11 @@ TEST(JsonIntegrationTest) {
std::vector<std::string> all_args;
GetJSONStrings(&all_args, json, "\"args\"", "{", "}");

CHECK_EQ("\"1\":1e+100", all_args[0]);
CHECK_EQ("\"2\":\"NaN\"", all_args[1]);
CHECK_EQ("\"3\":\"Infinity\"", all_args[2]);
CHECK_EQ("\"4\":\"-Infinity\"", all_args[3]);
// Ignore the first metadata event.
CHECK_EQ("\"1\":1e+100", all_args[1]);
CHECK_EQ("\"2\":\"NaN\"", all_args[2]);
CHECK_EQ("\"3\":\"Infinity\"", all_args[3]);
CHECK_EQ("\"4\":\"-Infinity\"", all_args[4]);
}

#endif // V8_USE_PERFETTO
Expand Down
Loading

0 comments on commit 8b2bb24

Please sign in to comment.