Skip to content
This repository has been archived by the owner on Oct 15, 2020. It is now read-only.

Commit

Permalink
Merge nodejs/master
Browse files Browse the repository at this point in the history
Merge 70832bc as of 2017-10-18.
This is an automatically created merge. For any problems please
contact @kunalspathak.
  • Loading branch information
chakrabot authored and jackhorton committed Oct 24, 2017
2 parents 1fac205 + 70832bc commit 535c25e
Show file tree
Hide file tree
Showing 67 changed files with 264 additions and 161 deletions.
1 change: 1 addition & 0 deletions .eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -197,3 +197,4 @@ globals:
LTTNG_HTTP_SERVER_RESPONSE: false
LTTNG_NET_SERVER_CONNECTION: false
LTTNG_NET_STREAM_END: false
internalBinding: false
8 changes: 3 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ else
test: all
$(MAKE) build-addons
$(MAKE) build-addons-napi
$(MAKE) doc
$(MAKE) cctest
$(PYTHON) tools/test.py --mode=release --flaky-tests=$(FLAKY_TESTS) -J \
$(CI_ASYNC_HOOKS) \
Expand Down Expand Up @@ -379,7 +380,7 @@ test-ci-js: | clear-stalled
fi

test-ci: LOGLEVEL := info
test-ci: | clear-stalled build-addons build-addons-napi
test-ci: | clear-stalled build-addons build-addons-napi doc
out/Release/cctest --gtest_output=tap:cctest.tap
$(PYTHON) tools/test.py $(PARALLEL_ARGS) -p tap --logfile test.tap \
--mode=release --flaky-tests=$(FLAKY_TESTS) \
Expand Down Expand Up @@ -409,9 +410,6 @@ test-pummel: all
test-internet: all
$(PYTHON) tools/test.py internet

test-inspector: all
$(PYTHON) tools/test.py inspector

test-node-inspect: $(NODE_EXE)
USE_EMBEDDED_NODE_INSPECT=1 $(NODE) tools/test-npm-package \
--install deps/node-inspect test
Expand Down Expand Up @@ -518,7 +516,7 @@ doc: $(NODE_EXE) doc-only
$(apidoc_dirs):
mkdir -p $@

out/doc/api/assets/%: doc/api_assets/% out/doc/api/assets/
out/doc/api/assets/%: doc/api_assets/% out/doc/api/assets
cp $< $@

out/doc/%: doc/%
Expand Down
4 changes: 4 additions & 0 deletions common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
# Default to -O0 for debug builds.
'v8_optimized_debug%': 0,

# 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.0',

# Enable disassembler for `--print-code` v8 options
'v8_enable_disassembler': 1,

