diff --git a/.travis.yml b/.travis.yml
index 80c729a772fed5..e496919579b2f8 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -4,6 +4,14 @@ cache: ccache
os: linux
matrix:
include:
+ - name: "First commit message adheres to guidelines at https://goo.gl/p2fr5Q"
+ if: type = pull_request
+ language: node_js
+ node_js: "node"
+ script:
+ - if [ "${TRAVIS_PULL_REQUEST}" != "false" ]; then
+ bash -x tools/lint-pr-commit-message.sh ${TRAVIS_PULL_REQUEST};
+ fi
- name: "Linter"
language: node_js
node_js: "node"
@@ -11,10 +19,6 @@ matrix:
- NODE=$(which node)
script:
- make lint
- # Lint the first commit in the PR.
- - if [ "${TRAVIS_PULL_REQUEST}" != "false" ]; then
- bash tools/lint-pr-commit-message.sh ${TRAVIS_PULL_REQUEST} || true;
- fi
- name: "Test Suite"
addons:
apt:
diff --git a/BUILDING.md b/BUILDING.md
index efe39e656b383a..36d87c0f141b79 100644
--- a/BUILDING.md
+++ b/BUILDING.md
@@ -69,8 +69,7 @@ There are three support tiers:
### Supported platforms
The community does not build or test against end-of-life distributions (EoL).
-Thus, we do not recommend that you use Node.js on end-of-life or unsupported
-platforms in production.
+For production applications, run Node.js on supported platforms only.
| System | Support type | Version | Architectures | Notes |
|--------------|--------------|----------------------------------|----------------------|------------------|
@@ -134,21 +133,20 @@ OpenSSL-1.1.0 requires the following assembler version for use of asm
support on x86_64 and ia32.
* gas (GNU assembler) version 2.23 or higher
-* xcode version 5.0 or higher
+* Xcode version 5.0 or higher
* llvm version 3.3 or higher
* nasm version 2.10 or higher in Windows
-Otherwise `configure` will fail with an error. This can be avoided by
-either providing a newer assembler as per the list above or by
-using the `--openssl-no-asm` flag.
+If compiling without one of the above, use `configure` with the
+`--openssl-no-asm` flag. Otherwise, `configure` will fail.
The forthcoming OpenSSL-1.1.1 will have different requirements. Please refer to
https://www.openssl.org/docs/man1.1.1/man3/OPENSSL_ia32cap.html for details.
## Building Node.js on supported platforms
-*Note:* All prerequisites can be easily installed by following
-[this bootstrapping guide](https://github.com/nodejs/node/blob/master/tools/bootstrap/README.md).
+The [bootstrapping guide](https://github.com/nodejs/node/blob/master/tools/bootstrap/README.md)
+explains how to install all prerequisites.
### Unix/macOS
@@ -159,7 +157,7 @@ The forthcoming OpenSSL-1.1.1 will have different requirements. Please refer to
* Python 2.6 or 2.7
* GNU Make 3.81 or newer
-On macOS, you will need to install the `Xcode Command Line Tools` by running
+On macOS, install the `Xcode Command Line Tools` by running
`xcode-select --install`. Alternatively, if you already have the full Xcode
installed, you can find them under the menu `Xcode -> Open Developer Tool ->
More Developer Tools...`. This step will install `clang`, `clang++`, and
@@ -180,13 +178,9 @@ $ ./configure
$ make -j4
```
-Running `make` with the `-j4` flag will cause it to run 4 compilation jobs
-concurrently which may significantly reduce build time. The number after `-j`
-can be changed to best suit the number of processor cores on your machine. If
-you run into problems running `make` with concurrency, try running it without
-the `-j4` flag. See the
-[GNU Make Documentation](https://www.gnu.org/software/make/manual/html_node/Parallel.html)
-for more information.
+The `-j4` option will cause `make` to run 4 simultaneous compilation jobs which
+may reduce build time. For more information, see the
+[GNU Make Documentation](https://www.gnu.org/software/make/manual/html_node/Parallel.html).
Note that the above requires that `python` resolve to Python 2.6 or 2.7
and not a newer version.
diff --git a/Makefile b/Makefile
index ae3830ddd40e00..d24451f4289414 100644
--- a/Makefile
+++ b/Makefile
@@ -270,7 +270,7 @@ v8:
tools/make-v8.sh $(V8_ARCH).$(BUILDTYPE_LOWER) $(V8_BUILD_OPTIONS)
.PHONY: jstest
-jstest: build-addons build-addons-napi bench-addons-build ## Runs addon tests and JS tests
+jstest: build-addons build-addons-napi ## Runs addon tests and JS tests
$(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) \
--skip-tests=$(CI_SKIP_TESTS) \
$(CI_JS_SUITES) \
@@ -332,16 +332,16 @@ ifeq ($(OSTYPE),aix)
DOCBUILDSTAMP_PREREQS := $(DOCBUILDSTAMP_PREREQS) out/$(BUILDTYPE)/node.exp
endif
-node_use_openssl = $(shell $(call available-node,"-p" \
- "process.versions.openssl != undefined"))
+node_use_openssl = $(call available-node,"-p" \
+ "process.versions.openssl != undefined")
test/addons/.docbuildstamp: $(DOCBUILDSTAMP_PREREQS) tools/doc/node_modules
-ifeq ($(node_use_openssl),true)
- $(RM) -r test/addons/??_*/
- [ -x $(NODE) ] && $(NODE) $< || node $<
- touch $@
-else
- @echo "Skipping .docbuildstamp (no crypto)"
-endif
+ @if [ "$(shell $(node_use_openssl))" != "true" ]; then \
+ echo "Skipping .docbuildstamp (no crypto)"; \
+ else \
+ $(RM) -r test/addons/??_*/; \
+ [ -x $(NODE) ] && $(NODE) $< || node $< ; \
+ touch $@; \
+ fi
ADDONS_BINDING_GYPS := \
$(filter-out test/addons/??_*/binding.gyp, \
@@ -414,7 +414,7 @@ clear-stalled:
echo $${PS_OUT} | xargs kill -9; \
fi
-test-build: | all build-addons build-addons-napi bench-addons-build
+test-build: | all build-addons build-addons-napi
test-build-addons-napi: all build-addons-napi
@@ -455,7 +455,7 @@ test-ci-js: | clear-stalled
.PHONY: test-ci
# Related CI jobs: most CI tests, excluding node-test-commit-arm-fanned
test-ci: LOGLEVEL := info
-test-ci: | clear-stalled build-addons build-addons-napi doc-only bench-addons-build
+test-ci: | clear-stalled build-addons build-addons-napi doc-only
out/Release/cctest --gtest_output=tap:cctest.tap
$(PYTHON) tools/test.py $(PARALLEL_ARGS) -p tap --logfile test.tap \
--mode=$(BUILDTYPE_LOWER) --flaky-tests=$(FLAKY_TESTS) \
@@ -496,7 +496,7 @@ test-debug: test-build
test-message: test-build
$(PYTHON) tools/test.py $(PARALLEL_ARGS) message
-test-simple: | cctest bench-addons-build # Depends on 'all'.
+test-simple: | cctest # Depends on 'all'.
$(PYTHON) tools/test.py $(PARALLEL_ARGS) parallel sequential
test-pummel: all
@@ -509,6 +509,9 @@ test-node-inspect: $(NODE_EXE)
USE_EMBEDDED_NODE_INSPECT=1 $(NODE) tools/test-npm-package \
--install deps/node-inspect test
+test-benchmark: | bench-addons-build
+ $(PYTHON) tools/test.py $(PARALLEL_ARGS) benchmark
+
test-tick-processor: all
$(PYTHON) tools/test.py $(PARALLEL_ARGS) tick-processor
@@ -609,11 +612,11 @@ apidocs_json = $(addprefix out/,$(apidoc_sources:.md=.json))
apiassets = $(subst api_assets,api/assets,$(addprefix out/,$(wildcard doc/api_assets/*)))
tools/doc/node_modules: tools/doc/package.json
-ifeq ($(node_use_openssl),true)
- cd tools/doc && $(call available-node,$(run-npm-ci))
-else
- @echo "Skipping tools/doc/node_modules (no crypto)"
-endif
+ @if [ "$(shell $(node_use_openssl))" != "true" ]; then \
+ echo "Skipping tools/doc/node_modules (no crypto)"; \
+ else \
+ cd tools/doc && $(call available-node,$(run-npm-ci)) \
+ fi
.PHONY: doc-only
doc-only: tools/doc/node_modules \
diff --git a/README.md b/README.md
index 79b12e289a58f4..533b36bf8dbd58 100644
--- a/README.md
+++ b/README.md
@@ -401,6 +401,8 @@ For information about the governance of the Node.js project, see
**Alexis Campailla** <orangemocha@nodejs.org>
* [othiym23](https://github.com/othiym23) -
**Forrest L Norvell** <ogd@aoaioxxysz.net> (he/him)
+* [oyyd](https://github.com/oyyd) -
+**Ouyang Yadong** <oyydoibh@gmail.com> (he/him)
* [pmq20](https://github.com/pmq20) -
**Minqi Pan** <pmq2001@gmail.com>
* [princejwesley](https://github.com/princejwesley) -
diff --git a/benchmark/fixtures/require-cachable.js b/benchmark/fixtures/require-cachable.js
new file mode 100644
index 00000000000000..f651728dc78f35
--- /dev/null
+++ b/benchmark/fixtures/require-cachable.js
@@ -0,0 +1,13 @@
+'use strict';
+
+const list = require('internal/bootstrap/cache');
+const {
+ isMainThread
+} = require('worker_threads');
+
+for (const key of list.cachableBuiltins) {
+ if (!isMainThread && key === 'trace_events') {
+ continue;
+ }
+ require(key);
+}
diff --git a/benchmark/misc/startup.js b/benchmark/misc/startup.js
index 703146f081b3c6..1350cd291e2b18 100644
--- a/benchmark/misc/startup.js
+++ b/benchmark/misc/startup.js
@@ -1,36 +1,76 @@
'use strict';
const common = require('../common.js');
-const spawn = require('child_process').spawn;
+const { spawn } = require('child_process');
const path = require('path');
-const emptyJsFile = path.resolve(__dirname, '../../test/fixtures/semicolon.js');
-const bench = common.createBenchmark(startNode, {
- dur: [1]
+let Worker; // Lazy loaded in main
+
+const bench = common.createBenchmark(main, {
+ dur: [1],
+ script: ['benchmark/fixtures/require-cachable', 'test/fixtures/semicolon'],
+ mode: ['process', 'worker']
+}, {
+ flags: ['--expose-internals', '--experimental-worker'] // for workers
});
-function startNode({ dur }) {
- var go = true;
- var starts = 0;
+function spawnProcess(script) {
+ const cmd = process.execPath || process.argv[0];
+ const argv = ['--expose-internals', script];
+ return spawn(cmd, argv);
+}
+
+function spawnWorker(script) {
+ return new Worker(script, { stderr: true, stdout: true });
+}
+
+function start(state, script, bench, getNode) {
+ const node = getNode(script);
+ let stdout = '';
+ let stderr = '';
+
+ node.stdout.on('data', (data) => {
+ stdout += data;
+ });
+
+ node.stderr.on('data', (data) => {
+ stderr += data;
+ });
+
+ node.on('exit', (code) => {
+ if (code !== 0) {
+ console.error('------ stdout ------');
+ console.error(stdout);
+ console.error('------ stderr ------');
+ console.error(stderr);
+ throw new Error(`Error during node startup, exit code ${code}`);
+ }
+ state.throughput++;
+
+ if (state.go) {
+ start(state, script, bench, getNode);
+ } else {
+ bench.end(state.throughput);
+ }
+ });
+}
+
+function main({ dur, script, mode }) {
+ const state = {
+ go: true,
+ throughput: 0
+ };
setTimeout(function() {
- go = false;
+ state.go = false;
}, dur * 1000);
- bench.start();
- start();
-
- function start() {
- const node = spawn(process.execPath || process.argv[0], [emptyJsFile]);
- node.on('exit', function(exitCode) {
- if (exitCode !== 0) {
- throw new Error('Error during node startup');
- }
- starts++;
-
- if (go)
- start();
- else
- bench.end(starts);
- });
+ script = path.resolve(__dirname, '../../', `${script}.js`);
+ if (mode === 'worker') {
+ Worker = require('worker_threads').Worker;
+ bench.start();
+ start(state, script, bench, spawnWorker);
+ } else {
+ bench.start();
+ start(state, script, bench, spawnProcess);
}
}
diff --git a/common.gypi b/common.gypi
index e2295ee35de832..ba444e1429f856 100644
--- a/common.gypi
+++ b/common.gypi
@@ -33,7 +33,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.45',
+ 'v8_embedder_string': '-node.46',
# Enable disassembler for `--print-code` v8 options
'v8_enable_disassembler': 1,
diff --git a/deps/http_parser/http_parser.c b/deps/http_parser/http_parser.c
index 6522618671d09c..46764bced09478 100644
--- a/deps/http_parser/http_parser.c
+++ b/deps/http_parser/http_parser.c
@@ -25,6 +25,8 @@
#include
#include
+static uint32_t max_header_size = HTTP_MAX_HEADER_SIZE;
+
#ifndef ULLONG_MAX
# define ULLONG_MAX ((uint64_t) -1) /* 2^64-1 */
#endif
@@ -137,20 +139,20 @@ do { \
} while (0)
/* Don't allow the total size of the HTTP headers (including the status
- * line) to exceed HTTP_MAX_HEADER_SIZE. This check is here to protect
+ * line) to exceed max_header_size. This check is here to protect
* embedders against denial-of-service attacks where the attacker feeds
* us a never-ending header that the embedder keeps buffering.
*
* This check is arguably the responsibility of embedders but we're doing
* it on the embedder's behalf because most won't bother and this way we
- * make the web a little safer. HTTP_MAX_HEADER_SIZE is still far bigger
+ * make the web a little safer. max_header_size is still far bigger
* than any reasonable request or response so this should never affect
* day-to-day operation.
*/
#define COUNT_HEADER_SIZE(V) \
do { \
parser->nread += (V); \
- if (UNLIKELY(parser->nread > (HTTP_MAX_HEADER_SIZE))) { \
+ if (UNLIKELY(parser->nread > max_header_size)) { \
SET_ERRNO(HPE_HEADER_OVERFLOW); \
goto error; \
} \
@@ -1471,7 +1473,7 @@ size_t http_parser_execute (http_parser *parser,
const char* p_lf;
size_t limit = data + len - p;
- limit = MIN(limit, HTTP_MAX_HEADER_SIZE);
+ limit = MIN(limit, max_header_size);
p_cr = (const char*) memchr(p, CR, limit);
p_lf = (const char*) memchr(p, LF, limit);
@@ -2437,3 +2439,8 @@ http_parser_version(void) {
HTTP_PARSER_VERSION_MINOR * 0x00100 |
HTTP_PARSER_VERSION_PATCH * 0x00001;
}
+
+void
+http_parser_set_max_header_size(uint32_t size) {
+ max_header_size = size;
+}
diff --git a/deps/http_parser/http_parser.h b/deps/http_parser/http_parser.h
index 1fbf30e2b4740b..ea7bafef2c3178 100644
--- a/deps/http_parser/http_parser.h
+++ b/deps/http_parser/http_parser.h
@@ -427,6 +427,9 @@ void http_parser_pause(http_parser *parser, int paused);
/* Checks if this is the final chunk of the body. */
int http_body_is_final(const http_parser *parser);
+/* Change the maximum header size provided at compile time. */
+void http_parser_set_max_header_size(uint32_t size);
+
#ifdef __cplusplus
}
#endif
diff --git a/deps/v8/src/compiler/js-operator.cc b/deps/v8/src/compiler/js-operator.cc
index 04feec6827aad0..8dedd68d946032 100644
--- a/deps/v8/src/compiler/js-operator.cc
+++ b/deps/v8/src/compiler/js-operator.cc
@@ -598,7 +598,7 @@ CompareOperationHint CompareOperationHintOf(const Operator* op) {
V(CreateKeyValueArray, Operator::kEliminatable, 2, 1) \
V(CreatePromise, Operator::kEliminatable, 0, 1) \
V(CreateTypedArray, Operator::kNoProperties, 5, 1) \
- V(CreateObject, Operator::kNoWrite, 1, 1) \
+ V(CreateObject, Operator::kNoProperties, 1, 1) \
V(ObjectIsArray, Operator::kNoProperties, 1, 1) \
V(HasProperty, Operator::kNoProperties, 2, 1) \
V(HasInPrototypeChain, Operator::kNoProperties, 2, 1) \
diff --git a/deps/v8/test/mjsunit/compiler/regress-888923.js b/deps/v8/test/mjsunit/compiler/regress-888923.js
new file mode 100644
index 00000000000000..e352673b7d933d
--- /dev/null
+++ b/deps/v8/test/mjsunit/compiler/regress-888923.js
@@ -0,0 +1,31 @@
+// Copyright 2018 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax
+
+(function() {
+ function f(o) {
+ o.x;
+ Object.create(o);
+ return o.y.a;
+ }
+
+ f({ x : 0, y : { a : 1 } });
+ f({ x : 0, y : { a : 2 } });
+ %OptimizeFunctionOnNextCall(f);
+ assertEquals(3, f({ x : 0, y : { a : 3 } }));
+})();
+
+(function() {
+ function f(o) {
+ let a = o.y;
+ Object.create(o);
+ return o.x + a;
+ }
+
+ f({ x : 42, y : 21 });
+ f({ x : 42, y : 21 });
+ %OptimizeFunctionOnNextCall(f);
+ assertEquals(63, f({ x : 42, y : 21 }));
+})();
diff --git a/doc/api/addons.md b/doc/api/addons.md
index 757f24c5194271..e2530acb77d5e0 100644
--- a/doc/api/addons.md
+++ b/doc/api/addons.md
@@ -63,13 +63,15 @@ namespace demo {
using v8::FunctionCallbackInfo;
using v8::Isolate;
using v8::Local;
+using v8::NewStringType;
using v8::Object;
using v8::String;
using v8::Value;
void Method(const FunctionCallbackInfo& args) {
Isolate* isolate = args.GetIsolate();
- args.GetReturnValue().Set(String::NewFromUtf8(isolate, "world"));
+ args.GetReturnValue().Set(String::NewFromUtf8(
+ isolate, "world", NewStringType::kNormal).ToLocalChecked());
}
void Initialize(Local