Expand Down
6 changes: 6 additions & 0 deletions deps/v8/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ declare_args() {
# Embeds the given script into the snapshot.
v8_embed_script = ""

# Allows the embedder to add a custom suffix to the version string.
v8_embedder_string = ""

# Sets -dENABLE_DISASSEMBLER.
v8_enable_disassembler = ""

Expand Down Expand Up @@ -217,6 +220,9 @@ config("features") {

defines = []

if (v8_embedder_string != "") {
defines += [ "V8_EMBEDDER_STRING=\"$v8_embedder_string\"" ]
}
if (v8_enable_disassembler) {
defines += [ "ENABLE_DISASSEMBLER" ]
}
Expand Down
6 changes: 6 additions & 0 deletions deps/v8/gypfiles/features.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@

{
'variables': {
# Allows the embedder to add a custom suffix to the version string.
'v8_embedder_string%': '',

'v8_enable_disassembler%': 0,

'v8_promise_internal_field_count%': 0,
Expand Down Expand Up @@ -79,6 +82,9 @@
},
'target_defaults': {
'conditions': [
['v8_embedder_string!=""', {
'defines': ['V8_EMBEDDER_STRING="<(v8_embedder_string)"',],
}],
['v8_enable_disassembler==1', {
'defines': ['ENABLE_DISASSEMBLER',],
}],
Expand Down
6 changes: 5 additions & 1 deletion deps/v8/include/v8-version-string.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,18 @@
#define V8_CANDIDATE_STRING ""
#endif

#ifndef V8_EMBEDDER_STRING
#define V8_EMBEDDER_STRING ""
#endif

#define V8_SX(x) #x
#define V8_S(x) V8_SX(x)

#if V8_PATCH_LEVEL > 0
#define V8_VERSION_STRING \
V8_S(V8_MAJOR_VERSION) \
"." V8_S(V8_MINOR_VERSION) "." V8_S(V8_BUILD_NUMBER) "." V8_S( \
V8_PATCH_LEVEL) V8_CANDIDATE_STRING
V8_PATCH_LEVEL) V8_EMBEDDER_STRING V8_CANDIDATE_STRING
#else
#define V8_VERSION_STRING \
V8_S(V8_MAJOR_VERSION) \
Expand Down
13 changes: 10 additions & 3 deletions deps/v8/src/log-utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,16 @@ void Log::Initialize(const char* log_file_name) {

if (output_handle_ != nullptr) {
Log::MessageBuilder msg(this);
msg.Append("v8-version,%d,%d,%d,%d,%d", Version::GetMajor(),
Version::GetMinor(), Version::GetBuild(), Version::GetPatch(),
Version::IsCandidate());
if (strlen(Version::GetEmbedder()) == 0) {
msg.Append("v8-version,%d,%d,%d,%d,%d", Version::GetMajor(),
Version::GetMinor(), Version::GetBuild(),
Version::GetPatch(), Version::IsCandidate());
} else {
msg.Append("v8-version,%d,%d,%d,%d,%s,%d", Version::GetMajor(),
Version::GetMinor(), Version::GetBuild(),
Version::GetPatch(), Version::GetEmbedder(),
Version::IsCandidate());
}
msg.WriteToLogFile();
}
}
Expand Down
19 changes: 10 additions & 9 deletions deps/v8/src/version.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ int Version::major_ = V8_MAJOR_VERSION;
int Version::minor_ = V8_MINOR_VERSION;
int Version::build_ = V8_BUILD_NUMBER;
int Version::patch_ = V8_PATCH_LEVEL;
const char* Version::embedder_ = V8_EMBEDDER_STRING;
bool Version::candidate_ = (V8_IS_CANDIDATE_VERSION != 0);
const char* Version::soname_ = SONAME;
const char* Version::version_string_ = V8_VERSION_STRING;
Expand All @@ -33,12 +34,12 @@ void Version::GetString(Vector<char> str) {
const char* is_simulator = "";
#endif // USE_SIMULATOR
if (GetPatch() > 0) {
SNPrintF(str, "%d.%d.%d.%d%s%s",
GetMajor(), GetMinor(), GetBuild(), GetPatch(), candidate,
is_simulator);
SNPrintF(str, "%d.%d.%d.%d%s%s%s",
GetMajor(), GetMinor(), GetBuild(), GetPatch(), GetEmbedder(),
candidate, is_simulator);
} else {
SNPrintF(str, "%d.%d.%d%s%s",
GetMajor(), GetMinor(), GetBuild(), candidate,
SNPrintF(str, "%d.%d.%d%s%s%s",
GetMajor(), GetMinor(), GetBuild(), GetEmbedder(), candidate,
is_simulator);
}
}
Expand All @@ -50,11 +51,11 @@ void Version::GetSONAME(Vector<char> str) {
// Generate generic SONAME if no specific SONAME is defined.
const char* candidate = IsCandidate() ? "-candidate" : "";
if (GetPatch() > 0) {
SNPrintF(str, "libv8-%d.%d.%d.%d%s.so",
GetMajor(), GetMinor(), GetBuild(), GetPatch(), candidate);
SNPrintF(str, "libv8-%d.%d.%d.%d%s%s.so", GetMajor(), GetMinor(),
GetBuild(), GetPatch(), GetEmbedder(), candidate);
} else {
SNPrintF(str, "libv8-%d.%d.%d%s.so",
GetMajor(), GetMinor(), GetBuild(), candidate);
SNPrintF(str, "libv8-%d.%d.%d%s%s.so", GetMajor(), GetMinor(), GetBuild(),
GetEmbedder(), candidate);
}
} else {
// Use specific SONAME.
Expand Down
5 changes: 4 additions & 1 deletion deps/v8/src/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class Version {
static int GetMinor() { return minor_; }
static int GetBuild() { return build_; }
static int GetPatch() { return patch_; }
static const char* GetEmbedder() { return embedder_; }
static bool IsCandidate() { return candidate_; }
static uint32_t Hash() {
return static_cast<uint32_t>(
Expand All @@ -38,13 +39,15 @@ class Version {
static int minor_;
static int build_;
static int patch_;
static const char* embedder_;
static bool candidate_;
static const char* soname_;
static const char* version_string_;

// In test-version.cc.
friend void SetVersion(int major, int minor, int build, int patch,
bool candidate, const char* soname);
const char* embedder, bool candidate,
const char* soname);
};

} // namespace internal
Expand Down
51 changes: 34 additions & 17 deletions deps/v8/test/cctest/test-version.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,12 @@ namespace v8 {
namespace internal {

void SetVersion(int major, int minor, int build, int patch,
bool candidate, const char* soname) {
const char* embedder, bool candidate, const char* soname) {
Version::major_ = major;
Version::minor_ = minor;
Version::build_ = build;
Version::patch_ = patch;
Version::embedder_ = embedder;
Version::candidate_ = candidate;
Version::soname_ = soname;
}
Expand All @@ -50,23 +51,23 @@ void SetVersion(int major, int minor, int build, int patch,
} // namespace v8


static void CheckVersion(int major, int minor, int build,
int patch, bool candidate,
static void CheckVersion(int major, int minor, int build, int patch,
const char* embedder, bool candidate,
const char* expected_version_string,
const char* expected_generic_soname) {
static v8::internal::EmbeddedVector<char, 128> version_str;
static v8::internal::EmbeddedVector<char, 128> soname_str;

// Test version without specific SONAME.
SetVersion(major, minor, build, patch, candidate, "");
SetVersion(major, minor, build, patch, embedder, candidate, "");
Version::GetString(version_str);
CHECK_EQ(0, strcmp(expected_version_string, version_str.start()));
Version::GetSONAME(soname_str);
CHECK_EQ(0, strcmp(expected_generic_soname, soname_str.start()));

// Test version with specific SONAME.
const char* soname = "libv8.so.1";
SetVersion(major, minor, build, patch, candidate, soname);
SetVersion(major, minor, build, patch, embedder, candidate, soname);
Version::GetString(version_str);
CHECK_EQ(0, strcmp(expected_version_string, version_str.start()));
Version::GetSONAME(soname_str);
Expand All @@ -88,18 +89,34 @@ TEST(VersionString) {
CheckVersion(2, 5, 10, 7, false, "2.5.10.7 SIMULATOR", "libv8-2.5.10.7.so");
CheckVersion(2, 5, 10, 7, true,
"2.5.10.7 (candidate) SIMULATOR", "libv8-2.5.10.7-candidate.so");
CheckVersion(6, 0, 287, 0, "-emb.1", false, "6.0.287-emb.1 SIMULATOR",
"libv8-6.0.287-emb.1.so");
CheckVersion(6, 0, 287, 0, "-emb.1", true, "6.0.287-emb.1 (candidate) SIMULATOR",
"libv8-6.0.287-emb.1-candidate.so");
CheckVersion(6, 0, 287, 53, "-emb.1", false, "6.0.287.53-emb.1 SIMULATOR",
"libv8-6.0.287.53-emb.1.so");
CheckVersion(6, 0, 287, 53, "-emb.1", true, "6.0.287.53-emb.1 (candidate) SIMULATOR",
"libv8-6.0.287.53-emb.1-candidate.so");
#else
CheckVersion(0, 0, 0, 0, false, "0.0.0", "libv8-0.0.0.so");
CheckVersion(0, 0, 0, 0, true,
"0.0.0 (candidate)", "libv8-0.0.0-candidate.so");
CheckVersion(1, 0, 0, 0, false, "1.0.0", "libv8-1.0.0.so");
CheckVersion(1, 0, 0, 0, true,
"1.0.0 (candidate)", "libv8-1.0.0-candidate.so");
CheckVersion(1, 0, 0, 1, false, "1.0.0.1", "libv8-1.0.0.1.so");
CheckVersion(1, 0, 0, 1, true,
"1.0.0.1 (candidate)", "libv8-1.0.0.1-candidate.so");
CheckVersion(2, 5, 10, 7, false, "2.5.10.7", "libv8-2.5.10.7.so");
CheckVersion(2, 5, 10, 7, true,
"2.5.10.7 (candidate)", "libv8-2.5.10.7-candidate.so");
CheckVersion(0, 0, 0, 0, "", false, "0.0.0", "libv8-0.0.0.so");
CheckVersion(0, 0, 0, 0, "", true, "0.0.0 (candidate)",
"libv8-0.0.0-candidate.so");
CheckVersion(1, 0, 0, 0, "", false, "1.0.0", "libv8-1.0.0.so");
CheckVersion(1, 0, 0, 0, "", true, "1.0.0 (candidate)",
"libv8-1.0.0-candidate.so");
CheckVersion(1, 0, 0, 1, "", false, "1.0.0.1", "libv8-1.0.0.1.so");
CheckVersion(1, 0, 0, 1, "", true, "1.0.0.1 (candidate)",
"libv8-1.0.0.1-candidate.so");
CheckVersion(2, 5, 10, 7, "", false, "2.5.10.7", "libv8-2.5.10.7.so");
CheckVersion(2, 5, 10, 7, "", true, "2.5.10.7 (candidate)",
"libv8-2.5.10.7-candidate.so");
CheckVersion(6, 0, 287, 0, "-emb.1", false, "6.0.287-emb.1",
"libv8-6.0.287-emb.1.so");
CheckVersion(6, 0, 287, 0, "-emb.1", true, "6.0.287-emb.1 (candidate)",
"libv8-6.0.287-emb.1-candidate.so");
CheckVersion(6, 0, 287, 53, "-emb.1", false, "6.0.287.53-emb.1",
"libv8-6.0.287.53-emb.1.so");
CheckVersion(6, 0, 287, 53, "-emb.1", true, "6.0.287.53-emb.1 (candidate)",
"libv8-6.0.287.53-emb.1-candidate.so");
#endif
}
28 changes: 14 additions & 14 deletions doc/api/crypto.md
Original file line number Diff line number Diff line change
Expand Up @@ -1712,45 +1712,45 @@ Encrypts `buffer` with `privateKey`.
`privateKey` can be an object or a string. If `privateKey` is a string, it is
treated as the key with no passphrase and will use `RSA_PKCS1_PADDING`.

### crypto.publicDecrypt(publicKey, buffer)
### crypto.publicDecrypt(key, buffer)
<!-- YAML
added: v1.1.0
-->
- `publicKey` {Object | string}
- `key` {string} A PEM encoded public key.
- `passphrase` {string} An optional passphrase for the public key.
- `key` {Object | string}
- `key` {string} A PEM encoded public or private key.
- `passphrase` {string} An optional passphrase for the private key.
- `padding` {crypto.constants} An optional padding value defined in
`crypto.constants`, which may be: `crypto.constants.RSA_NO_PADDING` or
`RSA_PKCS1_PADDING`.
- `buffer` {Buffer | TypedArray | DataView}
- Returns: {Buffer} A new `Buffer` with the decrypted content.

Decrypts `buffer` with `publicKey`.
Decrypts `buffer` with `key`.

`publicKey` can be an object or a string. If `publicKey` is a string, it is
treated as the key with no passphrase and will use `RSA_PKCS1_PADDING`.
`key` can be an object or a string. If `key` is a string, it is treated as
the key with no passphrase and will use `RSA_PKCS1_PADDING`.

Because RSA public keys can be derived from private keys, a private key may
be passed instead of a public key.

### crypto.publicEncrypt(publicKey, buffer)
### crypto.publicEncrypt(key, buffer)
<!-- YAML
added: v0.11.14
-->
- `publicKey` {Object | string}
- `key` {string} A PEM encoded public key.
- `passphrase` {string} An optional passphrase for the public key.
- `key` {Object | string}
- `key` {string} A PEM encoded public or private key.
- `passphrase` {string} An optional passphrase for the private key.
- `padding` {crypto.constants} An optional padding value defined in
`crypto.constants`, which may be: `crypto.constants.RSA_NO_PADDING`,
`RSA_PKCS1_PADDING`, or `crypto.constants.RSA_PKCS1_OAEP_PADDING`.
- `buffer` {Buffer | TypedArray | DataView}
- Returns: {Buffer} A new `Buffer` with the encrypted content.

Encrypts the content of `buffer` with `publicKey` and returns a new
Encrypts the content of `buffer` with `key` and returns a new
[`Buffer`][] with encrypted content.

`publicKey` can be an object or a string. If `publicKey` is a string, it is
treated as the key with no passphrase and will use `RSA_PKCS1_OAEP_PADDING`.
`key` can be an object or a string. If `key` is a string, it is treated as
the key with no passphrase and will use `RSA_PKCS1_OAEP_PADDING`.

Because RSA public keys can be derived from private keys, a private key may
be passed instead of a public key.
Expand Down
2 changes: 1 addition & 1 deletion doc/api/os.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ added: v0.3.3
* Returns: {Array}

The `os.cpus()` method returns an array of objects containing information about
each CPU/core installed.
each logical CPU core.

The properties included on each object include:

Expand Down
5 changes: 4 additions & 1 deletion doc/api/process.md
Original file line number Diff line number Diff line change
Expand Up @@ -1790,6 +1790,9 @@ changes:
- version: v4.2.0
pr-url: https://github.com/nodejs/node/pull/3102
description: The `icu` property is now supported.
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/15785
description: The `v8` property now includes a Node.js specific suffix.
-->

* {Object}
Expand All @@ -1810,7 +1813,7 @@ Will generate an object similar to:
{
http_parser: '2.3.0',
node: '1.1.1',
v8: '4.1.0.14',
v8: '6.1.534.42-node.0',
uv: '1.3.0',
zlib: '1.2.8',
ares: '1.10.0-DEV',
Expand Down
4 changes: 3 additions & 1 deletion doc/guides/maintaining-V8.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,8 @@ to be cherry-picked in the Node.js repository and V8-CI must test the change.

* For each abandoned V8 branch corresponding to an LTS branch that is affected by the bug:
* Open a cherry-pick PR on nodejs/node targeting the appropriate *vY.x-staging* branch (e.g. *v6.x-staging* to fix an issue in V8-5.1).
* Increase the patch level version in v8-version.h. This will not cause any problems with versioning because V8 will not publish other patches for this branch, so Node.js can effectively bump the patch version.
* On Node.js < 9.0.0: Increase the patch level version in v8-version.h. This will not cause any problems with versioning because V8 will not publish other patches for this branch, so Node.js can effectively bump the patch version.
* On Node.js >= 9.0.0: Increase the `v8_embedder_string` number in `common.gypi`.
* In some cases the patch may require extra effort to merge in case V8 has changed substantially. For important issues we may be able to lean on the V8 team to get help with reimplementing the patch.
* Run the Node.js [V8-CI](https://ci.nodejs.org/job/node-test-commit-v8-linux/) in addition to the [Node.js CI](https://ci.nodejs.org/job/node-test-pull-request/).

Expand Down Expand Up @@ -265,6 +266,7 @@ above. A better strategy is to

1. Audit the current master branch and look at the patches that have been floated since the last major V8 update.
1. Replace the copy of V8 in Node.js with a fresh checkout of the latest stable V8 branch. Special care must be taken to recursively update the DEPS that V8 has a compile time dependency on (at the moment of this writing, these are only trace_event and gtest_prod.h)
1. Reset the `v8_embedder_string` variable to "-node.0" in `common.gypi`.
1. Refloat (cherry-pick) all the patches from list computed in 1) as necessary. Some of the patches may no longer be necessary.

To audit for floating patches:
Expand Down
Loading

0 comments on commit 535c25e

Please sign in to comment.