diff --git a/.editorconfig b/.editorconfig
index 52b84b424fb9a0..f1eff1dffcfe42 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -1,40 +1,26 @@
root = true
[*]
-end_of_line = lf
charset = utf-8
-trim_trailing_whitespace = true
+end_of_line = lf
+indent_size = 2
+indent_style = space
insert_final_newline = true
+trim_trailing_whitespace = true
[vcbuild.bat]
end_of_line = crlf
-[{lib,test,tools}/**.js]
-indent_style = space
-indent_size = 2
-
-[src/**.{h,cc}]
-indent_style = space
-indent_size = 2
-
-[test/*.py]
-indent_style = space
-indent_size = 2
-
-[configure]
-indent_style = space
-indent_size = 2
-
[Makefile]
-indent_style = tab
indent_size = 8
+indent_style = tab
[{deps}/**]
-indent_style = ignore
-indent_size = ignore
+charset = ignore
end_of_line = ignore
+indent_size = ignore
+indent_style = ignore
trim_trailing_whitespace = ignore
-charset = ignore
[{test/fixtures,deps,tools/node_modules,tools/gyp,tools/icu,tools/msvs}/**]
insert_final_newline = false
diff --git a/.eslintrc.js b/.eslintrc.js
index 8347d066ed22ec..d0aa8955351e5e 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -123,27 +123,28 @@ module.exports = {
'no-proto': 'error',
'no-redeclare': 'error',
'no-restricted-modules': ['error', 'sys'],
+ /* eslint-disable max-len */
'no-restricted-properties': [
'error',
{
object: 'assert',
property: 'deepEqual',
- message: 'Use assert.deepStrictEqual().',
+ message: 'Use `assert.deepStrictEqual()`.',
},
{
object: 'assert',
property: 'notDeepEqual',
- message: 'Use assert.notDeepStrictEqual().',
+ message: 'Use `assert.notDeepStrictEqual()`.',
},
{
object: 'assert',
property: 'equal',
- message: 'Use assert.strictEqual() rather than assert.equal().',
+ message: 'Use `assert.strictEqual()` rather than `assert.equal()`.',
},
{
object: 'assert',
property: 'notEqual',
- message: 'Use assert.notStrictEqual() rather than assert.notEqual().',
+ message: 'Use `assert.notStrictEqual()` rather than `assert.notEqual()`.',
},
{
property: '__defineGetter__',
@@ -154,7 +155,6 @@ module.exports = {
message: '__defineSetter__ is deprecated.',
}
],
- /* eslint-disable max-len */
// If this list is modified, please copy the change to lib/.eslintrc.yaml
// and test/.eslintrc.yaml.
'no-restricted-syntax': [
@@ -169,7 +169,7 @@ module.exports = {
},
{
selector: "CallExpression[callee.object.name='assert'][callee.property.name='rejects'][arguments.length<2]",
- message: 'assert.rejects() must be invoked with at least two arguments.',
+ message: '`assert.rejects()` must be invoked with at least two arguments.',
},
{
selector: "CallExpression[callee.object.name='assert'][callee.property.name='strictEqual'][arguments.2.type='Literal']",
@@ -177,23 +177,23 @@ module.exports = {
},
{
selector: "CallExpression[callee.object.name='assert'][callee.property.name='throws'][arguments.1.type='Literal']:not([arguments.1.regex])",
- message: 'Use an object as second argument of assert.throws()',
+ message: 'Use an object as second argument of `assert.throws()`.',
},
{
selector: "CallExpression[callee.object.name='assert'][callee.property.name='throws'][arguments.length<2]",
- message: 'assert.throws() must be invoked with at least two arguments.',
+ message: '`assert.throws()` must be invoked with at least two arguments.',
},
{
selector: "CallExpression[callee.name='setTimeout'][arguments.length<2]",
- message: 'setTimeout() must be invoked with at least two arguments.',
+ message: '`setTimeout()` must be invoked with at least two arguments.',
},
{
selector: "CallExpression[callee.name='setInterval'][arguments.length<2]",
- message: 'setInterval() must be invoked with at least 2 arguments.',
+ message: '`setInterval()` must be invoked with at least two arguments.',
},
{
selector: 'ThrowStatement > CallExpression[callee.name=/Error$/]',
- message: 'Use new keyword when throwing an Error.',
+ message: 'Use `new` keyword when throwing an `Error`.',
}
],
/* eslint-enable max-len */
diff --git a/.gitignore b/.gitignore
index d60603514c801f..f652a2c74c37d6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -15,6 +15,7 @@
!.mailmap
!.nycrc
!.travis.yml
+!.eslintrc.yaml
core
vgcore.*
@@ -38,14 +39,15 @@ icu_config.gypi
.eslintcache
node_trace.*.log
coverage/
+!**/node_modules/**/coverage
/out
# various stuff that VC++ produces/uses
Debug/
!**/node_modules/debug/
-!deps/v8/src/debug/
Release/
+!**/node_modules/**/release
!doc/blog/**
*.sln
!nodemsi.sln
@@ -64,7 +66,6 @@ ipch/
*.VC.opendb
.vs/
.vscode/
-/deps/v8/src/debug/obj
/*.exe
/config.mk
@@ -98,6 +99,7 @@ deps/openssl/openssl.xml
deps/openssl/openssl.target.mk
deps/zlib/zlib.target.mk
+!deps/npm/node_modules
# not needed and causes issues for distro packagers
deps/npm/node_modules/.bin/
@@ -130,8 +132,4 @@ deps/uv/docs/src/guide/
# ignore VS compiler output unhandled by V8's .gitignore
deps/v8/gypfiles/Debug/
deps/v8/gypfiles/Release/
-deps/v8/src/Debug/
-deps/v8/src/Release/
-deps/v8/src/inspector/Debug/
-deps/v8/src/inspector/Release/
deps/v8/third_party/eu-strip/
diff --git a/.travis.yml b/.travis.yml
index f6bbd1421b24ca..fad2e7f0c77509 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -8,12 +8,12 @@ matrix:
include:
- name: "Linter"
node_js: "latest"
- env:
+ env:
- NODE=$(which node)
- install:
- - make lint-md-build
script:
- make lint
+ # Lint the first commit in the PR.
+ - git log $TRAVIS_COMMIT_RANGE --pretty=format:'%h' --no-merges | tail -1 | xargs npx core-validate-commit --no-validate-metadata
- name: "Test Suite"
install:
- ./configure
diff --git a/BUILDING.md b/BUILDING.md
index 32c4c47e143afd..839480eec38a88 100644
--- a/BUILDING.md
+++ b/BUILDING.md
@@ -1,13 +1,50 @@
# Building Node.js
-Depending on what platform or features you require, the build process may
-differ slightly. After you've successfully built a binary, running the
-test suite to validate that the binary works as intended is a good next step.
+Depending on what platform or features you need, the build process may
+differ. After you've built a binary, running the
+test suite to confirm that the binary works as intended is a good next step.
-If you can reproduce a test failure consistently, search for it in the
+If you can reproduce a test failure, search for it in the
[Node.js issue tracker](https://github.com/nodejs/node/issues) or
file a new issue.
+## Table of Contents
+
+* [Supported platforms](#supported-platforms)
+ * [Input](#input)
+ * [Strategy](#strategy)
+ * [Supported platforms](#supported-platforms-1)
+ * [Supported toolchains](#supported-toolchains)
+ * [Unix](#unix)
+ * [AIX](#aix)
+ * [Windows](#windows)
+ * [OpenSSL asm support](#openssl-asm-support)
+* [Building Node.js on supported platforms](#building-nodejs-on-supported-platforms)
+ * [Unix/macOS](#unixmacos)
+ * [Prerequisites](#prerequisites)
+ * [Building Node.js](#building-nodejs-1)
+ * [Running Tests](#running-tests)
+ * [Building the documentation](#building-the-documentation)
+ * [Building a debug build](#building-a-debug-build)
+ * [Windows](#windows-1)
+ * [Android/Android-based devices (e.g. Firefox OS)](#androidandroid-based-devices-eg-firefox-os)
+ * [`Intl` (ECMA-402) support](#intl-ecma-402-support)
+ * [Default: `small-icu` (English only) support](#default-small-icu-english-only-support)
+ * [Build with full ICU support (all locales supported by ICU)](#build-with-full-icu-support-all-locales-supported-by-icu)
+ * [Unix/macOS](#unixmacos-1)
+ * [Windows](#windows-2)
+ * [Building without Intl support](#building-without-intl-support)
+ * [Unix/macOS](#unixmacos-2)
+ * [Windows](#windows-3)
+ * [Use existing installed ICU (Unix/macOS only)](#use-existing-installed-icu-unixmacos-only)
+ * [Build with a specific ICU](#build-with-a-specific-icu)
+ * [Unix/macOS](#unixmacos-3)
+ * [Windows](#windows-4)
+* [Building Node.js with FIPS-compliant OpenSSL](#building-nodejs-with-fips-compliant-openssl)
+* [Building Node.js with external core modules](#building-nodejs-with-external-core-modules)
+ * [Unix/macOS](#unixmacos-4)
+ * [Windows](#windows-5)
+
## Supported platforms
This list of supported platforms is current as of the branch/release to
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8287ff65ad25c1..a0064c09fe77b3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -31,7 +31,8 @@ release.
-10.11.0
+10.12.0
+10.11.0 10.10.0 10.9.0 10.8.0
diff --git a/COLLABORATOR_GUIDE.md b/COLLABORATOR_GUIDE.md
index c073c07a7f0996..7a435c6478bf45 100644
--- a/COLLABORATOR_GUIDE.md
+++ b/COLLABORATOR_GUIDE.md
@@ -83,10 +83,11 @@ necessary.
### Author ready pull requests
A pull request that is still awaiting the minimum review time is considered
-_author ready_ as soon as the CI has been started, it has at least one approval,
-and it has no outstanding review comments. Please always make sure to add the
-`author ready` label to the PR in that case and remove it again as soon as that
-condition is not met anymore.
+_author ready_ as soon as the CI has been started, it has at least two approvals
+(one Collaborator approval is enough if the pull request has been open for more
+than 7 days), and it has no outstanding review comments. Please always make sure
+to add the `author ready` label to the PR in that case and remove it again as
+soon as that condition is not met anymore.
### Handling own pull requests
@@ -112,10 +113,11 @@ comment that explains why the PR does not require a CI run.
### Code Reviews
-All pull requests must be reviewed and accepted by a Collaborator with
-sufficient expertise who is able to take full responsibility for the
-change. In the case of pull requests proposed by an existing
-Collaborator, an additional Collaborator is required for sign-off.
+At least two Collaborators must approve a pull request before the pull request
+lands. (One Collaborator approval is enough if the pull request has been open
+for more than 7 days.) Approving a pull request indicates that the Collaborator
+accepts responsibility for the change. Approval must be from Collaborators who
+are not authors of the change.
In some cases, it may be necessary to summon a GitHub team to a pull request for
review by @-mention.
@@ -170,10 +172,10 @@ agenda.
### Waiting for Approvals
Before landing pull requests, sufficient time should be left for input
-from other Collaborators. In general, leave at least 48 hours during the
-week and 72 hours over weekends to account for international time
-differences and work schedules. However, certain types of pull requests
-can be fast-tracked and may be landed after a shorter delay. For example:
+from other Collaborators. In general, leave at least 48 hours to account for
+international time differences and work schedules. However, certain types of
+pull requests can be fast-tracked and may be landed after a shorter delay. For
+example:
* Focused changes that affect only documentation and/or the test suite:
* `code-and-learn` tasks typically fall into this category.
@@ -183,9 +185,12 @@ can be fast-tracked and may be landed after a shorter delay. For example:
* Regressions that happen right before a release, or reported soon after.
When a pull request is deemed suitable to be fast-tracked, label it with
-`fast-track`. The pull request can be landed once 2 or more Collaborators
-approve both the pull request and the fast-tracking request, and the necessary
-CI testing is done.
+`fast-track` and add a comment that collaborators may upvote. Please mention any
+Collaborators that previously approved the pull request. If someone disagrees
+with the fast-tracking request, remove the label and leave a comment indicating
+why the pull request should not be fast-tracked. The pull request can be landed
+once two or more Collaborators approve both the pull request and the
+fast-tracking request, and the necessary CI testing is done.
### Testing and CI
@@ -408,10 +413,6 @@ Pull requests introducing new core modules:
New core modules must be landed with a [Stability Index][] of Experimental,
and must remain Experimental until a semver-major release.
-For new modules that involve significant effort, non-trivial additions to
-Node.js or significant new capabilities, an [Enhancement Proposal][] is
-recommended but not required.
-
### Additions to N-API
N-API provides an ABI stable API that we will have to support in future
@@ -486,9 +487,8 @@ level.
### Involving the TSC
-Collaborators may opt to elevate pull requests or issues to the [TSC][] for
-discussion by assigning the `tsc-review` label or @-mentioning the
-`@nodejs/tsc` GitHub team. This should be done where a pull request:
+Collaborators may opt to elevate pull requests or issues to the [TSC][].
+This should be done where a pull request:
- is labeled `semver-major`, or
- has a significant impact on the codebase, or
@@ -496,6 +496,11 @@ discussion by assigning the `tsc-review` label or @-mentioning the
- has failed to reach consensus amongst the Collaborators who are
actively participating in the discussion.
+Assign the `tsc-review` label or @-mention the
+`@nodejs/tsc` GitHub team if you want to elevate an issue to the [TSC][].
+Do not use the GitHub UI on the right hand side to assign to
+`@nodejs/tsc` or request a review from `@nodejs/tsc`.
+
The TSC should serve as the final arbiter where required.
## Landing Pull Requests
@@ -695,9 +700,12 @@ $ git rev-list upstream/master...HEAD | xargs core-validate-commit
Optional: When landing your own commits, force push the amended commit to the
branch you used to open the pull request. If your branch is called `bugfix`,
then the command would be `git push --force-with-lease origin master:bugfix`.
-When the pull request is closed, this will cause the pull request to
-show the purple merged status rather than the red closed status that is
-usually used for pull requests that weren't merged.
+Don't manually close the PR, GitHub will close it automatically later after you
+push it upstream, and will mark it with the purple merged status rather than the
+red closed status. If you close the PR before GitHub adjusts its status, it will
+show up as a 0 commit PR and the changed file history will be empty. Also if you
+push upstream before you push to your branch, GitHub will close the issue with
+red status so the order of operations is important.
Time to push it:
@@ -846,7 +854,7 @@ LTS working group and the Release team.
| --- | --- |
| `benchmark/*` | @nodejs/benchmarking, @mscdex |
| `doc/*`, `*.md` | @nodejs/documentation |
-| `lib/assert` | @nodejs/testing |
+| `lib/assert` | @nodejs/assert |
| `lib/async_hooks` | @nodejs/async\_hooks for bugs/reviews (+ @nodejs/diagnostics for API) |
| `lib/buffer` | @nodejs/buffer |
| `lib/child_process` | @nodejs/child\_process |
@@ -889,7 +897,6 @@ When things need extra attention, are controversial, or `semver-major`:
If you cannot find who to cc for a file, `git shortlog -n -s ` may help.
["Merge Pull Request"]: https://help.github.com/articles/merging-a-pull-request/#merging-a-pull-request-on-github
-[Enhancement Proposal]: https://github.com/nodejs/node-eps
[Stability Index]: doc/api/documentation.md#stability-index
[TSC]: https://github.com/nodejs/TSC
[_Deprecation_]: https://en.wikipedia.org/wiki/Deprecation
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index cb8d20e90d005b..684277980a8ee6 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -11,6 +11,13 @@ small and all contributions are valued.
This guide explains the process for contributing to the Node.js project's core
`nodejs/node` GitHub Repository and describes what to expect at each step.
+## Contents
+
+* [Code of Conduct](#code-of-conduct)
+* [Issues](#issues)
+* [Pull Requests](#pull-requests)
+* [Developer's Certificate of Origin 1.1](#developers-certificate-of-origin-11)
+
## [Code of Conduct](./doc/guides/contributing/coc.md)
The Node.js project has a
diff --git a/CPP_STYLE_GUIDE.md b/CPP_STYLE_GUIDE.md
index 41e1f082f87751..ae0135b5c0bdff 100644
--- a/CPP_STYLE_GUIDE.md
+++ b/CPP_STYLE_GUIDE.md
@@ -20,6 +20,7 @@
* [Ownership and Smart Pointers](#ownership-and-smart-pointers)
* [Others](#others)
* [Type casting](#type-casting)
+ * [Using `auto`](#using-auto)
* [Do not include `*.h` if `*-inl.h` has already been included](#do-not-include-h-if--inlh-has-already-been-included)
* [Avoid throwing JavaScript errors in C++ methods](#avoid-throwing-javascript-errors-in-c)
* [Avoid throwing JavaScript errors in nested C++ methods](#avoid-throwing-javascript-errors-in-nested-c-methods)
@@ -32,11 +33,11 @@ these rules:
## Formatting
-## Left-leaning (C++ style) asterisks for pointer declarations
+### Left-leaning (C++ style) asterisks for pointer declarations
`char* buffer;` instead of `char *buffer;`
-## C++ style comments
+### C++ style comments
Use C++ style comments (`//`) for both single-line and multi-line comments.
Comments should also start with uppercase and finish with a dot.
@@ -56,7 +57,7 @@ preferred style. Feel free to update old comments to the preferred style when
working on code in the immediate vicinity or when changing/improving those
comments.
-## 2 spaces of indentation for blocks or bodies of conditionals
+### 2 spaces of indentation for blocks or bodies of conditionals
```c++
if (foo)
@@ -76,7 +77,7 @@ Braces are optional if the statement body only has one line.
`namespace`s receive no indentation on their own.
-## 4 spaces of indentation for statement continuations
+### 4 spaces of indentation for statement continuations
```c++
VeryLongTypeName very_long_result = SomeValueWithAVeryLongName +
@@ -85,7 +86,7 @@ VeryLongTypeName very_long_result = SomeValueWithAVeryLongName +
Operators are before the line break in these cases.
-## Align function arguments vertically
+### Align function arguments vertically
```c++
void FunctionWithAVeryLongName(int parameter_with_a_very_long_name,
@@ -101,7 +102,7 @@ void FunctionWithAReallyReallyReallyLongNameSeriouslyStopIt(
...);
```
-## Initialization lists
+### Initialization lists
Long initialization lists are formatted like this:
@@ -115,7 +116,7 @@ HandleWrap::HandleWrap(Environment* env,
handle_(handle) {
```
-## CamelCase for methods, functions, and classes
+### CamelCase for methods, functions, and classes
Exceptions are simple getters/setters, which are named `property_name()` and
`set_property_name()`, respectively.
@@ -131,7 +132,7 @@ class FooBar {
};
```
-## snake\_case for local variables and parameters
+### snake\_case for local variables and parameters
```c++
int FunctionThatDoesSomething(const char* important_string) {
@@ -139,7 +140,7 @@ int FunctionThatDoesSomething(const char* important_string) {
}
```
-## snake\_case\_ for private class fields
+### snake\_case\_ for private class fields
```c++
class Foo {
@@ -148,7 +149,7 @@ class Foo {
};
```
-## snake\_case\_ for C-like structs
+### snake\_case\_ for C-like structs
For plain C-like structs snake_case can be used.
```c++
@@ -157,7 +158,7 @@ struct foo_bar {
}
```
-## Space after `template`
+### Space after `template`
```c++
template
@@ -167,16 +168,16 @@ class FancyContainer {
```
## Memory Management
-## Memory allocation
+### Memory allocation
- `Malloc()`, `Calloc()`, etc. from `util.h` abort in Out-of-Memory situations
- `UncheckedMalloc()`, etc. return `nullptr` in OOM situations
-## Use `nullptr` instead of `NULL` or `0`
+### Use `nullptr` instead of `NULL` or `0`
What it says in the title.
-## Ownership and Smart Pointers
+### Ownership and Smart Pointers
"Smart" pointers are classes that act like pointers, e.g.
by overloading the `*` and `->` operators. Some smart pointer types can be
@@ -202,14 +203,32 @@ Never use `std::auto_ptr`. Instead, use `std::unique_ptr`.
## Others
-## Type casting
+### Type casting
- Always avoid C-style casts (`(type)value`)
- `dynamic_cast` does not work because RTTI is not enabled
- Use `static_cast` for casting whenever it works
- `reinterpret_cast` is okay if `static_cast` is not appropriate
-## Do not include `*.h` if `*-inl.h` has already been included
+### Using `auto`
+
+Being explicit about types is usually preferred over using `auto`.
+
+Use `auto` to avoid type names that are noisy, obvious, or unimportant. When
+doing so, keep in mind that explicit types often help with readability and
+verifying the correctness of code.
+
+```cpp
+for (const auto& item : some_map) {
+ const KeyType& key = item.first;
+ const ValType& value = item.second;
+ // The rest of the loop can now just refer to key and value,
+ // a reader can see the types in question, and we've avoided
+ // the too-common case of extra copies in this iteration.
+}
+```
+
+### Do not include `*.h` if `*-inl.h` has already been included
Do
@@ -224,7 +243,7 @@ instead of
#include "util-inl.h"
```
-## Avoid throwing JavaScript errors in C++
+### Avoid throwing JavaScript errors in C++
When there is a need to throw errors from a C++ binding method, try to
return the data necessary for constructing the errors to JavaScript,
@@ -278,7 +297,7 @@ exports.foo = function(str) {
};
```
-### Avoid throwing JavaScript errors in nested C++ methods
+#### Avoid throwing JavaScript errors in nested C++ methods
When you have to throw the errors from C++, try to do it at the top level and
not inside of nested calls.
diff --git a/GOVERNANCE.md b/GOVERNANCE.md
index 83d4d9b50a7abe..40ef6e7bbe5fcb 100644
--- a/GOVERNANCE.md
+++ b/GOVERNANCE.md
@@ -32,11 +32,13 @@ Their privileges include but are not limited to:
Modifications of the contents of the nodejs/node repository are made on
a collaborative basis. Anybody with a GitHub account may propose a
modification via pull request and it will be considered by the project
-Collaborators. All pull requests must be reviewed and accepted by a
-Collaborator with sufficient expertise who is able to take full
-responsibility for the change. In the case of pull requests proposed
-by an existing Collaborator, an additional Collaborator is required
-for sign-off.
+Collaborators.
+
+At least two Collaborators must approve a pull request before the pull request
+lands. (One Collaborator approval is enough if the pull request has been open
+for more than 7 days.) Approving a pull request indicates that the Collaborator
+accepts responsibility for the change. Approval must be from Collaborators who
+are not authors of the change.
If one or more Collaborators oppose a proposed change, then the change cannot
be accepted unless:
diff --git a/Makefile b/Makefile
index 5fc2bb0c58f553..05d3056f27973e 100644
--- a/Makefile
+++ b/Makefile
@@ -74,9 +74,9 @@ available-node = \
# BUILDTYPE=Debug builds both release and debug builds. If you want to compile
# just the debug build, run `make -C out BUILDTYPE=Debug` instead.
ifeq ($(BUILDTYPE),Release)
-all: out/Makefile $(NODE_EXE) ## Default target, builds node in out/Release/node.
+all: $(NODE_EXE) ## Default target, builds node in out/Release/node.
else
-all: out/Makefile $(NODE_EXE) $(NODE_G_EXE)
+all: $(NODE_EXE) $(NODE_G_EXE)
endif
.PHONY: help
@@ -278,8 +278,6 @@ jstest: build-addons build-addons-napi ## Runs addon tests and JS tests
.PHONY: test
# This does not run tests of third-party libraries inside deps.
test: all ## Runs default tests, linters, and builds docs.
- @echo "Build the addons before running the tests so the test results"
- @echo "can be displayed together"
$(MAKE) -s test-doc
$(MAKE) -s build-addons
$(MAKE) -s build-addons-napi
@@ -288,8 +286,6 @@ test: all ## Runs default tests, linters, and builds docs.
.PHONY: test-only
test-only: all ## For a quick test, does not run linter or build docs.
- @echo "Build the addons before running the tests so the test results"
- @echo "can be displayed together"
$(MAKE) build-addons
$(MAKE) build-addons-napi
$(MAKE) cctest
@@ -297,8 +293,6 @@ test-only: all ## For a quick test, does not run linter or build docs.
# Used by `make coverage-test`
test-cov: all
- @echo "Build the addons before running the tests so the test results"
- @echo "can be displayed together"
$(MAKE) build-addons
$(MAKE) build-addons-napi
# $(MAKE) cctest
@@ -476,7 +470,7 @@ test-ci: | clear-stalled build-addons build-addons-napi doc-only
# Prepare the build for running the tests.
# Related CI jobs: most CI tests, excluding node-test-commit-arm-fanned
build-ci:
- $(PYTHON) ./configure $(CONFIG_FLAGS)
+ $(PYTHON) ./configure --verbose $(CONFIG_FLAGS)
$(MAKE)
.PHONY: run-ci
@@ -603,11 +597,6 @@ test-v8 test-v8-intl test-v8-benchmarks test-v8-all:
"$ git clone https://github.com/nodejs/node.git"
endif
-# Google Analytics ID used for tracking API docs page views, empty
-# DOCS_ANALYTICS means no tracking scripts will be included in the
-# generated .html files
-DOCS_ANALYTICS ?=
-
apidoc_dirs = out/doc out/doc/api out/doc/api/assets
apidoc_sources = $(wildcard doc/api/*.md)
apidocs_html = $(addprefix out/,$(apidoc_sources:.md=.html))
@@ -652,8 +641,7 @@ out/doc/api/assets/%: doc/api_assets/% out/doc/api/assets
run-npm-ci = $(PWD)/$(NPM) ci
gen-api = tools/doc/generate.js --node-version=$(FULLVERSION) \
- --apilinks=out/apilinks.json \
- --analytics=$(DOCS_ANALYTICS) $< --output-directory=out/doc/api
+ --apilinks=out/apilinks.json $< --output-directory=out/doc/api
gen-apilink = tools/doc/apilinks.js $(wildcard lib/*.js) > $@
out/apilinks.json: $(wildcard lib/*.js) tools/doc/apilinks.js
@@ -1081,8 +1069,8 @@ run-lint-doc-md = tools/lint-md.js -q -f $(LINT_MD_DOC_FILES)
# Lint all changed markdown files under doc/
tools/.docmdlintstamp: $(LINT_MD_DOC_FILES)
@echo "Running Markdown linter on docs..."
- $(call available-node,$(run-lint-doc-md))
- touch $@
+ @$(call available-node,$(run-lint-doc-md))
+ @touch $@
LINT_MD_TARGETS = src lib benchmark test tools/doc tools/icu
LINT_MD_ROOT_DOCS := $(wildcard *.md)
@@ -1093,8 +1081,8 @@ run-lint-misc-md = tools/lint-md.js -q -f $(LINT_MD_MISC_FILES)
# Lint other changed markdown files maintained by us
tools/.miscmdlintstamp: $(LINT_MD_MISC_FILES)
@echo "Running Markdown linter on misc docs..."
- $(call available-node,$(run-lint-misc-md))
- touch $@
+ @$(call available-node,$(run-lint-misc-md))
+ @touch $@
tools/.mdlintstamp: tools/.miscmdlintstamp tools/.docmdlintstamp
@@ -1193,19 +1181,25 @@ else
@echo "To install (requires internet access) run: $ make format-cpp-build"
endif
+ifeq ($(V),1)
+ CPPLINT_QUIET =
+else
+ CPPLINT_QUIET = --quiet
+endif
.PHONY: lint-cpp
# Lints the C++ code with cpplint.py and check-imports.py.
lint-cpp: tools/.cpplintstamp
tools/.cpplintstamp: $(LINT_CPP_FILES)
@echo "Running C++ linter..."
- @$(PYTHON) tools/cpplint.py $?
+ @$(PYTHON) tools/cpplint.py $(CPPLINT_QUIET) $?
@$(PYTHON) tools/check-imports.py
@touch $@
lint-addon-docs: test/addons/.docbuildstamp
@echo "Running C++ linter on addon docs..."
- @$(PYTHON) tools/cpplint.py --filter=$(ADDON_DOC_LINT_FLAGS) $(LINT_CPP_ADDON_DOC_FILES_GLOB)
+ @$(PYTHON) tools/cpplint.py $(CPPLINT_QUIET) --filter=$(ADDON_DOC_LINT_FLAGS) \
+ $(LINT_CPP_ADDON_DOC_FILES_GLOB)
cpplint: lint-cpp
@echo "Please use lint-cpp instead of cpplint"
diff --git a/README.md b/README.md
index 15cbb2133351f3..47e178845d1dbf 100644
--- a/README.md
+++ b/README.md
@@ -9,13 +9,10 @@
Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine. For
-more information on using Node.js, see the
-[Node.js Website][].
+more information on using Node.js, see the [Node.js Website][].
-The Node.js project is supported by the
-[Node.js Foundation](https://nodejs.org/en/foundation/). Contributions,
-policies, and releases are managed under an
-[open governance model](./GOVERNANCE.md).
+The Node.js project uses an [open governance model](./GOVERNANCE.md). The
+[Node.js Foundation][] provides support for the project.
**This project is bound by a [Code of Conduct][].**
@@ -49,8 +46,8 @@ When looking for support, please first search for your question in these venues:
* [Node.js Help][]
* [Open or closed issues in the Node.js GitHub organization](https://github.com/issues?utf8=%E2%9C%93&q=sort%3Aupdated-desc+org%3Anodejs+is%3Aissue)
-If you didn't find an answer in one of the official resources above, you can
-search these unofficial resources:
+If you didn't find an answer in the resources above, try these unofficial
+resources:
* [Questions tagged 'node.js' on StackOverflow][]
* [#node.js channel on chat.freenode.net][]. See for more
@@ -59,72 +56,69 @@ search these unofficial resources:
* [Node.js Slack Community](https://node-js.slack.com/): Visit
[nodeslackers.com](http://www.nodeslackers.com/) to register.
-GitHub issues are meant for tracking enhancements and bugs, not general support.
+GitHub issues are for tracking enhancements and bugs, not general support.
-Remember, libre != gratis; the open source license grants you the freedom to use
-and modify, but not commitments of other people's time. Please be respectful,
-and set your expectations accordingly.
+The open source license grants you the freedom to use Node.js. It does not
+guarantee commitments of other people's time. Please be respectful and manage
+your expectations.
-## Release Types
+## Release Types
-The Node.js project maintains multiple types of releases:
-
-* **Current**: Released from active development branches of this repository,
- versioned by [SemVer](https://semver.org) and signed by a member of the
- [Release Team](#release-team).
- Code for Current releases is organized in this repository by major version
- number. For example: [v4.x](https://github.com/nodejs/node/tree/v4.x).
- The major version number of Current releases will increment every 6 months
- allowing for breaking changes to be introduced. This happens in April and
- October every year. Current release lines beginning in October each year have
- a maximum support life of 8 months. Current release lines beginning in April
- each year will convert to LTS (see below) after 6 months and receive further
- support for 30 months.
+* **Current**: Under active development. Code for the Current release is in the
+ branch for its major version number (for example,
+ [v10.x](https://github.com/nodejs/node/tree/v10.x)). Node.js releases a new
+ major version every 6 months, allowing for breaking changes. This happens in
+ April and October every year. Releases appearing each October have a support
+ life of 8 months. Releases appearing each April convert to LTS (see below)
+ each October.
* **LTS**: Releases that receive Long-term Support, with a focus on stability
- and security. Every second Current release line (major version) will become an
- LTS line and receive 18 months of _Active LTS_ support and a further 12
- months of _Maintenance_. LTS release lines are given alphabetically
- ordered codenames, beginning with v4 Argon. LTS releases are less frequent
- and will attempt to maintain consistent major and minor version numbers,
- only incrementing patch version numbers. There are no breaking changes or
- feature additions, except in some special circumstances.
-* **Nightly**: Versions of code in this repository on the current Current
- branch, automatically built every 24-hours where changes exist. Use with
- caution.
-
-More information can be found in the [LTS README](https://github.com/nodejs/LTS/).
+ and security. Every even-numbered major version will become an LTS release.
+ LTS releases receive 18 months of _Active LTS_ support and a further 12 months
+ of _Maintenance_. LTS release lines have alphabetically-ordered codenames,
+ beginning with v4 Argon. There are no breaking changes or feature additions,
+ except in some special circumstances.
+* **Nightly**: Code from the Current branch built every 24-hours when there are
+ changes. Use with caution.
+
+Current and LTS releases follow [Semantic Versioning](https://semver.org). A
+member of the [Release Team](#release-team) signs each Current and LTS release.
+For more information, see the
+[Release README](https://github.com/nodejs/Release).
### Download
Binaries, installers, and source tarballs are available at
-.
+.
#### Current and LTS Releases
-**Current** and **LTS** releases are available at
-, listed under their version strings.
+
+
The [latest](https://nodejs.org/download/release/latest/) directory is an
-alias for the latest Current release. The latest LTS release from an LTS
-line is available in the form: latest-_codename_. For example:
-.
+alias for the latest Current release. The latest-_codename_ directory is an
+alias for the latest release from an LTS line. For example, the
+[latest-carbon](https://nodejs.org/download/release/latest-carbon/) directory
+contains the latest Carbon (Node.js 8) release.
#### Nightly Releases
-**Nightly** builds are available at
-, listed under their version
-string which includes their date (in UTC time) and the commit SHA at
-the HEAD of the release.
+
+
+Each directory name and filename contains a date (in UTC time) and the commit
+SHA at the HEAD of the release.
#### API Documentation
-**API documentation** is available in each release and nightly
-directory under _docs_. points to the API
-documentation of the latest stable version.
+
+Documentation for the latest Current release is at .
+Version-specific documentation is available in each release directory in the
+_docs_ subdirectory. Version-specific documentation is also at
+.
+
### Verifying Binaries
-Current, LTS, and Nightly download directories all contain a SHASUMS256.txt
-file that lists the SHA checksums for each file available for
-download.
+Download directories contain a `SHASUMS256.txt` file with SHA checksums for the
+files.
-The SHASUMS256.txt can be downloaded using `curl`.
+To download `SHASUMS256.txt` using `curl`:
```console
$ curl -O https://nodejs.org/dist/vx.y.z/SHASUMS256.txt
@@ -137,14 +131,11 @@ it through `sha256sum` with a command such as:
$ grep node-vx.y.z.tar.gz SHASUMS256.txt | sha256sum -c -
```
-Current and LTS releases (but not Nightlies) also have the GPG detached
-signature of SHASUMS256.txt available as SHASUMS256.txt.sig. You can use `gpg`
-to verify that SHASUMS256.txt has not been tampered with.
-
-To verify SHASUMS256.txt has not been altered, you will first need to import
-all of the GPG keys of individuals authorized to create releases. They are
-listed at the bottom of this README under [Release Team](#release-team).
-Use a command such as this to import the keys:
+For Current and LTS, the GPG detached signature of `SHASUMS256.txt` is in
+`SHASUMS256.txt.sig`. You can use it with `gpg` to verify the integrity of
+`SHASUM256.txt`. You will first need to import all the GPG keys of individuals
+authorized to create releases. They are at the bottom of this README under
+[Release Team](#release-team). To import the keys:
```console
$ gpg --keyserver pool.sks-keyservers.net --recv-keys DD8F2338BAE7501E3DD5AC78C273792F7D83545D
@@ -152,24 +143,19 @@ $ gpg --keyserver pool.sks-keyservers.net --recv-keys DD8F2338BAE7501E3DD5AC78C2
See the bottom of this README for a full script to import active release keys.
-Next, download the SHASUMS256.txt.sig for the release:
+Next, download the `SHASUMS256.txt.sig` for the release:
```console
$ curl -O https://nodejs.org/dist/vx.y.z/SHASUMS256.txt.sig
```
-After downloading the appropriate SHASUMS256.txt and SHASUMS256.txt.sig files,
-you can then use `gpg --verify SHASUMS256.txt.sig SHASUMS256.txt` to verify
-that the file has been signed by an authorized member of the Node.js team.
-
-Once verified, use the SHASUMS256.txt file to get the checksum for
-the binary verification command above.
+Then use `gpg --verify SHASUMS256.txt.sig SHASUMS256.txt` to verify
+the file's signature.
## Building Node.js
-See [BUILDING.md](BUILDING.md) for instructions on how to build
-Node.js from source. The document also contains a list of
-officially supported platforms.
+See [BUILDING.md](BUILDING.md) for instructions on how to build Node.js from
+source and a list of supported platforms.
## Security
@@ -251,8 +237,6 @@ For more information about the governance of the Node.js project, see
**Jeremiah Senkpiel** <fishrock123@rocketmail.com>
* [gabrielschulhof](https://github.com/gabrielschulhof) -
**Gabriel Schulhof** <gabriel.schulhof@intel.com>
-* [gibfahn](https://github.com/gibfahn) -
-**Gibson Fahnestock** <gibfahn@gmail.com> (he/him)
* [jasnell](https://github.com/jasnell) -
**James M Snell** <jasnell@gmail.com> (he/him)
* [joyeecheung](https://github.com/joyeecheung) -
@@ -284,6 +268,8 @@ For more information about the governance of the Node.js project, see
**Chris Dickinson** <christopher.s.dickinson@gmail.com>
* [evanlucas](https://github.com/evanlucas) -
**Evan Lucas** <evanlucas@me.com> (he/him)
+* [gibfahn](https://github.com/gibfahn) -
+**Gibson Fahnestock** <gibfahn@gmail.com> (he/him)
* [indutny](https://github.com/indutny) -
**Fedor Indutny** <fedor.indutny@gmail.com>
* [isaacs](https://github.com/isaacs) -
@@ -361,6 +347,8 @@ For more information about the governance of the Node.js project, see
**Jamie Davis** <davisjam@vt.edu> (he/him)
* [devsnek](https://github.com/devsnek) -
**Gus Caplan** <me@gus.host> (he/him)
+* [digitalinfinity](https://github.com/digitalinfinity) -
+**Hitesh Kanwathirtha** <digitalinfinity@gmail.com> (he/him)
* [edsadr](https://github.com/edsadr) -
**Adrian Estrada** <edsadr@gmail.com> (he/him)
* [eljefedelrodeodeljefe](https://github.com/eljefedelrodeodeljefe) -
@@ -618,8 +606,8 @@ gpg --keyserver pool.sks-keyservers.net --recv-keys C4F0DFFF4E8C1A8236409D08E73B
gpg --keyserver pool.sks-keyservers.net --recv-keys DD8F2338BAE7501E3DD5AC78C273792F7D83545D
```
-See the section above on [Verifying Binaries](#verifying-binaries) for details
-on what to do with these keys to verify that a downloaded file is official.
+See the section above on [Verifying Binaries](#verifying-binaries) for how to
+use these keys to verify a downloaded file.
Previous releases may also have been signed with one of the following GPG keys:
@@ -643,6 +631,7 @@ Previous releases may also have been signed with one of the following GPG keys:
[Code of Conduct]: https://github.com/nodejs/admin/blob/master/CODE_OF_CONDUCT.md
[Contributing to the project]: CONTRIBUTING.md
[Node.js Help]: https://github.com/nodejs/help
+[Node.js Foundation]: https://nodejs.org/en/foundation/
[Node.js Website]: https://nodejs.org/en/
[Questions tagged 'node.js' on StackOverflow]: https://stackoverflow.com/questions/tagged/node.js
[Working Groups]: https://github.com/nodejs/TSC/blob/master/WORKING_GROUPS.md
diff --git a/benchmark/crypto/get-ciphers.js b/benchmark/crypto/get-ciphers.js
index d4c10a2427d360..5bbe0915311484 100644
--- a/benchmark/crypto/get-ciphers.js
+++ b/benchmark/crypto/get-ciphers.js
@@ -10,7 +10,7 @@ const bench = common.createBenchmark(main, {
function main({ n, v }) {
const method = require(v).getCiphers;
var i = 0;
- // First call to getChipers will dominate the results
+ // First call to getCiphers will dominate the results
if (n > 1) {
for (; i < n; i++)
method();
diff --git a/benchmark/fs/bench-mkdirp.js b/benchmark/fs/bench-mkdirp.js
new file mode 100644
index 00000000000000..96a792c35a48e4
--- /dev/null
+++ b/benchmark/fs/bench-mkdirp.js
@@ -0,0 +1,23 @@
+'use strict';
+
+const common = require('../common');
+const fs = require('fs');
+const tmpdir = require('../../test/common/tmpdir');
+tmpdir.refresh();
+let dirc = 0;
+
+const bench = common.createBenchmark(main, {
+ n: [1e4],
+});
+
+function main({ n }) {
+ bench.start();
+ (function r(cntr) {
+ if (cntr-- <= 0)
+ return bench.end(n);
+ const pathname = `${tmpdir.path}/${++dirc}/${++dirc}/${++dirc}/${++dirc}`;
+ fs.mkdir(pathname, { createParents: true }, (err) => {
+ r(cntr);
+ });
+ }(n));
+}
diff --git a/benchmark/napi/function_args/index.js b/benchmark/napi/function_args/index.js
index c8f281a3429fde..4beab531c17301 100644
--- a/benchmark/napi/function_args/index.js
+++ b/benchmark/napi/function_args/index.js
@@ -12,16 +12,14 @@ let napi;
try {
v8 = require('./build/Release/binding');
} catch (err) {
- // eslint-disable-next-line no-path-concat
- console.error(__filename + ': V8 Binding failed to load');
+ console.error(`${__filename}: V8 Binding failed to load`);
process.exit(0);
}
try {
napi = require('./build/Release/napi_binding');
} catch (err) {
- // eslint-disable-next-line no-path-concat
- console.error(__filename + ': NAPI-Binding failed to load');
+ console.error(`${__filename}: NAPI-Binding failed to load`);
process.exit(0);
}
diff --git a/benchmark/util/format.js b/benchmark/util/format.js
index 042b8a93ccfcf2..2a4a20097c72d3 100644
--- a/benchmark/util/format.js
+++ b/benchmark/util/format.js
@@ -16,7 +16,7 @@ const inputs = {
};
const bench = common.createBenchmark(main, {
- n: [4e6],
+ n: [1e5],
type: Object.keys(inputs)
});
diff --git a/benchmark/util/inspect-array.js b/benchmark/util/inspect-array.js
index 8b3c54aeb942fe..4fd73785f789d1 100644
--- a/benchmark/util/inspect-array.js
+++ b/benchmark/util/inspect-array.js
@@ -4,8 +4,8 @@ const common = require('../common');
const util = require('util');
const bench = common.createBenchmark(main, {
- n: [1e3],
- len: [1e5],
+ n: [5e2],
+ len: [1e2, 1e5],
type: [
'denseArray',
'sparseArray',
diff --git a/benchmark/util/inspect-proxy.js b/benchmark/util/inspect-proxy.js
index 5427df9952c250..3c82d50ac3c0ce 100644
--- a/benchmark/util/inspect-proxy.js
+++ b/benchmark/util/inspect-proxy.js
@@ -3,7 +3,7 @@
const util = require('util');
const common = require('../common.js');
-const bench = common.createBenchmark(main, { n: [1e6] });
+const bench = common.createBenchmark(main, { n: [2e4] });
function main({ n }) {
const proxyA = new Proxy({}, { get: () => {} });
diff --git a/benchmark/util/inspect.js b/benchmark/util/inspect.js
index 35253ac96682eb..9ba3020fd0e55b 100644
--- a/benchmark/util/inspect.js
+++ b/benchmark/util/inspect.js
@@ -9,7 +9,7 @@ const opts = {
none: undefined
};
const bench = common.createBenchmark(main, {
- n: [2e6],
+ n: [2e4],
method: [
'Object',
'Object_empty',
@@ -81,7 +81,7 @@ function main({ method, n, option }) {
benchmark(n, new Error('error'), options);
break;
case 'Array':
- benchmark(n, Array(20).fill().map((_, i) => i), options);
+ benchmark(n, Array(50).fill().map((_, i) => i), options);
break;
case 'TypedArray':
obj = new Uint8Array(Array(50).fill().map((_, i) => i));
diff --git a/benchmark/util/normalize-encoding.js b/benchmark/util/normalize-encoding.js
index 73cbadff72b8ca..47c8bce277cf3d 100644
--- a/benchmark/util/normalize-encoding.js
+++ b/benchmark/util/normalize-encoding.js
@@ -5,26 +5,23 @@ const assert = require('assert');
const groupedInputs = {
group_common: ['undefined', 'utf8', 'utf-8', 'base64',
- 'binary', 'latin1', 'ucs-2'],
- group_upper: ['UTF-8', 'UTF8', 'UCS2', 'UTF-16LE',
- 'UTF16LE', 'BASE64', 'UCS-2'],
- group_uncommon: ['foo', '1', 'false', 'undefined', '[]', '{}'],
+ 'binary', 'latin1', 'ucs2'],
+ group_upper: ['UTF-8', 'UTF8', 'UCS2',
+ 'UTF16LE', 'BASE64', 'UCS2'],
+ group_uncommon: ['foo'],
group_misc: ['', 'utf16le', 'hex', 'HEX', 'BINARY']
};
const inputs = [
- '',
- 'utf8', 'utf-8', 'UTF-8',
- 'UTF8', 'Utf8', 'uTf-8', 'utF-8',
- 'ucs2', 'UCS2', 'UcS2',
- 'ucs-2', 'UCS-2', 'UcS-2',
- 'utf16le', 'utf-16le', 'UTF-16LE', 'UTF16LE',
+ '', 'utf8', 'utf-8', 'UTF-8', 'UTF8', 'Utf8',
+ 'ucs2', 'UCS2', 'utf16le', 'UTF16LE',
'binary', 'BINARY', 'latin1', 'base64', 'BASE64',
- 'hex', 'HEX', 'foo', '1', 'false', 'undefined', '[]', '{}'];
+ 'hex', 'HEX', 'foo', 'undefined'
+];
const bench = common.createBenchmark(main, {
input: inputs.concat(Object.keys(groupedInputs)),
- n: [1e7]
+ n: [1e5]
}, {
flags: '--expose-internals'
});
@@ -39,16 +36,8 @@ function getInput(input) {
return groupedInputs.group_uncommon;
case 'group_misc':
return groupedInputs.group_misc;
- case '1':
- return [1];
- case 'false':
- return [false];
case 'undefined':
return [undefined];
- case '[]':
- return [[]];
- case '{}':
- return [{}];
default:
return [input];
}
diff --git a/benchmark/util/splice-one.js b/benchmark/util/splice-one.js
index 5c2a39f6d72a11..4ca7c8564d3fc4 100644
--- a/benchmark/util/splice-one.js
+++ b/benchmark/util/splice-one.js
@@ -3,7 +3,7 @@
const common = require('../common');
const bench = common.createBenchmark(main, {
- n: [1e7],
+ n: [1e5],
pos: ['start', 'middle', 'end'],
size: [10, 100, 500],
}, { flags: ['--expose-internals'] });
diff --git a/benchmark/util/type-check.js b/benchmark/util/type-check.js
index e1d1ac553fedcf..dc07f4f9d952bd 100644
--- a/benchmark/util/type-check.js
+++ b/benchmark/util/type-check.js
@@ -29,7 +29,7 @@ const bench = common.createBenchmark(main, {
type: Object.keys(args),
version: ['native', 'js'],
argument: ['true', 'false-primitive', 'false-object'],
- n: [5e6]
+ n: [1e5]
}, {
flags: ['--expose-internals']
});
diff --git a/common.gypi b/common.gypi
index e9e05049dbb265..c235f07712c74f 100644
--- a/common.gypi
+++ b/common.gypi
@@ -9,6 +9,8 @@
'library%': 'static_library', # allow override to 'shared_library' for DLL/.so builds
'component%': 'static_library', # NB. these names match with what V8 expects
'msvs_multi_core_compile': '0', # we do enable multicore compiles, but not using the V8 way
+ 'enable_pgo_generate%': '0',
+ 'enable_pgo_use%': '0',
'python%': 'python',
'node_shared%': 'false',
@@ -22,6 +24,8 @@
'node_tag%': '',
'uv_library%': 'static_library',
+ 'clang%': 0,
+
'openssl_fips%': '',
# Default to -O0 for debug builds.
@@ -29,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.28',
+ 'v8_embedder_string': '-node.35',
# Enable disassembler for `--print-code` v8 options
'v8_enable_disassembler': 1,
@@ -91,8 +95,6 @@
}],
['OS=="mac"', {
'clang%': 1,
- }, {
- 'clang%': 0,
}],
],
},
@@ -179,9 +181,19 @@
}],
['OS=="linux"', {
'variables': {
+ 'pgo_generate': ' -fprofile-generate ',
+ 'pgo_use': ' -fprofile-use -fprofile-correction ',
'lto': ' -flto=4 -fuse-linker-plugin -ffat-lto-objects ',
},
'conditions': [
+ ['enable_pgo_generate=="true"', {
+ 'cflags': ['<(pgo_generate)'],
+ 'ldflags': ['<(pgo_generate)'],
+ },],
+ ['enable_pgo_use=="true"', {
+ 'cflags': ['<(pgo_use)'],
+ 'ldflags': ['<(pgo_use)'],
+ },],
['enable_lto=="true"', {
'cflags': ['<(lto)'],
'ldflags': ['<(lto)'],
diff --git a/configure.py b/configure.py
index 11f7bad38a3d7f..b98e37d944d7f0 100755
--- a/configure.py
+++ b/configure.py
@@ -132,11 +132,23 @@
"JavaScript code executed in nodejs. This feature is only available "
"for x32, x86, and x64 architectures.")
+parser.add_option("--enable-pgo-generate",
+ action="store_true",
+ dest="enable_pgo_generate",
+ help="Enable profiling with pgo of a binary. This feature is only available "
+ "on linux with gcc and g++ 5.4.1 or newer.")
+
+parser.add_option("--enable-pgo-use",
+ action="store_true",
+ dest="enable_pgo_use",
+ help="Enable use of the profile generated with --enable-pgo-generate. This "
+ "feature is only available on linux with gcc and g++ 5.4.1 or newer.")
+
parser.add_option("--enable-lto",
action="store_true",
dest="enable_lto",
help="Enable compiling with lto of a binary. This feature is only available "
- "on linux with gcc and g++.")
+ "on linux with gcc and g++ 5.4.1 or newer.")
parser.add_option("--link-module",
action="append",
@@ -550,7 +562,7 @@
parser.add_option('--verbose',
action='store_true',
dest='verbose',
- default=False,
+ default=True,
help='get more output from this script')
# Create compile_commands.json in out/Debug and out/Release.
@@ -887,6 +899,16 @@ def configure_mips(o):
o['variables']['mips_fpu_mode'] = options.mips_fpu_mode
+def gcc_version_ge(version_checked):
+ for compiler in [(CC, 'c'), (CXX, 'c++')]:
+ ok, is_clang, clang_version, compiler_version = \
+ try_check_compiler(compiler[0], compiler[1])
+ compiler_version_num = tuple(map(int, compiler_version))
+ if is_clang or compiler_version_num < version_checked:
+ return False
+ return True
+
+
def configure_node(o):
if options.dest_os == 'android':
o['variables']['OS'] = 'android'
@@ -931,6 +953,29 @@ def configure_node(o):
else:
o['variables']['node_enable_v8_vtunejit'] = 'false'
+ if flavor != 'linux' and (options.enable_pgo_generate or options.enable_pgo_use):
+ raise Exception(
+ 'The pgo option is supported only on linux.')
+
+ if flavor == 'linux':
+ if options.enable_pgo_generate or options.enable_pgo_use:
+ version_checked = (5, 4, 1)
+ if not gcc_version_ge(version_checked):
+ version_checked_str = ".".join(map(str, version_checked))
+ raise Exception(
+ 'The options --enable-pgo-generate and --enable-pgo-use '
+ 'are supported for gcc and gxx %s or newer only.' % (version_checked_str))
+
+ if options.enable_pgo_generate and options.enable_pgo_use:
+ raise Exception(
+ 'Only one of the --enable-pgo-generate or --enable-pgo-use options '
+ 'can be specified at a time. You would like to use '
+ '--enable-pgo-generate first, profile node, and then recompile '
+ 'with --enable-pgo-use')
+
+ o['variables']['enable_pgo_generate'] = b(options.enable_pgo_generate)
+ o['variables']['enable_pgo_use'] = b(options.enable_pgo_use)
+
if flavor != 'linux' and (options.enable_lto):
raise Exception(
'The lto option is supported only on linux.')
@@ -938,15 +983,11 @@ def configure_node(o):
if flavor == 'linux':
if options.enable_lto:
version_checked = (5, 4, 1)
- for compiler in [(CC, 'c'), (CXX, 'c++')]:
- ok, is_clang, clang_version, compiler_version = \
- try_check_compiler(compiler[0], compiler[1])
- compiler_version_num = tuple(map(int, compiler_version))
- if is_clang or compiler_version_num < version_checked:
- version_checked_str = ".".join(map(str, version_checked))
- raise Exception(
- 'The option --enable-lto is supported for gcc and gxx %s'
- ' or newer only.' % (version_checked_str))
+ if not gcc_version_ge(version_checked):
+ version_checked_str = ".".join(map(str, version_checked))
+ raise Exception(
+ 'The option --enable-lto is supported for gcc and gxx %s'
+ ' or newer only.' % (version_checked_str))
o['variables']['enable_lto'] = b(options.enable_lto)
@@ -1185,7 +1226,6 @@ def configure_static(o):
def write(filename, data):
- filename = filename
print_verbose('creating %s' % filename)
with open(filename, 'w+') as f:
f.write(data)
diff --git a/deps/nghttp2/lib/includes/nghttp2/nghttp2.h b/deps/nghttp2/lib/includes/nghttp2/nghttp2.h
index 8c54b9c8cc464d..e7198b3d27314d 100644
--- a/deps/nghttp2/lib/includes/nghttp2/nghttp2.h
+++ b/deps/nghttp2/lib/includes/nghttp2/nghttp2.h
@@ -680,7 +680,12 @@ typedef enum {
/**
* SETTINGS_MAX_HEADER_LIST_SIZE
*/
- NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE = 0x06
+ NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE = 0x06,
+ /**
+ * SETTINGS_ENABLE_CONNECT_PROTOCOL
+ * (`RFC 8441 `_)
+ */
+ NGHTTP2_SETTINGS_ENABLE_CONNECT_PROTOCOL = 0x08
} nghttp2_settings_id;
/* Note: If we add SETTINGS, update the capacity of
NGHTTP2_INBOUND_NUM_IV as well */
diff --git a/deps/nghttp2/lib/includes/nghttp2/nghttp2ver.h b/deps/nghttp2/lib/includes/nghttp2/nghttp2ver.h
index 1f1d4808ca27c0..420adbd53dddce 100644
--- a/deps/nghttp2/lib/includes/nghttp2/nghttp2ver.h
+++ b/deps/nghttp2/lib/includes/nghttp2/nghttp2ver.h
@@ -29,7 +29,7 @@
* @macro
* Version number of the nghttp2 library release
*/
-#define NGHTTP2_VERSION "1.33.0"
+#define NGHTTP2_VERSION "1.34.0"
/**
* @macro
@@ -37,6 +37,6 @@
* release. This is a 24 bit number with 8 bits for major number, 8 bits
* for minor and 8 bits for patch. Version 1.2.3 becomes 0x010203.
*/
-#define NGHTTP2_VERSION_NUM 0x012100
+#define NGHTTP2_VERSION_NUM 0x012200
#endif /* NGHTTP2VER_H */
diff --git a/deps/nghttp2/lib/nghttp2_frame.c b/deps/nghttp2/lib/nghttp2_frame.c
index 6e33f3c247f5cb..4821de40885736 100644
--- a/deps/nghttp2/lib/nghttp2_frame.c
+++ b/deps/nghttp2/lib/nghttp2_frame.c
@@ -1050,6 +1050,11 @@ int nghttp2_iv_check(const nghttp2_settings_entry *iv, size_t niv) {
break;
case NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE:
break;
+ case NGHTTP2_SETTINGS_ENABLE_CONNECT_PROTOCOL:
+ if (iv[i].value != 0 && iv[i].value != 1) {
+ return 0;
+ }
+ break;
}
}
return 1;
diff --git a/deps/nghttp2/lib/nghttp2_hd.c b/deps/nghttp2/lib/nghttp2_hd.c
index 1eb3be33802c44..a61f0d47a6f79d 100644
--- a/deps/nghttp2/lib/nghttp2_hd.c
+++ b/deps/nghttp2/lib/nghttp2_hd.c
@@ -45,7 +45,7 @@
/* 3rd parameter is nghttp2_token value for header field name. We use
first enum value if same header names are repeated (e.g.,
:status). */
-static nghttp2_hd_static_entry static_table[] = {
+static const nghttp2_hd_static_entry static_table[] = {
MAKE_STATIC_ENT(":authority", "", 0, 3153725150u),
MAKE_STATIC_ENT(":method", "GET", 1, 695666056u),
MAKE_STATIC_ENT(":method", "POST", 1, 695666056u),
@@ -271,6 +271,15 @@ static int32_t lookup_token(const uint8_t *name, size_t namelen) {
break;
}
break;
+ case 9:
+ switch (name[8]) {
+ case 'l':
+ if (memeq(":protoco", name, 8)) {
+ return NGHTTP2_TOKEN__PROTOCOL;
+ }
+ break;
+ }
+ break;
case 10:
switch (name[9]) {
case 'e':
@@ -1159,7 +1168,7 @@ static search_result search_static_table(const nghttp2_nv *nv, int32_t token,
int name_only) {
search_result res = {token, 0};
int i;
- nghttp2_hd_static_entry *ent;
+ const nghttp2_hd_static_entry *ent;
if (name_only) {
return res;
@@ -1184,7 +1193,7 @@ static search_result search_hd_table(nghttp2_hd_context *context,
int indexing_mode, nghttp2_hd_map *map,
uint32_t hash) {
search_result res = {-1, 0};
- nghttp2_hd_entry *ent;
+ const nghttp2_hd_entry *ent;
int exact_match;
int name_only = indexing_mode == NGHTTP2_HD_NEVER_INDEXING;
@@ -1289,8 +1298,9 @@ nghttp2_hd_nv nghttp2_hd_table_get(nghttp2_hd_context *context, size_t idx) {
return hd_ringbuf_get(&context->hd_table, idx - NGHTTP2_STATIC_TABLE_LENGTH)
->nv;
} else {
- nghttp2_hd_static_entry *ent = &static_table[idx];
- nghttp2_hd_nv nv = {&ent->name, &ent->value, ent->token,
+ const nghttp2_hd_static_entry *ent = &static_table[idx];
+ nghttp2_hd_nv nv = {(nghttp2_rcbuf *)&ent->name,
+ (nghttp2_rcbuf *)&ent->value, ent->token,
NGHTTP2_NV_FLAG_NONE};
return nv;
}
diff --git a/deps/nghttp2/lib/nghttp2_hd.h b/deps/nghttp2/lib/nghttp2_hd.h
index c64a1f2b9b406c..14ae98078957af 100644
--- a/deps/nghttp2/lib/nghttp2_hd.h
+++ b/deps/nghttp2/lib/nghttp2_hd.h
@@ -111,6 +111,7 @@ typedef enum {
NGHTTP2_TOKEN_KEEP_ALIVE,
NGHTTP2_TOKEN_PROXY_CONNECTION,
NGHTTP2_TOKEN_UPGRADE,
+ NGHTTP2_TOKEN__PROTOCOL,
} nghttp2_token;
struct nghttp2_hd_entry;
diff --git a/deps/nghttp2/lib/nghttp2_helper.c b/deps/nghttp2/lib/nghttp2_helper.c
index 3b282c7301f95b..81a8a0cf99971a 100644
--- a/deps/nghttp2/lib/nghttp2_helper.c
+++ b/deps/nghttp2/lib/nghttp2_helper.c
@@ -340,7 +340,7 @@ const char *nghttp2_strerror(int error_code) {
}
/* Generated by gennmchartbl.py */
-static int VALID_HD_NAME_CHARS[] = {
+static const int VALID_HD_NAME_CHARS[] = {
0 /* NUL */, 0 /* SOH */, 0 /* STX */, 0 /* ETX */,
0 /* EOT */, 0 /* ENQ */, 0 /* ACK */, 0 /* BEL */,
0 /* BS */, 0 /* HT */, 0 /* LF */, 0 /* VT */,
@@ -428,7 +428,7 @@ int nghttp2_check_header_name(const uint8_t *name, size_t len) {
}
/* Generated by genvchartbl.py */
-static int VALID_HD_VALUE_CHARS[] = {
+static const int VALID_HD_VALUE_CHARS[] = {
0 /* NUL */, 0 /* SOH */, 0 /* STX */, 0 /* ETX */,
0 /* EOT */, 0 /* ENQ */, 0 /* ACK */, 0 /* BEL */,
0 /* BS */, 1 /* HT */, 0 /* LF */, 0 /* VT */,
diff --git a/deps/nghttp2/lib/nghttp2_http.c b/deps/nghttp2/lib/nghttp2_http.c
index b08f8863f7ce16..6e8acfdcc141af 100644
--- a/deps/nghttp2/lib/nghttp2_http.c
+++ b/deps/nghttp2/lib/nghttp2_http.c
@@ -113,7 +113,7 @@ static int check_path(nghttp2_stream *stream) {
}
static int http_request_on_header(nghttp2_stream *stream, nghttp2_hd_nv *nv,
- int trailer) {
+ int trailer, int connect_protocol) {
if (nv->name->base[0] == ':') {
if (trailer ||
(stream->http_flags & NGHTTP2_HTTP_FLAG_PSEUDO_HEADER_DISALLOWED)) {
@@ -146,10 +146,6 @@ static int http_request_on_header(nghttp2_stream *stream, nghttp2_hd_nv *nv,
return NGHTTP2_ERR_HTTP_HEADER;
}
stream->http_flags |= NGHTTP2_HTTP_FLAG_METH_CONNECT;
- if (stream->http_flags &
- (NGHTTP2_HTTP_FLAG__PATH | NGHTTP2_HTTP_FLAG__SCHEME)) {
- return NGHTTP2_ERR_HTTP_HEADER;
- }
}
break;
case 'S':
@@ -162,9 +158,6 @@ static int http_request_on_header(nghttp2_stream *stream, nghttp2_hd_nv *nv,
}
break;
case NGHTTP2_TOKEN__PATH:
- if (stream->http_flags & NGHTTP2_HTTP_FLAG_METH_CONNECT) {
- return NGHTTP2_ERR_HTTP_HEADER;
- }
if (!check_pseudo_header(stream, nv, NGHTTP2_HTTP_FLAG__PATH)) {
return NGHTTP2_ERR_HTTP_HEADER;
}
@@ -175,9 +168,6 @@ static int http_request_on_header(nghttp2_stream *stream, nghttp2_hd_nv *nv,
}
break;
case NGHTTP2_TOKEN__SCHEME:
- if (stream->http_flags & NGHTTP2_HTTP_FLAG_METH_CONNECT) {
- return NGHTTP2_ERR_HTTP_HEADER;
- }
if (!check_pseudo_header(stream, nv, NGHTTP2_HTTP_FLAG__SCHEME)) {
return NGHTTP2_ERR_HTTP_HEADER;
}
@@ -186,6 +176,15 @@ static int http_request_on_header(nghttp2_stream *stream, nghttp2_hd_nv *nv,
stream->http_flags |= NGHTTP2_HTTP_FLAG_SCHEME_HTTP;
}
break;
+ case NGHTTP2_TOKEN__PROTOCOL:
+ if (!connect_protocol) {
+ return NGHTTP2_ERR_HTTP_HEADER;
+ }
+
+ if (!check_pseudo_header(stream, nv, NGHTTP2_HTTP_FLAG__PROTOCOL)) {
+ return NGHTTP2_ERR_HTTP_HEADER;
+ }
+ break;
case NGHTTP2_TOKEN_HOST:
if (!check_pseudo_header(stream, nv, NGHTTP2_HTTP_FLAG_HOST)) {
return NGHTTP2_ERR_HTTP_HEADER;
@@ -265,7 +264,7 @@ static int http_response_on_header(nghttp2_stream *stream, nghttp2_hd_nv *nv,
return NGHTTP2_ERR_REMOVE_HTTP_HEADER;
}
if (stream->status_code / 100 == 1 ||
- (stream->status_code == 200 &&
+ (stream->status_code / 100 == 2 &&
(stream->http_flags & NGHTTP2_HTTP_FLAG_METH_CONNECT))) {
return NGHTTP2_ERR_HTTP_HEADER;
}
@@ -458,7 +457,9 @@ int nghttp2_http_on_header(nghttp2_session *session, nghttp2_stream *stream,
}
if (session->server || frame->hd.type == NGHTTP2_PUSH_PROMISE) {
- return http_request_on_header(stream, nv, trailer);
+ return http_request_on_header(stream, nv, trailer,
+ session->server &&
+ session->pending_enable_connect_protocol);
}
return http_response_on_header(stream, nv, trailer);
@@ -466,8 +467,11 @@ int nghttp2_http_on_header(nghttp2_session *session, nghttp2_stream *stream,
int nghttp2_http_on_request_headers(nghttp2_stream *stream,
nghttp2_frame *frame) {
- if (stream->http_flags & NGHTTP2_HTTP_FLAG_METH_CONNECT) {
- if ((stream->http_flags & NGHTTP2_HTTP_FLAG__AUTHORITY) == 0) {
+ if (!(stream->http_flags & NGHTTP2_HTTP_FLAG__PROTOCOL) &&
+ (stream->http_flags & NGHTTP2_HTTP_FLAG_METH_CONNECT)) {
+ if ((stream->http_flags &
+ (NGHTTP2_HTTP_FLAG__SCHEME | NGHTTP2_HTTP_FLAG__PATH)) ||
+ (stream->http_flags & NGHTTP2_HTTP_FLAG__AUTHORITY) == 0) {
return -1;
}
stream->content_length = -1;
@@ -478,6 +482,11 @@ int nghttp2_http_on_request_headers(nghttp2_stream *stream,
(NGHTTP2_HTTP_FLAG__AUTHORITY | NGHTTP2_HTTP_FLAG_HOST)) == 0) {
return -1;
}
+ if ((stream->http_flags & NGHTTP2_HTTP_FLAG__PROTOCOL) &&
+ ((stream->http_flags & NGHTTP2_HTTP_FLAG_METH_CONNECT) == 0 ||
+ (stream->http_flags & NGHTTP2_HTTP_FLAG__AUTHORITY) == 0)) {
+ return -1;
+ }
if (!check_path(stream)) {
return -1;
}
diff --git a/deps/nghttp2/lib/nghttp2_session.c b/deps/nghttp2/lib/nghttp2_session.c
index 418ad6663585f5..ef4932af4e4f58 100644
--- a/deps/nghttp2/lib/nghttp2_session.c
+++ b/deps/nghttp2/lib/nghttp2_session.c
@@ -4361,6 +4361,9 @@ int nghttp2_session_update_local_settings(nghttp2_session *session,
case NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE:
session->local_settings.max_header_list_size = iv[i].value;
break;
+ case NGHTTP2_SETTINGS_ENABLE_CONNECT_PROTOCOL:
+ session->local_settings.enable_connect_protocol = iv[i].value;
+ break;
}
}
@@ -4499,6 +4502,26 @@ int nghttp2_session_on_settings_received(nghttp2_session *session,
session->remote_settings.max_header_list_size = entry->value;
+ break;
+ case NGHTTP2_SETTINGS_ENABLE_CONNECT_PROTOCOL:
+
+ if (entry->value != 0 && entry->value != 1) {
+ return session_handle_invalid_connection(
+ session, frame, NGHTTP2_ERR_PROTO,
+ "SETTINGS: invalid SETTINGS_ENABLE_CONNECT_PROTOCOL");
+ }
+
+ if (!session->server &&
+ session->remote_settings.enable_connect_protocol &&
+ entry->value == 0) {
+ return session_handle_invalid_connection(
+ session, frame, NGHTTP2_ERR_PROTO,
+ "SETTINGS: server attempted to disable "
+ "SETTINGS_ENABLE_CONNECT_PROTOCOL");
+ }
+
+ session->remote_settings.enable_connect_protocol = entry->value;
+
break;
}
}
@@ -5250,6 +5273,7 @@ static void inbound_frame_set_settings_entry(nghttp2_inbound_frame *iframe) {
case NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE:
case NGHTTP2_SETTINGS_MAX_FRAME_SIZE:
case NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE:
+ case NGHTTP2_SETTINGS_ENABLE_CONNECT_PROTOCOL:
break;
default:
DEBUGF("recv: unknown settings id=0x%02x\n", iv.settings_id);
@@ -7052,6 +7076,13 @@ int nghttp2_session_add_settings(nghttp2_session *session, uint8_t flags,
}
}
+ for (i = niv; i > 0; --i) {
+ if (iv[i - 1].settings_id == NGHTTP2_SETTINGS_ENABLE_CONNECT_PROTOCOL) {
+ session->pending_enable_connect_protocol = (uint8_t)iv[i - 1].value;
+ break;
+ }
+ }
+
return 0;
}
@@ -7360,6 +7391,8 @@ uint32_t nghttp2_session_get_remote_settings(nghttp2_session *session,
return session->remote_settings.max_frame_size;
case NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE:
return session->remote_settings.max_header_list_size;
+ case NGHTTP2_SETTINGS_ENABLE_CONNECT_PROTOCOL:
+ return session->remote_settings.enable_connect_protocol;
}
assert(0);
@@ -7381,6 +7414,8 @@ uint32_t nghttp2_session_get_local_settings(nghttp2_session *session,
return session->local_settings.max_frame_size;
case NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE:
return session->local_settings.max_header_list_size;
+ case NGHTTP2_SETTINGS_ENABLE_CONNECT_PROTOCOL:
+ return session->local_settings.enable_connect_protocol;
}
assert(0);
diff --git a/deps/nghttp2/lib/nghttp2_session.h b/deps/nghttp2/lib/nghttp2_session.h
index 5add50bc8bce16..40a8865a04b12f 100644
--- a/deps/nghttp2/lib/nghttp2_session.h
+++ b/deps/nghttp2/lib/nghttp2_session.h
@@ -164,6 +164,7 @@ typedef struct {
uint32_t initial_window_size;
uint32_t max_frame_size;
uint32_t max_header_list_size;
+ uint32_t enable_connect_protocol;
} nghttp2_settings_storage;
typedef enum {
@@ -321,6 +322,9 @@ struct nghttp2_session {
/* Unacked local ENABLE_PUSH value. We use this to refuse
PUSH_PROMISE before SETTINGS ACK is received. */
uint8_t pending_enable_push;
+ /* Unacked local ENABLE_CONNECT_PROTOCOL value. We use this to
+ accept :protocol header field before SETTINGS_ACK is received. */
+ uint8_t pending_enable_connect_protocol;
/* Nonzero if the session is server side. */
uint8_t server;
/* Flags indicating GOAWAY is sent and/or received. The flags are
diff --git a/deps/nghttp2/lib/nghttp2_stream.h b/deps/nghttp2/lib/nghttp2_stream.h
index d1d5856d800e76..fb8dc14d67be6d 100644
--- a/deps/nghttp2/lib/nghttp2_stream.h
+++ b/deps/nghttp2/lib/nghttp2_stream.h
@@ -130,7 +130,8 @@ typedef enum {
/* "http" or "https" scheme */
NGHTTP2_HTTP_FLAG_SCHEME_HTTP = 1 << 13,
/* set if final response is expected */
- NGHTTP2_HTTP_FLAG_EXPECT_FINAL_RESPONSE = 1 << 14
+ NGHTTP2_HTTP_FLAG_EXPECT_FINAL_RESPONSE = 1 << 14,
+ NGHTTP2_HTTP_FLAG__PROTOCOL = 1 << 15,
} nghttp2_http_flag;
struct nghttp2_stream {
diff --git a/deps/uv/AUTHORS b/deps/uv/AUTHORS
index 0ba7c067681477..2fdfbcd5322e5e 100644
--- a/deps/uv/AUTHORS
+++ b/deps/uv/AUTHORS
@@ -346,3 +346,9 @@ Paolo Greppi
Shelley Vohr
Ujjwal Sharma
Michał Kozakiewicz
+Emil Bay
+Jeremiah Senkpiel
+Andy Zhang
+dmabupt
+Ryan Liptak
+Ali Ijaz Sheikh
diff --git a/deps/uv/CMakeLists.txt b/deps/uv/CMakeLists.txt
index 4f13efc8e6ef2b..6a631a87c1cb39 100644
--- a/deps/uv/CMakeLists.txt
+++ b/deps/uv/CMakeLists.txt
@@ -193,7 +193,6 @@ if(WIN32)
src/win/poll.c
src/win/process.c
src/win/process-stdio.c
- src/win/req.c
src/win/signal.c
src/win/snprintf.c
src/win/stream.c
diff --git a/deps/uv/ChangeLog b/deps/uv/ChangeLog
index b57cea4baf150a..7cb675238d3e08 100644
--- a/deps/uv/ChangeLog
+++ b/deps/uv/ChangeLog
@@ -1,3 +1,87 @@
+2018.10.09, Version 1.23.2 (Stable), 34c12788d2e7308f3ac506c0abcbf74c0d6abd20
+
+Changes since version 1.23.1:
+
+* unix: return 0 retrieving rss on cygwin (cjihrig)
+
+* unix: initialize uv_interface_address_t.phys_addr (cjihrig)
+
+* test: handle uv_os_setpriority() windows edge case (cjihrig)
+
+* tty, win: fix read stop for raw mode (Bartosz Sosnowski)
+
+* Revert "Revert "unix,fs: fix for potential partial reads/writes"" (Jameson
+ Nash)
+
+* unix,readv: always permit partial reads to return (Jameson Nash)
+
+* win,tty: fix uv_tty_close() (Bartosz Sosnowski)
+
+* doc: remove extraneous "on" (Ben Noordhuis)
+
+* unix,win: fix threadpool race condition (Anna Henningsen)
+
+* unix: rework thread barrier implementation (Ben Noordhuis)
+
+* aix: switch to libuv's own thread barrier impl (Ben Noordhuis)
+
+* unix: signal done to last thread barrier waiter (Ben Noordhuis)
+
+* test: add uv_barrier_wait serial thread test (Ali Ijaz Sheikh)
+
+* unix: optimize uv_fs_readlink() memory allocation (Ben Noordhuis)
+
+* win: remove req.c and other cleanup (Carlo Marcelo Arenas Belón)
+
+* aix: don't EISDIR on read from directory fd (Ben Noordhuis)
+
+
+2018.09.22, Version 1.23.1 (Stable), d2282b3d67821dc53c907c2155fa8c5c6ce25180
+
+Changes since version 1.23.0:
+
+* unix,win: limit concurrent DNS calls to nthreads/2 (Anna Henningsen)
+
+* doc: add addaleax to maintainers (Anna Henningsen)
+
+* doc: add missing slash in stream.rst (Emil Bay)
+
+* unix,fs: use utimes & friends for uv_fs_utime (Jeremiah Senkpiel)
+
+* unix,fs: remove linux fallback from utimesat() (Jeremiah Senkpiel)
+
+* unix,fs: remove uv__utimesat() syscall fallback (Jeremiah Senkpiel)
+
+* doc: fix argument name in tcp.rts (Emil Bay)
+
+* doc: notes on running tests, benchmarks, tools (Jamie Davis)
+
+* linux: remove epoll syscall wrappers (Ben Noordhuis)
+
+* linux: drop code path for epoll_pwait-less kernels (Ben Noordhuis)
+
+* Partially revert "win,code: remove GetQueuedCompletionStatus-based poller"
+ (Jameson Nash)
+
+* build: add compile for android arm64/x86/x86-64 (Andy Zhang)
+
+* doc: clarify that some remarks apply to windows (Bert Belder)
+
+* test: fix compiler warnings (Jamie Davis)
+
+* ibmi: return 0 from uv_resident_set_memory() (dmabupt)
+
+* win: fix uv_udp_recv_start() error translation (Ryan Liptak)
+
+* win,doc: improve uv_os_setpriority() documentation (Bartosz Sosnowski)
+
+* test: increase upper bound in condvar_5 (Jamie Davis)
+
+* win,tty: remove deadcode (Jameson Nash)
+
+* stream: autodetect direction (Jameson Nash)
+
+
2018.08.18, Version 1.23.0 (Stable), 7ebb26225f2eaae6db22f4ef34ce76fa16ff89ec
Changes since version 1.22.0:
diff --git a/deps/uv/MAINTAINERS.md b/deps/uv/MAINTAINERS.md
index 889ee4988c482c..543dc3cda7bce2 100644
--- a/deps/uv/MAINTAINERS.md
+++ b/deps/uv/MAINTAINERS.md
@@ -3,6 +3,7 @@
libuv is currently managed by the following individuals:
+* **Anna Henningsen** ([@addaleax](https://github.com/addaleax))
* **Bartosz Sosnowski** ([@bzoz](https://github.com/bzoz))
* **Ben Noordhuis** ([@bnoordhuis](https://github.com/bnoordhuis))
- GPG key: D77B 1E34 243F BAF0 5F8E 9CC3 4F55 C8C8 46AB 89B9 (pubkey-bnoordhuis)
diff --git a/deps/uv/Makefile.am b/deps/uv/Makefile.am
index a217faab3cea25..2381425403c376 100644
--- a/deps/uv/Makefile.am
+++ b/deps/uv/Makefile.am
@@ -68,7 +68,6 @@ libuv_la_SOURCES += src/win/async.c \
src/win/poll.c \
src/win/process-stdio.c \
src/win/process.c \
- src/win/req.c \
src/win/req-inl.h \
src/win/signal.c \
src/win/stream.c \
@@ -340,8 +339,7 @@ libuv_la_SOURCES += src/unix/aix.c src/unix/aix-common.c
endif
if ANDROID
-uvinclude_HEADERS += include/uv/android-ifaddrs.h \
- include/uv/pthread-barrier.h
+uvinclude_HEADERS += include/uv/android-ifaddrs.h
libuv_la_SOURCES += src/unix/android-ifaddrs.c \
src/unix/pthread-fixes.c
endif
@@ -361,8 +359,7 @@ libuv_la_SOURCES += src/unix/cygwin.c \
endif
if DARWIN
-uvinclude_HEADERS += include/uv/darwin.h \
- include/uv/pthread-barrier.h
+uvinclude_HEADERS += include/uv/darwin.h
libuv_la_CFLAGS += -D_DARWIN_USE_64_BIT_INODE=1
libuv_la_CFLAGS += -D_DARWIN_UNLIMITED_SELECT=1
libuv_la_SOURCES += src/unix/bsd-ifaddrs.c \
@@ -445,7 +442,6 @@ libuv_la_SOURCES += src/unix/no-proctitle.c \
endif
if OS390
-uvinclude_HEADERS += include/uv/pthread-barrier.h
libuv_la_CFLAGS += -D_UNIX03_THREADS \
-D_UNIX03_SOURCE \
-D_OPEN_SYS_IF_EXT=1 \
diff --git a/deps/uv/README.md b/deps/uv/README.md
index cb9e26c1e03a7a..b24b722612edf3 100644
--- a/deps/uv/README.md
+++ b/deps/uv/README.md
@@ -282,8 +282,31 @@ Make sure that you specify the architecture you wish to build for in the
Run:
+For arm
+
+```bash
+$ source ./android-configure-arm NDK_PATH gyp [API_LEVEL]
+$ make -C out
+```
+
+or for arm64
+
+```bash
+$ source ./android-configure-arm64 NDK_PATH gyp [API_LEVEL]
+$ make -C out
+```
+
+or for x86
+
+```bash
+$ source ./android-configure-x86 NDK_PATH gyp [API_LEVEL]
+$ make -C out
+```
+
+or for x86_64
+
```bash
-$ source ./android-configure NDK_PATH gyp [API_LEVEL]
+$ source ./android-configure-x86_64 NDK_PATH gyp [API_LEVEL]
$ make -C out
```
@@ -310,14 +333,66 @@ $ ninja -C out/Release
### Running tests
-Run:
+#### Build
+
+Build (includes tests):
```bash
$ ./gyp_uv.py -f make
$ make -C out
+```
+
+#### Run all tests
+
+```bash
$ ./out/Debug/run-tests
```
+#### Run one test
+
+The list of all tests is in `test/test-list.h`.
+
+This invocation will cause the `run-tests` driver to fork and execute `TEST_NAME` in a child process:
+
+```bash
+$ ./out/Debug/run-tests TEST_NAME
+```
+
+This invocation will cause the `run-tests` driver to execute the test within the `run-tests` process:
+
+```bash
+$ ./out/Debug/run-tests TEST_NAME TEST_NAME
+```
+
+#### Debugging tools
+
+When running the test from within the `run-tests` process (`run-tests TEST_NAME TEST_NAME`), tools like gdb and valgrind work normally.
+When running the test from a child of the `run-tests` process (`run-tests TEST_NAME`), use these tools in a fork-aware manner.
+
+##### Fork-aware gdb
+
+Use the [follow-fork-mode](https://sourceware.org/gdb/onlinedocs/gdb/Forks.html) setting:
+
+```
+$ gdb --args out/Debug/run-tests TEST_NAME
+
+(gdb) set follow-fork-mode child
+...
+```
+
+##### Fork-aware valgrind
+
+Use the `--trace-children=yes` parameter:
+
+```bash
+$ valgrind --trace-children=yes -v --tool=memcheck --leak-check=full --track-origins=yes --leak-resolution=high --show-reachable=yes --log-file=memcheck.log out/Debug/run-tests TEST_NAME
+```
+
+### Running benchmarks
+
+See the section on running tests.
+The benchmark driver is `out/Debug/run-benchmarks` and the benchmarks are listed in `test/benchmark-list.h`.
+
## Supported Platforms
Check the [SUPPORTED_PLATFORMS file](SUPPORTED_PLATFORMS.md).
diff --git a/deps/uv/android-configure b/deps/uv/android-configure-arm
similarity index 92%
rename from deps/uv/android-configure
rename to deps/uv/android-configure-arm
index b5c11cd40c6873..331fdd9ebcf9f9 100755
--- a/deps/uv/android-configure
+++ b/deps/uv/android-configure-arm
@@ -1,6 +1,6 @@
#!/bin/bash
-export TOOLCHAIN=$PWD/android-toolchain
+export TOOLCHAIN=$PWD/android-toolchain-arm
mkdir -p $TOOLCHAIN
API=${3:-24}
$1/build/tools/make-standalone-toolchain.sh \
diff --git a/deps/uv/android-configure-arm64 b/deps/uv/android-configure-arm64
new file mode 100755
index 00000000000000..1acd905d775fd9
--- /dev/null
+++ b/deps/uv/android-configure-arm64
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+export TOOLCHAIN=$PWD/android-toolchain-arm64
+mkdir -p $TOOLCHAIN
+API=${3:-24}
+$1/build/tools/make-standalone-toolchain.sh \
+ --toolchain=aarch64-linux-android-4.9 \
+ --arch=arm64 \
+ --install-dir=$TOOLCHAIN \
+ --platform=android-$API \
+ --force
+export PATH=$TOOLCHAIN/bin:$PATH
+export AR=aarch64-linux-android-ar
+export CC=aarch64-linux-android-gcc
+export CXX=aarch64-linux-android-g++
+export LINK=aarch64-linux-android-g++
+export PLATFORM=android
+export CFLAGS="-D__ANDROID_API__=$API"
+
+if [[ $2 == 'gyp' ]]
+ then
+ ./gyp_uv.py -Dtarget_arch=arm64 -DOS=android -f make-android
+fi
diff --git a/deps/uv/android-configure-x86 b/deps/uv/android-configure-x86
new file mode 100755
index 00000000000000..a149715f37547f
--- /dev/null
+++ b/deps/uv/android-configure-x86
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+export TOOLCHAIN=$PWD/android-toolchain-x86
+mkdir -p $TOOLCHAIN
+API=${3:-24}
+$1/build/tools/make-standalone-toolchain.sh \
+ --toolchain=x86-4.9 \
+ --arch=x86 \
+ --install-dir=$TOOLCHAIN \
+ --platform=android-$API \
+ --force
+export PATH=$TOOLCHAIN/bin:$PATH
+export AR=i686-linux-android-ar
+export CC=i686-linux-android-gcc
+export CXX=i686-linux-android-g++
+export LINK=i686-linux-android-g++
+export PLATFORM=android
+export CFLAGS="-D__ANDROID_API__=$API"
+
+if [[ $2 == 'gyp' ]]
+ then
+ ./gyp_uv.py -Dtarget_arch=x86 -DOS=android -f make-android
+fi
diff --git a/deps/uv/android-configure-x86_64 b/deps/uv/android-configure-x86_64
new file mode 100755
index 00000000000000..ff045957f7138d
--- /dev/null
+++ b/deps/uv/android-configure-x86_64
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+export TOOLCHAIN=$PWD/android-toolchain-x86_64
+mkdir -p $TOOLCHAIN
+API=${3:-24}
+$1/build/tools/make-standalone-toolchain.sh \
+ --toolchain=x86_64-4.9 \
+ --arch=x86_64 \
+ --install-dir=$TOOLCHAIN \
+ --platform=android-$API \
+ --force
+export PATH=$TOOLCHAIN/bin:$PATH
+export AR=x86_64-linux-android-ar
+export CC=x86_64-linux-android-gcc
+export CXX=x86_64-linux-android-g++
+export LINK=x86_64-linux-android-g++
+export PLATFORM=android
+export CFLAGS="-D__ANDROID_API__=$API -fPIC"
+export CXXFLAGS="-D__ANDROID_API__=$API -fPIC"
+export LDFLAGS="-fPIC"
+
+if [[ $2 == 'gyp' ]]
+ then
+ ./gyp_uv.py -Dtarget_arch=x86_64 -DOS=android -f make-android
+fi
diff --git a/deps/uv/configure.ac b/deps/uv/configure.ac
index 6e084fd04d9a7d..0d9066bb0225a5 100644
--- a/deps/uv/configure.ac
+++ b/deps/uv/configure.ac
@@ -13,7 +13,7 @@
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
AC_PREREQ(2.57)
-AC_INIT([libuv], [1.23.0], [https://github.com/libuv/libuv/issues])
+AC_INIT([libuv], [1.23.2], [https://github.com/libuv/libuv/issues])
AC_CONFIG_MACRO_DIR([m4])
m4_include([m4/libuv-extra-automake-flags.m4])
m4_include([m4/as_case.m4])
diff --git a/deps/uv/docs/src/design.rst b/deps/uv/docs/src/design.rst
index 487d08ba6255ad..001b12334d2354 100644
--- a/deps/uv/docs/src/design.rst
+++ b/deps/uv/docs/src/design.rst
@@ -126,7 +126,7 @@ so the current approach is to run blocking file I/O operations in a thread pool.
For a thorough explanation of the cross-platform file I/O landscape, checkout
`this post `_.
-libuv currently uses a global thread pool on which all loops can queue work on. 3 types of
+libuv currently uses a global thread pool on which all loops can queue work. 3 types of
operations are currently run on this pool:
* File system operations
diff --git a/deps/uv/docs/src/misc.rst b/deps/uv/docs/src/misc.rst
index 529d588c5d4bd1..cf4a7895cd147b 100644
--- a/deps/uv/docs/src/misc.rst
+++ b/deps/uv/docs/src/misc.rst
@@ -544,4 +544,8 @@ API
process priority, the result will equal one of the `UV_PRIORITY`
constants, and not necessarily the exact value of `priority`.
+ .. note::
+ On Windows, setting `PRIORITY_HIGHEST` will only work for elevated user,
+ for others it will be silently reduced to `PRIORITY_HIGH`.
+
.. versionadded:: 1.23.0
diff --git a/deps/uv/docs/src/signal.rst b/deps/uv/docs/src/signal.rst
index 24354e4f7c1329..f52b64706ab890 100644
--- a/deps/uv/docs/src/signal.rst
+++ b/deps/uv/docs/src/signal.rst
@@ -17,12 +17,12 @@ Reception of some signals is emulated on Windows:
program is given approximately 10 seconds to perform cleanup. After that
Windows will unconditionally terminate it.
-Watchers for other signals can be successfully created, but these signals
-are never received. These signals are: `SIGILL`, `SIGABRT`, `SIGFPE`, `SIGSEGV`,
-`SIGTERM` and `SIGKILL.`
+* Watchers for other signals can be successfully created, but these signals
+ are never received. These signals are: `SIGILL`, `SIGABRT`, `SIGFPE`, `SIGSEGV`,
+ `SIGTERM` and `SIGKILL.`
-Calls to raise() or abort() to programmatically raise a signal are
-not detected by libuv; these will not trigger a signal watcher.
+* Calls to raise() or abort() to programmatically raise a signal are
+ not detected by libuv; these will not trigger a signal watcher.
.. note::
On Linux SIGRT0 and SIGRT1 (signals 32 and 33) are used by the NPTL pthreads library to
diff --git a/deps/uv/docs/src/stream.rst b/deps/uv/docs/src/stream.rst
index 9ec23622512519..6a704367b1b361 100644
--- a/deps/uv/docs/src/stream.rst
+++ b/deps/uv/docs/src/stream.rst
@@ -45,7 +45,7 @@ Data types
`nread` might be 0, which does *not* indicate an error or EOF. This
is equivalent to ``EAGAIN`` or ``EWOULDBLOCK`` under ``read(2)``.
- The callee is responsible for stopping closing the stream when an error happens
+ The callee is responsible for stopping/closing the stream when an error happens
by calling :c:func:`uv_read_stop` or :c:func:`uv_close`. Trying to read
from the stream again is undefined.
diff --git a/deps/uv/docs/src/tcp.rst b/deps/uv/docs/src/tcp.rst
index e761b460d0e636..d20a6362af94d5 100644
--- a/deps/uv/docs/src/tcp.rst
+++ b/deps/uv/docs/src/tcp.rst
@@ -86,13 +86,13 @@ API
.. c:function:: int uv_tcp_getsockname(const uv_tcp_t* handle, struct sockaddr* name, int* namelen)
- Get the current address to which the handle is bound. `addr` must point to
+ Get the current address to which the handle is bound. `name` must point to
a valid and big enough chunk of memory, ``struct sockaddr_storage`` is
recommended for IPv4 and IPv6 support.
.. c:function:: int uv_tcp_getpeername(const uv_tcp_t* handle, struct sockaddr* name, int* namelen)
- Get the address of the peer connected to the handle. `addr` must point to
+ Get the address of the peer connected to the handle. `name` must point to
a valid and big enough chunk of memory, ``struct sockaddr_storage`` is
recommended for IPv4 and IPv6 support.
diff --git a/deps/uv/docs/src/tty.rst b/deps/uv/docs/src/tty.rst
index 01a0585287affc..9889a0a0b6465b 100644
--- a/deps/uv/docs/src/tty.rst
+++ b/deps/uv/docs/src/tty.rst
@@ -46,7 +46,7 @@ N/A
API
---
-.. c:function:: int uv_tty_init(uv_loop_t* loop, uv_tty_t* handle, uv_file fd, int readable)
+.. c:function:: int uv_tty_init(uv_loop_t* loop, uv_tty_t* handle, uv_file fd, int unused)
Initialize a new TTY stream with the given file descriptor. Usually the
file descriptor will be:
@@ -55,9 +55,6 @@ API
* 1 = stdout
* 2 = stderr
- `readable`, specifies if you plan on calling :c:func:`uv_read_start` with
- this stream. stdin is readable, stdout is not.
-
On Unix this function will determine the path of the fd of the terminal
using :man:`ttyname_r(3)`, open it, and use it if the passed file descriptor
refers to a TTY. This lets libuv put the tty in non-blocking mode without
@@ -67,8 +64,10 @@ API
ioctl TIOCGPTN or TIOCPTYGNAME, for instance OpenBSD and Solaris.
.. note::
- If reopening the TTY fails, libuv falls back to blocking writes for
- non-readable TTY streams.
+ If reopening the TTY fails, libuv falls back to blocking writes.
+
+ .. versionchanged:: 1.23.1: the `readable` parameter is now unused and ignored.
+ The correct value will now be auto-detected from the kernel.
.. versionchanged:: 1.9.0: the path of the TTY is determined by
:man:`ttyname_r(3)`. In earlier versions libuv opened
diff --git a/deps/uv/include/uv/pthread-barrier.h b/deps/uv/include/uv/pthread-barrier.h
deleted file mode 100644
index 07db9b8a6a27e0..00000000000000
--- a/deps/uv/include/uv/pthread-barrier.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
-Copyright (c) 2016, Kari Tristan Helgason
-
-Permission to use, copy, modify, and/or distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-*/
-
-#ifndef _UV_PTHREAD_BARRIER_
-#define _UV_PTHREAD_BARRIER_
-#include
-#include
-#if !defined(__MVS__)
-#include /* sem_t */
-#endif
-
-#define PTHREAD_BARRIER_SERIAL_THREAD 0x12345
-#define UV__PTHREAD_BARRIER_FALLBACK 1
-
-/*
- * To maintain ABI compatibility with
- * libuv v1.x struct is padded according
- * to target platform
- */
-#if defined(__ANDROID__)
-# define UV_BARRIER_STRUCT_PADDING \
- sizeof(pthread_mutex_t) + \
- sizeof(pthread_cond_t) + \
- sizeof(unsigned int) - \
- sizeof(void *)
-#elif defined(__APPLE__)
-# define UV_BARRIER_STRUCT_PADDING \
- sizeof(pthread_mutex_t) + \
- 2 * sizeof(sem_t) + \
- 2 * sizeof(unsigned int) - \
- sizeof(void *)
-#else
-# define UV_BARRIER_STRUCT_PADDING 0
-#endif
-
-typedef struct {
- pthread_mutex_t mutex;
- pthread_cond_t cond;
- unsigned threshold;
- unsigned in;
- unsigned out;
-} _uv_barrier;
-
-typedef struct {
- _uv_barrier* b;
- char _pad[UV_BARRIER_STRUCT_PADDING];
-} pthread_barrier_t;
-
-int pthread_barrier_init(pthread_barrier_t* barrier,
- const void* barrier_attr,
- unsigned count);
-
-int pthread_barrier_wait(pthread_barrier_t* barrier);
-int pthread_barrier_destroy(pthread_barrier_t *barrier);
-
-#endif /* _UV_PTHREAD_BARRIER_ */
diff --git a/deps/uv/include/uv/unix.h b/deps/uv/include/uv/unix.h
index 74a0d643ceec28..7208557b560ce8 100644
--- a/deps/uv/include/uv/unix.h
+++ b/deps/uv/include/uv/unix.h
@@ -66,10 +66,6 @@
# include "uv/posix.h"
#endif
-#ifndef PTHREAD_BARRIER_SERIAL_THREAD
-# include "uv/pthread-barrier.h"
-#endif
-
#ifndef NI_MAXHOST
# define NI_MAXHOST 1025
#endif
@@ -136,8 +132,28 @@ typedef pthread_rwlock_t uv_rwlock_t;
typedef UV_PLATFORM_SEM_T uv_sem_t;
typedef pthread_cond_t uv_cond_t;
typedef pthread_key_t uv_key_t;
-typedef pthread_barrier_t uv_barrier_t;
+/* Note: guard clauses should match uv_barrier_init's in src/unix/thread.c. */
+#if defined(_AIX) || !defined(PTHREAD_BARRIER_SERIAL_THREAD)
+/* TODO(bnoordhuis) Merge into uv_barrier_t in v2. */
+struct _uv_barrier {
+ uv_mutex_t mutex;
+ uv_cond_t cond;
+ unsigned threshold;
+ unsigned in;
+ unsigned out;
+};
+
+typedef struct {
+ struct _uv_barrier* b;
+# if defined(PTHREAD_BARRIER_SERIAL_THREAD)
+ /* TODO(bnoordhuis) Remove padding in v2. */
+ char pad[sizeof(pthread_barrier_t) - sizeof(struct _uv_barrier*)];
+# endif
+} uv_barrier_t;
+#else
+typedef pthread_barrier_t uv_barrier_t;
+#endif
/* Platform-specific definitions for uv_spawn support. */
typedef gid_t uv_gid_t;
diff --git a/deps/uv/include/uv/version.h b/deps/uv/include/uv/version.h
index 30e1d5a6f92bf8..cc064e2fd87ce8 100644
--- a/deps/uv/include/uv/version.h
+++ b/deps/uv/include/uv/version.h
@@ -32,7 +32,7 @@
#define UV_VERSION_MAJOR 1
#define UV_VERSION_MINOR 23
-#define UV_VERSION_PATCH 0
+#define UV_VERSION_PATCH 2
#define UV_VERSION_IS_RELEASE 1
#define UV_VERSION_SUFFIX ""
diff --git a/deps/uv/src/threadpool.c b/deps/uv/src/threadpool.c
index 413d1c204c2660..4258933c724782 100644
--- a/deps/uv/src/threadpool.c
+++ b/deps/uv/src/threadpool.c
@@ -33,12 +33,18 @@ static uv_once_t once = UV_ONCE_INIT;
static uv_cond_t cond;
static uv_mutex_t mutex;
static unsigned int idle_threads;
+static unsigned int slow_io_work_running;
static unsigned int nthreads;
static uv_thread_t* threads;
static uv_thread_t default_threads[4];
static QUEUE exit_message;
static QUEUE wq;
+static QUEUE run_slow_work_message;
+static QUEUE slow_io_pending_wq;
+static unsigned int slow_work_thread_threshold(void) {
+ return (nthreads + 1) / 2;
+}
static void uv__cancelled(struct uv__work* w) {
abort();
@@ -51,34 +57,67 @@ static void uv__cancelled(struct uv__work* w) {
static void worker(void* arg) {
struct uv__work* w;
QUEUE* q;
+ int is_slow_work;
uv_sem_post((uv_sem_t*) arg);
arg = NULL;
+ uv_mutex_lock(&mutex);
for (;;) {
- uv_mutex_lock(&mutex);
-
- while (QUEUE_EMPTY(&wq)) {
+ /* `mutex` should always be locked at this point. */
+
+ /* Keep waiting while either no work is present or only slow I/O
+ and we're at the threshold for that. */
+ while (QUEUE_EMPTY(&wq) ||
+ (QUEUE_HEAD(&wq) == &run_slow_work_message &&
+ QUEUE_NEXT(&run_slow_work_message) == &wq &&
+ slow_io_work_running >= slow_work_thread_threshold())) {
idle_threads += 1;
uv_cond_wait(&cond, &mutex);
idle_threads -= 1;
}
q = QUEUE_HEAD(&wq);
-
- if (q == &exit_message)
+ if (q == &exit_message) {
uv_cond_signal(&cond);
- else {
+ uv_mutex_unlock(&mutex);
+ break;
+ }
+
+ QUEUE_REMOVE(q);
+ QUEUE_INIT(q); /* Signal uv_cancel() that the work req is executing. */
+
+ is_slow_work = 0;
+ if (q == &run_slow_work_message) {
+ /* If we're at the slow I/O threshold, re-schedule until after all
+ other work in the queue is done. */
+ if (slow_io_work_running >= slow_work_thread_threshold()) {
+ QUEUE_INSERT_TAIL(&wq, q);
+ continue;
+ }
+
+ /* If we encountered a request to run slow I/O work but there is none
+ to run, that means it's cancelled => Start over. */
+ if (QUEUE_EMPTY(&slow_io_pending_wq))
+ continue;
+
+ is_slow_work = 1;
+ slow_io_work_running++;
+
+ q = QUEUE_HEAD(&slow_io_pending_wq);
QUEUE_REMOVE(q);
- QUEUE_INIT(q); /* Signal uv_cancel() that the work req is
- executing. */
+ QUEUE_INIT(q);
+
+ /* If there is more slow I/O work, schedule it to be run as well. */
+ if (!QUEUE_EMPTY(&slow_io_pending_wq)) {
+ QUEUE_INSERT_TAIL(&wq, &run_slow_work_message);
+ if (idle_threads > 0)
+ uv_cond_signal(&cond);
+ }
}
uv_mutex_unlock(&mutex);
- if (q == &exit_message)
- break;
-
w = QUEUE_DATA(q, struct uv__work, wq);
w->work(w);
@@ -88,12 +127,32 @@ static void worker(void* arg) {
QUEUE_INSERT_TAIL(&w->loop->wq, &w->wq);
uv_async_send(&w->loop->wq_async);
uv_mutex_unlock(&w->loop->wq_mutex);
+
+ /* Lock `mutex` since that is expected at the start of the next
+ * iteration. */
+ uv_mutex_lock(&mutex);
+ if (is_slow_work) {
+ /* `slow_io_work_running` is protected by `mutex`. */
+ slow_io_work_running--;
+ }
}
}
-static void post(QUEUE* q) {
+static void post(QUEUE* q, enum uv__work_kind kind) {
uv_mutex_lock(&mutex);
+ if (kind == UV__WORK_SLOW_IO) {
+ /* Insert into a separate queue. */
+ QUEUE_INSERT_TAIL(&slow_io_pending_wq, q);
+ if (!QUEUE_EMPTY(&run_slow_work_message)) {
+ /* Running slow I/O tasks is already scheduled => Nothing to do here.
+ The worker that runs said other task will schedule this one as well. */
+ uv_mutex_unlock(&mutex);
+ return;
+ }
+ q = &run_slow_work_message;
+ }
+
QUEUE_INSERT_TAIL(&wq, q);
if (idle_threads > 0)
uv_cond_signal(&cond);
@@ -108,7 +167,7 @@ UV_DESTRUCTOR(static void cleanup(void)) {
if (nthreads == 0)
return;
- post(&exit_message);
+ post(&exit_message, UV__WORK_CPU);
for (i = 0; i < nthreads; i++)
if (uv_thread_join(threads + i))
@@ -156,6 +215,8 @@ static void init_threads(void) {
abort();
QUEUE_INIT(&wq);
+ QUEUE_INIT(&slow_io_pending_wq);
+ QUEUE_INIT(&run_slow_work_message);
if (uv_sem_init(&sem, 0))
abort();
@@ -194,13 +255,14 @@ static void init_once(void) {
void uv__work_submit(uv_loop_t* loop,
struct uv__work* w,
+ enum uv__work_kind kind,
void (*work)(struct uv__work* w),
void (*done)(struct uv__work* w, int status)) {
uv_once(&once, init_once);
w->loop = loop;
w->work = work;
w->done = done;
- post(&w->wq);
+ post(&w->wq, kind);
}
@@ -284,7 +346,11 @@ int uv_queue_work(uv_loop_t* loop,
req->loop = loop;
req->work_cb = work_cb;
req->after_work_cb = after_work_cb;
- uv__work_submit(loop, &req->work_req, uv__queue_work, uv__queue_done);
+ uv__work_submit(loop,
+ &req->work_req,
+ UV__WORK_CPU,
+ uv__queue_work,
+ uv__queue_done);
return 0;
}
diff --git a/deps/uv/src/unix/bsd-ifaddrs.c b/deps/uv/src/unix/bsd-ifaddrs.c
index 0d0215448640a4..9825b1c4db4865 100644
--- a/deps/uv/src/unix/bsd-ifaddrs.c
+++ b/deps/uv/src/unix/bsd-ifaddrs.c
@@ -119,16 +119,13 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int* count) {
continue;
address = *addresses;
+ memset(address->phys_addr, 0, sizeof(address->phys_addr));
for (i = 0; i < *count; i++) {
if (strcmp(address->name, ent->ifa_name) == 0) {
-#if defined(__CYGWIN__) || defined(__MSYS__)
- memset(address->phys_addr, 0, sizeof(address->phys_addr));
-#else
struct sockaddr_dl* sa_addr;
sa_addr = (struct sockaddr_dl*)(ent->ifa_addr);
memcpy(address->phys_addr, LLADDR(sa_addr), sizeof(address->phys_addr));
-#endif
}
address++;
}
diff --git a/deps/uv/src/unix/cygwin.c b/deps/uv/src/unix/cygwin.c
index 9fe4093ef46fb0..9da20e203aa238 100644
--- a/deps/uv/src/unix/cygwin.c
+++ b/deps/uv/src/unix/cygwin.c
@@ -38,7 +38,7 @@ int uv_uptime(double* uptime) {
int uv_resident_set_memory(size_t* rss) {
/* FIXME: read /proc/meminfo? */
*rss = 0;
- return UV_ENOSYS;
+ return 0;
}
int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) {
diff --git a/deps/uv/src/unix/fs.c b/deps/uv/src/unix/fs.c
index 652cdfd734ac5b..3db5f89c9503d2 100644
--- a/deps/uv/src/unix/fs.c
+++ b/deps/uv/src/unix/fs.c
@@ -43,7 +43,6 @@
#include
#include
#include
-#include
#include
#if defined(__DragonFly__) || \
@@ -67,6 +66,10 @@
# define FICLONE _IOW(0x94, 9, int)
#endif
+#if defined(_AIX) && !defined(_AIX71)
+# include
+#endif
+
#define INIT(subtype) \
do { \
if (req == NULL) \
@@ -120,7 +123,11 @@
do { \
if (cb != NULL) { \
uv__req_register(loop, req); \
- uv__work_submit(loop, &req->work_req, uv__fs_work, uv__fs_done); \
+ uv__work_submit(loop, \
+ &req->work_req, \
+ UV__WORK_FAST_IO, \
+ uv__fs_work, \
+ uv__fs_done); \
return 0; \
} \
else { \
@@ -165,59 +172,17 @@ static ssize_t uv__fs_fdatasync(uv_fs_t* req) {
static ssize_t uv__fs_futime(uv_fs_t* req) {
-#if defined(__linux__)
+#if defined(__linux__) \
+ || defined(_AIX71)
/* utimesat() has nanosecond resolution but we stick to microseconds
* for the sake of consistency with other platforms.
*/
- static int no_utimesat;
struct timespec ts[2];
- struct timeval tv[2];
- char path[sizeof("/proc/self/fd/") + 3 * sizeof(int)];
- int r;
-
- if (no_utimesat)
- goto skip;
-
ts[0].tv_sec = req->atime;
ts[0].tv_nsec = (uint64_t)(req->atime * 1000000) % 1000000 * 1000;
ts[1].tv_sec = req->mtime;
ts[1].tv_nsec = (uint64_t)(req->mtime * 1000000) % 1000000 * 1000;
-
- r = uv__utimesat(req->file, NULL, ts, 0);
- if (r == 0)
- return r;
-
- if (errno != ENOSYS)
- return r;
-
- no_utimesat = 1;
-
-skip:
-
- tv[0].tv_sec = req->atime;
- tv[0].tv_usec = (uint64_t)(req->atime * 1000000) % 1000000;
- tv[1].tv_sec = req->mtime;
- tv[1].tv_usec = (uint64_t)(req->mtime * 1000000) % 1000000;
- snprintf(path, sizeof(path), "/proc/self/fd/%d", (int) req->file);
-
- r = utimes(path, tv);
- if (r == 0)
- return r;
-
- switch (errno) {
- case ENOENT:
- if (fcntl(req->file, F_GETFL) == -1 && errno == EBADF)
- break;
- /* Fall through. */
-
- case EACCES:
- case ENOTDIR:
- errno = ENOSYS;
- break;
- }
-
- return r;
-
+ return futimens(req->file, ts);
#elif defined(__APPLE__) \
|| defined(__DragonFly__) \
|| defined(__FreeBSD__) \
@@ -235,13 +200,6 @@ static ssize_t uv__fs_futime(uv_fs_t* req) {
# else
return futimes(req->file, tv);
# endif
-#elif defined(_AIX71)
- struct timespec ts[2];
- ts[0].tv_sec = req->atime;
- ts[0].tv_nsec = (uint64_t)(req->atime * 1000000) % 1000000 * 1000;
- ts[1].tv_sec = req->mtime;
- ts[1].tv_nsec = (uint64_t)(req->mtime * 1000000) % 1000000 * 1000;
- return futimens(req->file, ts);
#elif defined(__MVS__)
attrib_t atr;
memset(&atr, 0, sizeof(atr));
@@ -304,17 +262,13 @@ static ssize_t uv__fs_read(uv_fs_t* req) {
#if defined(__linux__)
static int no_preadv;
#endif
+ unsigned int iovmax;
ssize_t result;
-#if defined(_AIX)
- struct stat buf;
- if(fstat(req->file, &buf))
- return -1;
- if(S_ISDIR(buf.st_mode)) {
- errno = EISDIR;
- return -1;
- }
-#endif /* defined(_AIX) */
+ iovmax = uv__getiovmax();
+ if (req->nbufs > iovmax)
+ req->nbufs = iovmax;
+
if (req->off < 0) {
if (req->nbufs == 1)
result = read(req->file, req->bufs[0].base, req->bufs[0].len);
@@ -333,25 +287,7 @@ static ssize_t uv__fs_read(uv_fs_t* req) {
if (no_preadv) retry:
# endif
{
- off_t nread;
- size_t index;
-
- nread = 0;
- index = 0;
- result = 1;
- do {
- if (req->bufs[index].len > 0) {
- result = pread(req->file,
- req->bufs[index].base,
- req->bufs[index].len,
- req->off + nread);
- if (result > 0)
- nread += result;
- }
- index++;
- } while (index < req->nbufs && result > 0);
- if (nread > 0)
- result = nread;
+ result = pread(req->file, req->bufs[0].base, req->bufs[0].len, req->off);
}
# if defined(__linux__)
else {
@@ -369,6 +305,13 @@ static ssize_t uv__fs_read(uv_fs_t* req) {
}
done:
+ /* Early cleanup of bufs allocation, since we're done with it. */
+ if (req->bufs != req->bufsml)
+ uv__free(req->bufs);
+
+ req->bufs = NULL;
+ req->nbufs = 0;
+
return result;
}
@@ -433,11 +376,13 @@ static ssize_t uv__fs_pathmax_size(const char* path) {
}
static ssize_t uv__fs_readlink(uv_fs_t* req) {
+ ssize_t maxlen;
ssize_t len;
char* buf;
+ char* newbuf;
- len = uv__fs_pathmax_size(req->path);
- buf = uv__malloc(len + 1);
+ maxlen = uv__fs_pathmax_size(req->path);
+ buf = uv__malloc(maxlen);
if (buf == NULL) {
errno = ENOMEM;
@@ -445,17 +390,28 @@ static ssize_t uv__fs_readlink(uv_fs_t* req) {
}
#if defined(__MVS__)
- len = os390_readlink(req->path, buf, len);
+ len = os390_readlink(req->path, buf, maxlen);
#else
- len = readlink(req->path, buf, len);
+ len = readlink(req->path, buf, maxlen);
#endif
-
if (len == -1) {
uv__free(buf);
return -1;
}
+ /* Uncommon case: resize to make room for the trailing nul byte. */
+ if (len == maxlen) {
+ newbuf = uv__realloc(buf, len + 1);
+
+ if (newbuf == NULL) {
+ uv__free(buf);
+ return -1;
+ }
+
+ buf = newbuf;
+ }
+
buf[len] = '\0';
req->ptr = buf;
@@ -698,10 +654,48 @@ static ssize_t uv__fs_sendfile(uv_fs_t* req) {
static ssize_t uv__fs_utime(uv_fs_t* req) {
+#if defined(__linux__) \
+ || defined(_AIX71) \
+ || defined(__sun)
+ /* utimesat() has nanosecond resolution but we stick to microseconds
+ * for the sake of consistency with other platforms.
+ */
+ struct timespec ts[2];
+ ts[0].tv_sec = req->atime;
+ ts[0].tv_nsec = (uint64_t)(req->atime * 1000000) % 1000000 * 1000;
+ ts[1].tv_sec = req->mtime;
+ ts[1].tv_nsec = (uint64_t)(req->mtime * 1000000) % 1000000 * 1000;
+ return utimensat(AT_FDCWD, req->path, ts, 0);
+#elif defined(__APPLE__) \
+ || defined(__DragonFly__) \
+ || defined(__FreeBSD__) \
+ || defined(__FreeBSD_kernel__) \
+ || defined(__NetBSD__) \
+ || defined(__OpenBSD__)
+ struct timeval tv[2];
+ tv[0].tv_sec = req->atime;
+ tv[0].tv_usec = (uint64_t)(req->atime * 1000000) % 1000000;
+ tv[1].tv_sec = req->mtime;
+ tv[1].tv_usec = (uint64_t)(req->mtime * 1000000) % 1000000;
+ return utimes(req->path, tv);
+#elif defined(_AIX) \
+ && !defined(_AIX71)
struct utimbuf buf;
buf.actime = req->atime;
buf.modtime = req->mtime;
- return utime(req->path, &buf); /* TODO use utimes() where available */
+ return utime(req->path, &buf);
+#elif defined(__MVS__)
+ attrib_t atr;
+ memset(&atr, 0, sizeof(atr));
+ atr.att_mtimechg = 1;
+ atr.att_atimechg = 1;
+ atr.att_mtime = req->mtime;
+ atr.att_atime = req->atime;
+ return __lchattr(req->path, &atr, sizeof(atr));
+#else
+ errno = ENOSYS;
+ return -1;
+#endif
}
@@ -739,25 +733,7 @@ static ssize_t uv__fs_write(uv_fs_t* req) {
if (no_pwritev) retry:
# endif
{
- off_t written;
- size_t index;
-
- written = 0;
- index = 0;
- r = 0;
- do {
- if (req->bufs[index].len > 0) {
- r = pwrite(req->file,
- req->bufs[index].base,
- req->bufs[index].len,
- req->off + written);
- if (r > 0)
- written += r;
- }
- index++;
- } while (index < req->nbufs && r >= 0);
- if (written > 0)
- r = written;
+ r = pwrite(req->file, req->bufs[0].base, req->bufs[0].len, req->off);
}
# if defined(__linux__)
else {
@@ -1049,9 +1025,21 @@ static int uv__fs_fstat(int fd, uv_stat_t *buf) {
return ret;
}
+static size_t uv__fs_buf_offset(uv_buf_t* bufs, size_t size) {
+ size_t offset;
+ /* Figure out which bufs are done */
+ for (offset = 0; size > 0 && bufs[offset].len <= size; ++offset)
+ size -= bufs[offset].len;
-typedef ssize_t (*uv__fs_buf_iter_processor)(uv_fs_t* req);
-static ssize_t uv__fs_buf_iter(uv_fs_t* req, uv__fs_buf_iter_processor process) {
+ /* Fix a partial read/write */
+ if (size > 0) {
+ bufs[offset].base += size;
+ bufs[offset].len -= size;
+ }
+ return offset;
+}
+
+static ssize_t uv__fs_write_all(uv_fs_t* req) {
unsigned int iovmax;
unsigned int nbufs;
uv_buf_t* bufs;
@@ -1068,7 +1056,10 @@ static ssize_t uv__fs_buf_iter(uv_fs_t* req, uv__fs_buf_iter_processor process)
if (req->nbufs > iovmax)
req->nbufs = iovmax;
- result = process(req);
+ do
+ result = uv__fs_write(req);
+ while (result < 0 && errno == EINTR);
+
if (result <= 0) {
if (total == 0)
total = result;
@@ -1078,14 +1069,12 @@ static ssize_t uv__fs_buf_iter(uv_fs_t* req, uv__fs_buf_iter_processor process)
if (req->off >= 0)
req->off += result;
+ req->nbufs = uv__fs_buf_offset(req->bufs, result);
req->bufs += req->nbufs;
nbufs -= req->nbufs;
total += result;
}
- if (errno == EINTR && total == -1)
- return total;
-
if (bufs != req->bufsml)
uv__free(bufs);
@@ -1102,7 +1091,8 @@ static void uv__fs_work(struct uv__work* w) {
ssize_t r;
req = container_of(w, uv_fs_t, work_req);
- retry_on_eintr = !(req->fs_type == UV_FS_CLOSE);
+ retry_on_eintr = !(req->fs_type == UV_FS_CLOSE ||
+ req->fs_type == UV_FS_READ);
do {
errno = 0;
@@ -1131,7 +1121,7 @@ static void uv__fs_work(struct uv__work* w) {
X(MKDIR, mkdir(req->path, req->mode));
X(MKDTEMP, uv__fs_mkdtemp(req));
X(OPEN, uv__fs_open(req));
- X(READ, uv__fs_buf_iter(req, uv__fs_read));
+ X(READ, uv__fs_read(req));
X(SCANDIR, uv__fs_scandir(req));
X(READLINK, uv__fs_readlink(req));
X(REALPATH, uv__fs_realpath(req));
@@ -1142,7 +1132,7 @@ static void uv__fs_work(struct uv__work* w) {
X(SYMLINK, symlink(req->path, req->new_path));
X(UNLINK, unlink(req->path));
X(UTIME, uv__fs_utime(req));
- X(WRITE, uv__fs_buf_iter(req, uv__fs_write));
+ X(WRITE, uv__fs_write_all(req));
default: abort();
}
#undef X
diff --git a/deps/uv/src/unix/getaddrinfo.c b/deps/uv/src/unix/getaddrinfo.c
index 10e8afd75e831b..25827c1feeb6b3 100644
--- a/deps/uv/src/unix/getaddrinfo.c
+++ b/deps/uv/src/unix/getaddrinfo.c
@@ -186,6 +186,7 @@ int uv_getaddrinfo(uv_loop_t* loop,
if (cb) {
uv__work_submit(loop,
&req->work_req,
+ UV__WORK_SLOW_IO,
uv__getaddrinfo_work,
uv__getaddrinfo_done);
return 0;
diff --git a/deps/uv/src/unix/getnameinfo.c b/deps/uv/src/unix/getnameinfo.c
index 9a4367224c7fa6..991002a67d7072 100644
--- a/deps/uv/src/unix/getnameinfo.c
+++ b/deps/uv/src/unix/getnameinfo.c
@@ -109,6 +109,7 @@ int uv_getnameinfo(uv_loop_t* loop,
if (getnameinfo_cb) {
uv__work_submit(loop,
&req->work_req,
+ UV__WORK_SLOW_IO,
uv__getnameinfo_work,
uv__getnameinfo_done);
return 0;
diff --git a/deps/uv/src/unix/ibmi.c b/deps/uv/src/unix/ibmi.c
index c50a4e76f84119..b1ab549c23f4b9 100644
--- a/deps/uv/src/unix/ibmi.c
+++ b/deps/uv/src/unix/ibmi.c
@@ -72,7 +72,8 @@ void uv_loadavg(double avg[3]) {
int uv_resident_set_memory(size_t* rss) {
- return UV_ENOSYS;
+ *rss = 0;
+ return 0;
}
diff --git a/deps/uv/src/unix/linux-core.c b/deps/uv/src/unix/linux-core.c
index d09bbcdd6f292b..75362eb76d7f5d 100644
--- a/deps/uv/src/unix/linux-core.c
+++ b/deps/uv/src/unix/linux-core.c
@@ -20,7 +20,7 @@
/* We lean on the fact that POLL{IN,OUT,ERR,HUP} correspond with their
* EPOLL* counterparts. We use the POLL* variants in this file because that
- * is what libuv uses elsewhere and it avoids a dependency on .
+ * is what libuv uses elsewhere.
*/
#include "uv.h"
@@ -34,6 +34,7 @@
#include
#include
+#include
#include
#include
#include
@@ -84,13 +85,13 @@ static unsigned long read_cpufreq(unsigned int cpunum);
int uv__platform_loop_init(uv_loop_t* loop) {
int fd;
- fd = uv__epoll_create1(UV__EPOLL_CLOEXEC);
+ fd = epoll_create1(EPOLL_CLOEXEC);
/* epoll_create1() can fail either because it's not implemented (old kernel)
* or because it doesn't understand the EPOLL_CLOEXEC flag.
*/
if (fd == -1 && (errno == ENOSYS || errno == EINVAL)) {
- fd = uv__epoll_create(256);
+ fd = epoll_create(256);
if (fd != -1)
uv__cloexec(fd, 1);
@@ -134,20 +135,20 @@ void uv__platform_loop_delete(uv_loop_t* loop) {
void uv__platform_invalidate_fd(uv_loop_t* loop, int fd) {
- struct uv__epoll_event* events;
- struct uv__epoll_event dummy;
+ struct epoll_event* events;
+ struct epoll_event dummy;
uintptr_t i;
uintptr_t nfds;
assert(loop->watchers != NULL);
- events = (struct uv__epoll_event*) loop->watchers[loop->nwatchers];
+ events = (struct epoll_event*) loop->watchers[loop->nwatchers];
nfds = (uintptr_t) loop->watchers[loop->nwatchers + 1];
if (events != NULL)
/* Invalidate events with same file descriptor */
for (i = 0; i < nfds; i++)
- if ((int) events[i].data == fd)
- events[i].data = -1;
+ if (events[i].data.fd == fd)
+ events[i].data.fd = -1;
/* Remove the file descriptor from the epoll.
* This avoids a problem where the same file description remains open
@@ -160,25 +161,25 @@ void uv__platform_invalidate_fd(uv_loop_t* loop, int fd) {
* has the EPOLLWAKEUP flag set generates spurious audit syslog warnings.
*/
memset(&dummy, 0, sizeof(dummy));
- uv__epoll_ctl(loop->backend_fd, UV__EPOLL_CTL_DEL, fd, &dummy);
+ epoll_ctl(loop->backend_fd, EPOLL_CTL_DEL, fd, &dummy);
}
}
int uv__io_check_fd(uv_loop_t* loop, int fd) {
- struct uv__epoll_event e;
+ struct epoll_event e;
int rc;
e.events = POLLIN;
- e.data = -1;
+ e.data.fd = -1;
rc = 0;
- if (uv__epoll_ctl(loop->backend_fd, UV__EPOLL_CTL_ADD, fd, &e))
+ if (epoll_ctl(loop->backend_fd, EPOLL_CTL_ADD, fd, &e))
if (errno != EEXIST)
rc = UV__ERR(errno);
if (rc == 0)
- if (uv__epoll_ctl(loop->backend_fd, UV__EPOLL_CTL_DEL, fd, &e))
+ if (epoll_ctl(loop->backend_fd, EPOLL_CTL_DEL, fd, &e))
abort();
return rc;
@@ -195,16 +196,14 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
* that being the largest value I have seen in the wild (and only once.)
*/
static const int max_safe_timeout = 1789569;
- static int no_epoll_pwait;
- static int no_epoll_wait;
- struct uv__epoll_event events[1024];
- struct uv__epoll_event* pe;
- struct uv__epoll_event e;
+ struct epoll_event events[1024];
+ struct epoll_event* pe;
+ struct epoll_event e;
int real_timeout;
QUEUE* q;
uv__io_t* w;
sigset_t sigset;
- uint64_t sigmask;
+ sigset_t* psigset;
uint64_t base;
int have_signals;
int nevents;
@@ -230,35 +229,35 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
assert(w->fd < (int) loop->nwatchers);
e.events = w->pevents;
- e.data = w->fd;
+ e.data.fd = w->fd;
if (w->events == 0)
- op = UV__EPOLL_CTL_ADD;
+ op = EPOLL_CTL_ADD;
else
- op = UV__EPOLL_CTL_MOD;
+ op = EPOLL_CTL_MOD;
/* XXX Future optimization: do EPOLL_CTL_MOD lazily if we stop watching
* events, skip the syscall and squelch the events after epoll_wait().
*/
- if (uv__epoll_ctl(loop->backend_fd, op, w->fd, &e)) {
+ if (epoll_ctl(loop->backend_fd, op, w->fd, &e)) {
if (errno != EEXIST)
abort();
- assert(op == UV__EPOLL_CTL_ADD);
+ assert(op == EPOLL_CTL_ADD);
/* We've reactivated a file descriptor that's been watched before. */
- if (uv__epoll_ctl(loop->backend_fd, UV__EPOLL_CTL_MOD, w->fd, &e))
+ if (epoll_ctl(loop->backend_fd, EPOLL_CTL_MOD, w->fd, &e))
abort();
}
w->events = w->pevents;
}
- sigmask = 0;
+ psigset = NULL;
if (loop->flags & UV_LOOP_BLOCK_SIGPROF) {
sigemptyset(&sigset);
sigaddset(&sigset, SIGPROF);
- sigmask |= 1 << (SIGPROF - 1);
+ psigset = &sigset;
}
assert(timeout >= -1);
@@ -273,30 +272,11 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
if (sizeof(int32_t) == sizeof(long) && timeout >= max_safe_timeout)
timeout = max_safe_timeout;
- if (sigmask != 0 && no_epoll_pwait != 0)
- if (pthread_sigmask(SIG_BLOCK, &sigset, NULL))
- abort();
-
- if (no_epoll_wait != 0 || (sigmask != 0 && no_epoll_pwait == 0)) {
- nfds = uv__epoll_pwait(loop->backend_fd,
- events,
- ARRAY_SIZE(events),
- timeout,
- sigmask);
- if (nfds == -1 && errno == ENOSYS)
- no_epoll_pwait = 1;
- } else {
- nfds = uv__epoll_wait(loop->backend_fd,
- events,
- ARRAY_SIZE(events),
- timeout);
- if (nfds == -1 && errno == ENOSYS)
- no_epoll_wait = 1;
- }
-
- if (sigmask != 0 && no_epoll_pwait != 0)
- if (pthread_sigmask(SIG_UNBLOCK, &sigset, NULL))
- abort();
+ nfds = epoll_pwait(loop->backend_fd,
+ events,
+ ARRAY_SIZE(events),
+ timeout,
+ psigset);
/* Update loop->time unconditionally. It's tempting to skip the update when
* timeout == 0 (i.e. non-blocking poll) but there is no guarantee that the
@@ -317,12 +297,6 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
}
if (nfds == -1) {
- if (errno == ENOSYS) {
- /* epoll_wait() or epoll_pwait() failed, try the other system call. */
- assert(no_epoll_wait == 0 || no_epoll_pwait == 0);
- continue;
- }
-
if (errno != EINTR)
abort();
@@ -344,7 +318,7 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
loop->watchers[loop->nwatchers + 1] = (void*) (uintptr_t) nfds;
for (i = 0; i < nfds; i++) {
pe = events + i;
- fd = pe->data;
+ fd = pe->data.fd;
/* Skip invalidated events, see uv__platform_invalidate_fd */
if (fd == -1)
@@ -361,7 +335,7 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
* Ignore all errors because we may be racing with another thread
* when the file descriptor is closed.
*/
- uv__epoll_ctl(loop->backend_fd, UV__EPOLL_CTL_DEL, fd, pe);
+ epoll_ctl(loop->backend_fd, EPOLL_CTL_DEL, fd, pe);
continue;
}
@@ -916,6 +890,7 @@ int uv_interface_addresses(uv_interface_address_t** addresses,
continue;
address = *addresses;
+ memset(address->phys_addr, 0, sizeof(address->phys_addr));
for (i = 0; i < (*count); i++) {
if (strcmp(address->name, ent->ifa_name) == 0) {
diff --git a/deps/uv/src/unix/linux-syscalls.c b/deps/uv/src/unix/linux-syscalls.c
index 89998ded26b17c..bfd75448793388 100644
--- a/deps/uv/src/unix/linux-syscalls.c
+++ b/deps/uv/src/unix/linux-syscalls.c
@@ -77,56 +77,6 @@
# endif
#endif /* __NR_eventfd2 */
-#ifndef __NR_epoll_create
-# if defined(__x86_64__)
-# define __NR_epoll_create 213
-# elif defined(__i386__)
-# define __NR_epoll_create 254
-# elif defined(__arm__)
-# define __NR_epoll_create (UV_SYSCALL_BASE + 250)
-# endif
-#endif /* __NR_epoll_create */
-
-#ifndef __NR_epoll_create1
-# if defined(__x86_64__)
-# define __NR_epoll_create1 291
-# elif defined(__i386__)
-# define __NR_epoll_create1 329
-# elif defined(__arm__)
-# define __NR_epoll_create1 (UV_SYSCALL_BASE + 357)
-# endif
-#endif /* __NR_epoll_create1 */
-
-#ifndef __NR_epoll_ctl
-# if defined(__x86_64__)
-# define __NR_epoll_ctl 233 /* used to be 214 */
-# elif defined(__i386__)
-# define __NR_epoll_ctl 255
-# elif defined(__arm__)
-# define __NR_epoll_ctl (UV_SYSCALL_BASE + 251)
-# endif
-#endif /* __NR_epoll_ctl */
-
-#ifndef __NR_epoll_wait
-# if defined(__x86_64__)
-# define __NR_epoll_wait 232 /* used to be 215 */
-# elif defined(__i386__)
-# define __NR_epoll_wait 256
-# elif defined(__arm__)
-# define __NR_epoll_wait (UV_SYSCALL_BASE + 252)
-# endif
-#endif /* __NR_epoll_wait */
-
-#ifndef __NR_epoll_pwait
-# if defined(__x86_64__)
-# define __NR_epoll_pwait 281
-# elif defined(__i386__)
-# define __NR_epoll_pwait 319
-# elif defined(__arm__)
-# define __NR_epoll_pwait (UV_SYSCALL_BASE + 346)
-# endif
-#endif /* __NR_epoll_pwait */
-
#ifndef __NR_inotify_init
# if defined(__x86_64__)
# define __NR_inotify_init 253
@@ -285,76 +235,6 @@ int uv__eventfd2(unsigned int count, int flags) {
}
-int uv__epoll_create(int size) {
-#if defined(__NR_epoll_create)
- return syscall(__NR_epoll_create, size);
-#else
- return errno = ENOSYS, -1;
-#endif
-}
-
-
-int uv__epoll_create1(int flags) {
-#if defined(__NR_epoll_create1)
- return syscall(__NR_epoll_create1, flags);
-#else
- return errno = ENOSYS, -1;
-#endif
-}
-
-
-int uv__epoll_ctl(int epfd, int op, int fd, struct uv__epoll_event* events) {
-#if defined(__NR_epoll_ctl)
- return syscall(__NR_epoll_ctl, epfd, op, fd, events);
-#else
- return errno = ENOSYS, -1;
-#endif
-}
-
-
-int uv__epoll_wait(int epfd,
- struct uv__epoll_event* events,
- int nevents,
- int timeout) {
-#if defined(__NR_epoll_wait)
- int result;
- result = syscall(__NR_epoll_wait, epfd, events, nevents, timeout);
-#if MSAN_ACTIVE
- if (result > 0)
- __msan_unpoison(events, sizeof(events[0]) * result);
-#endif
- return result;
-#else
- return errno = ENOSYS, -1;
-#endif
-}
-
-
-int uv__epoll_pwait(int epfd,
- struct uv__epoll_event* events,
- int nevents,
- int timeout,
- uint64_t sigmask) {
-#if defined(__NR_epoll_pwait)
- int result;
- result = syscall(__NR_epoll_pwait,
- epfd,
- events,
- nevents,
- timeout,
- &sigmask,
- sizeof(sigmask));
-#if MSAN_ACTIVE
- if (result > 0)
- __msan_unpoison(events, sizeof(events[0]) * result);
-#endif
- return result;
-#else
- return errno = ENOSYS, -1;
-#endif
-}
-
-
int uv__inotify_init(void) {
#if defined(__NR_inotify_init)
return syscall(__NR_inotify_init);
@@ -431,19 +311,6 @@ int uv__recvmmsg(int fd,
}
-int uv__utimesat(int dirfd,
- const char* path,
- const struct timespec times[2],
- int flags)
-{
-#if defined(__NR_utimensat)
- return syscall(__NR_utimensat, dirfd, path, times, flags);
-#else
- return errno = ENOSYS, -1;
-#endif
-}
-
-
ssize_t uv__preadv(int fd, const struct iovec *iov, int iovcnt, int64_t offset) {
#if defined(__NR_preadv)
return syscall(__NR_preadv, fd, iov, iovcnt, (long)offset, (long)(offset >> 32));
diff --git a/deps/uv/src/unix/linux-syscalls.h b/deps/uv/src/unix/linux-syscalls.h
index 4c095e9b537996..3dfd329d6c84b5 100644
--- a/deps/uv/src/unix/linux-syscalls.h
+++ b/deps/uv/src/unix/linux-syscalls.h
@@ -66,12 +66,6 @@
# define UV__SOCK_NONBLOCK UV__O_NONBLOCK
#endif
-/* epoll flags */
-#define UV__EPOLL_CLOEXEC UV__O_CLOEXEC
-#define UV__EPOLL_CTL_ADD 1
-#define UV__EPOLL_CTL_DEL 2
-#define UV__EPOLL_CTL_MOD 3
-
/* inotify flags */
#define UV__IN_ACCESS 0x001
#define UV__IN_MODIFY 0x002
@@ -86,18 +80,6 @@
#define UV__IN_DELETE_SELF 0x400
#define UV__IN_MOVE_SELF 0x800
-#if defined(__x86_64__)
-struct uv__epoll_event {
- uint32_t events;
- uint64_t data;
-} __attribute__((packed));
-#else
-struct uv__epoll_event {
- uint32_t events;
- uint64_t data;
-};
-#endif
-
struct uv__inotify_event {
int32_t wd;
uint32_t mask;
@@ -113,18 +95,6 @@ struct uv__mmsghdr {
int uv__accept4(int fd, struct sockaddr* addr, socklen_t* addrlen, int flags);
int uv__eventfd(unsigned int count);
-int uv__epoll_create(int size);
-int uv__epoll_create1(int flags);
-int uv__epoll_ctl(int epfd, int op, int fd, struct uv__epoll_event *ev);
-int uv__epoll_wait(int epfd,
- struct uv__epoll_event* events,
- int nevents,
- int timeout);
-int uv__epoll_pwait(int epfd,
- struct uv__epoll_event* events,
- int nevents,
- int timeout,
- uint64_t sigmask);
int uv__eventfd2(unsigned int count, int flags);
int uv__inotify_init(void);
int uv__inotify_init1(int flags);
@@ -140,10 +110,6 @@ int uv__sendmmsg(int fd,
struct uv__mmsghdr* mmsg,
unsigned int vlen,
unsigned int flags);
-int uv__utimesat(int dirfd,
- const char* path,
- const struct timespec times[2],
- int flags);
ssize_t uv__preadv(int fd, const struct iovec *iov, int iovcnt, int64_t offset);
ssize_t uv__pwritev(int fd, const struct iovec *iov, int iovcnt, int64_t offset);
int uv__dup3(int oldfd, int newfd, int flags);
diff --git a/deps/uv/src/unix/os390-syscalls.h b/deps/uv/src/unix/os390-syscalls.h
index 6e34a88cb95d1b..ea599107b30281 100644
--- a/deps/uv/src/unix/os390-syscalls.h
+++ b/deps/uv/src/unix/os390-syscalls.h
@@ -36,10 +36,6 @@
#define MAX_ITEMS_PER_EPOLL 1024
#define UV__O_CLOEXEC 0x80000
-#define UV__EPOLL_CLOEXEC UV__O_CLOEXEC
-#define UV__EPOLL_CTL_ADD EPOLL_CTL_ADD
-#define UV__EPOLL_CTL_DEL EPOLL_CTL_DEL
-#define UV__EPOLL_CTL_MOD EPOLL_CTL_MOD
struct epoll_event {
int events;
diff --git a/deps/uv/src/unix/os390.c b/deps/uv/src/unix/os390.c
index f766b393395ee7..65e9b708303668 100644
--- a/deps/uv/src/unix/os390.c
+++ b/deps/uv/src/unix/os390.c
@@ -512,7 +512,7 @@ static int uv__interface_addresses_v6(uv_interface_address_t** addresses,
/* TODO: Retrieve netmask using SIOCGIFNETMASK ioctl */
address->is_internal = flg.__nif6e_flags & _NIF6E_FLAGS_LOOPBACK ? 1 : 0;
-
+ memset(address->phys_addr, 0, sizeof(address->phys_addr));
address++;
}
@@ -624,6 +624,7 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int* count) {
}
address->is_internal = flg.ifr_flags & IFF_LOOPBACK ? 1 : 0;
+ memset(address->phys_addr, 0, sizeof(address->phys_addr));
address++;
}
@@ -662,7 +663,7 @@ void uv__platform_invalidate_fd(uv_loop_t* loop, int fd) {
/* Remove the file descriptor from the epoll. */
if (loop->ep != NULL)
- epoll_ctl(loop->ep, UV__EPOLL_CTL_DEL, fd, &dummy);
+ epoll_ctl(loop->ep, EPOLL_CTL_DEL, fd, &dummy);
}
@@ -838,9 +839,9 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
e.fd = w->fd;
if (w->events == 0)
- op = UV__EPOLL_CTL_ADD;
+ op = EPOLL_CTL_ADD;
else
- op = UV__EPOLL_CTL_MOD;
+ op = EPOLL_CTL_MOD;
/* XXX Future optimization: do EPOLL_CTL_MOD lazily if we stop watching
* events, skip the syscall and squelch the events after epoll_wait().
@@ -849,10 +850,10 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
if (errno != EEXIST)
abort();
- assert(op == UV__EPOLL_CTL_ADD);
+ assert(op == EPOLL_CTL_ADD);
/* We've reactivated a file descriptor that's been watched before. */
- if (epoll_ctl(loop->ep, UV__EPOLL_CTL_MOD, w->fd, &e))
+ if (epoll_ctl(loop->ep, EPOLL_CTL_MOD, w->fd, &e))
abort();
}
@@ -934,7 +935,7 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
* Ignore all errors because we may be racing with another thread
* when the file descriptor is closed.
*/
- epoll_ctl(loop->ep, UV__EPOLL_CTL_DEL, fd, pe);
+ epoll_ctl(loop->ep, EPOLL_CTL_DEL, fd, pe);
continue;
}
diff --git a/deps/uv/src/unix/pipe.c b/deps/uv/src/unix/pipe.c
index 0718bc81b86f63..e450a30e9c7e0c 100644
--- a/deps/uv/src/unix/pipe.c
+++ b/deps/uv/src/unix/pipe.c
@@ -132,11 +132,21 @@ void uv__pipe_close(uv_pipe_t* handle) {
int uv_pipe_open(uv_pipe_t* handle, uv_file fd) {
+ int flags;
+ int mode;
int err;
+ flags = 0;
if (uv__fd_exists(handle->loop, fd))
return UV_EEXIST;
+ do
+ mode = fcntl(fd, F_GETFL);
+ while (mode == -1 && errno == EINTR);
+
+ if (mode == -1)
+ return UV__ERR(errno); /* according to docs, must be EBADF */
+
err = uv__nonblock(fd, 1);
if (err)
return err;
@@ -147,9 +157,13 @@ int uv_pipe_open(uv_pipe_t* handle, uv_file fd) {
return err;
#endif /* defined(__APPLE__) */
- return uv__stream_open((uv_stream_t*)handle,
- fd,
- UV_HANDLE_READABLE | UV_HANDLE_WRITABLE);
+ mode &= O_ACCMODE;
+ if (mode != O_WRONLY)
+ flags |= UV_HANDLE_READABLE;
+ if (mode != O_RDONLY)
+ flags |= UV_HANDLE_WRITABLE;
+
+ return uv__stream_open((uv_stream_t*)handle, fd, flags);
}
diff --git a/deps/uv/src/unix/stream.c b/deps/uv/src/unix/stream.c
index 5a96b66b17bfd5..2e84eeeb82877e 100644
--- a/deps/uv/src/unix/stream.c
+++ b/deps/uv/src/unix/stream.c
@@ -1676,6 +1676,7 @@ void uv__stream_close(uv_stream_t* handle) {
uv__io_close(handle->loop, &handle->io_watcher);
uv_read_stop(handle);
uv__handle_stop(handle);
+ handle->flags &= ~(UV_HANDLE_READABLE | UV_HANDLE_WRITABLE);
if (handle->io_watcher.fd != -1) {
/* Don't close stdio file descriptors. Nothing good comes from it. */
diff --git a/deps/uv/src/unix/thread.c b/deps/uv/src/unix/thread.c
index 303bc6ec84f341..29004707a41947 100644
--- a/deps/uv/src/unix/thread.c
+++ b/deps/uv/src/unix/thread.c
@@ -44,108 +44,119 @@
#undef NANOSEC
#define NANOSEC ((uint64_t) 1e9)
+#if defined(PTHREAD_BARRIER_SERIAL_THREAD)
+STATIC_ASSERT(sizeof(uv_barrier_t) == sizeof(pthread_barrier_t));
+#endif
-#if defined(UV__PTHREAD_BARRIER_FALLBACK)
-/* TODO: support barrier_attr */
-int pthread_barrier_init(pthread_barrier_t* barrier,
- const void* barrier_attr,
- unsigned count) {
+/* Note: guard clauses should match uv_barrier_t's in include/uv/uv-unix.h. */
+#if defined(_AIX) || !defined(PTHREAD_BARRIER_SERIAL_THREAD)
+int uv_barrier_init(uv_barrier_t* barrier, unsigned int count) {
+ struct _uv_barrier* b;
int rc;
- _uv_barrier* b;
if (barrier == NULL || count == 0)
- return EINVAL;
-
- if (barrier_attr != NULL)
- return ENOTSUP;
+ return UV_EINVAL;
b = uv__malloc(sizeof(*b));
if (b == NULL)
- return ENOMEM;
+ return UV_ENOMEM;
b->in = 0;
b->out = 0;
b->threshold = count;
- if ((rc = pthread_mutex_init(&b->mutex, NULL)) != 0)
+ rc = uv_mutex_init(&b->mutex);
+ if (rc != 0)
goto error2;
- if ((rc = pthread_cond_init(&b->cond, NULL)) != 0)
+
+ rc = uv_cond_init(&b->cond);
+ if (rc != 0)
goto error;
barrier->b = b;
return 0;
error:
- pthread_mutex_destroy(&b->mutex);
+ uv_mutex_destroy(&b->mutex);
error2:
uv__free(b);
return rc;
}
-int pthread_barrier_wait(pthread_barrier_t* barrier) {
- int rc;
- _uv_barrier* b;
+
+int uv_barrier_wait(uv_barrier_t* barrier) {
+ struct _uv_barrier* b;
+ int last;
if (barrier == NULL || barrier->b == NULL)
- return EINVAL;
+ return UV_EINVAL;
b = barrier->b;
- /* Lock the mutex*/
- if ((rc = pthread_mutex_lock(&b->mutex)) != 0)
- return rc;
+ uv_mutex_lock(&b->mutex);
- /* Increment the count. If this is the first thread to reach the threshold,
- wake up waiters, unlock the mutex, then return
- PTHREAD_BARRIER_SERIAL_THREAD. */
if (++b->in == b->threshold) {
b->in = 0;
- b->out = b->threshold - 1;
- rc = pthread_cond_signal(&b->cond);
- assert(rc == 0);
-
- pthread_mutex_unlock(&b->mutex);
- return PTHREAD_BARRIER_SERIAL_THREAD;
+ b->out = b->threshold;
+ uv_cond_signal(&b->cond);
+ } else {
+ do
+ uv_cond_wait(&b->cond, &b->mutex);
+ while (b->in != 0);
}
- /* Otherwise, wait for other threads until in is set to 0,
- then return 0 to indicate this is not the first thread. */
- do {
- if ((rc = pthread_cond_wait(&b->cond, &b->mutex)) != 0)
- break;
- } while (b->in != 0);
-
- /* mark thread exit */
- b->out--;
- pthread_cond_signal(&b->cond);
- pthread_mutex_unlock(&b->mutex);
- return rc;
+
+ last = (--b->out == 0);
+ if (!last)
+ uv_cond_signal(&b->cond); /* Not needed for last thread. */
+
+ uv_mutex_unlock(&b->mutex);
+ return last;
}
-int pthread_barrier_destroy(pthread_barrier_t* barrier) {
- int rc;
- _uv_barrier* b;
- if (barrier == NULL || barrier->b == NULL)
- return EINVAL;
+void uv_barrier_destroy(uv_barrier_t* barrier) {
+ struct _uv_barrier* b;
b = barrier->b;
+ uv_mutex_lock(&b->mutex);
- if ((rc = pthread_mutex_lock(&b->mutex)) != 0)
- return rc;
+ assert(b->in == 0);
+ assert(b->out == 0);
- if (b->in > 0 || b->out > 0)
- rc = EBUSY;
-
- pthread_mutex_unlock(&b->mutex);
+ if (b->in != 0 || b->out != 0)
+ abort();
- if (rc)
- return rc;
+ uv_mutex_unlock(&b->mutex);
+ uv_mutex_destroy(&b->mutex);
+ uv_cond_destroy(&b->cond);
- pthread_cond_destroy(&b->cond);
- pthread_mutex_destroy(&b->mutex);
uv__free(barrier->b);
barrier->b = NULL;
- return 0;
}
+
+#else
+
+int uv_barrier_init(uv_barrier_t* barrier, unsigned int count) {
+ return UV__ERR(pthread_barrier_init(barrier, NULL, count));
+}
+
+
+int uv_barrier_wait(uv_barrier_t* barrier) {
+ int rc;
+
+ rc = pthread_barrier_wait(barrier);
+ if (rc != 0)
+ if (rc != PTHREAD_BARRIER_SERIAL_THREAD)
+ abort();
+
+ return rc == PTHREAD_BARRIER_SERIAL_THREAD;
+}
+
+
+void uv_barrier_destroy(uv_barrier_t* barrier) {
+ if (pthread_barrier_destroy(barrier))
+ abort();
+}
+
#endif
@@ -771,25 +782,6 @@ int uv_cond_timedwait(uv_cond_t* cond, uv_mutex_t* mutex, uint64_t timeout) {
}
-int uv_barrier_init(uv_barrier_t* barrier, unsigned int count) {
- return UV__ERR(pthread_barrier_init(barrier, NULL, count));
-}
-
-
-void uv_barrier_destroy(uv_barrier_t* barrier) {
- if (pthread_barrier_destroy(barrier))
- abort();
-}
-
-
-int uv_barrier_wait(uv_barrier_t* barrier) {
- int r = pthread_barrier_wait(barrier);
- if (r && r != PTHREAD_BARRIER_SERIAL_THREAD)
- abort();
- return r == PTHREAD_BARRIER_SERIAL_THREAD;
-}
-
-
int uv_key_create(uv_key_t* key) {
return UV__ERR(pthread_key_create(key, NULL));
}
diff --git a/deps/uv/src/unix/tty.c b/deps/uv/src/unix/tty.c
index 1b92b5c914ce9e..74d3d75d7615d9 100644
--- a/deps/uv/src/unix/tty.c
+++ b/deps/uv/src/unix/tty.c
@@ -92,13 +92,15 @@ static int uv__tty_is_slave(const int fd) {
return result;
}
-int uv_tty_init(uv_loop_t* loop, uv_tty_t* tty, int fd, int readable) {
+int uv_tty_init(uv_loop_t* loop, uv_tty_t* tty, int fd, int unused) {
uv_handle_type type;
int flags;
int newfd;
int r;
int saved_flags;
+ int mode;
char path[256];
+ (void)unused; /* deprecated parameter is no longer needed */
/* File descriptors that refer to files cannot be monitored with epoll.
* That restriction also applies to character devices like /dev/random
@@ -111,6 +113,15 @@ int uv_tty_init(uv_loop_t* loop, uv_tty_t* tty, int fd, int readable) {
flags = 0;
newfd = -1;
+ /* Save the fd flags in case we need to restore them due to an error. */
+ do
+ saved_flags = fcntl(fd, F_GETFL);
+ while (saved_flags == -1 && errno == EINTR);
+
+ if (saved_flags == -1)
+ return UV__ERR(errno);
+ mode = saved_flags & O_ACCMODE;
+
/* Reopen the file descriptor when it refers to a tty. This lets us put the
* tty in non-blocking mode without affecting other processes that share it
* with us.
@@ -128,13 +139,13 @@ int uv_tty_init(uv_loop_t* loop, uv_tty_t* tty, int fd, int readable) {
* slave device.
*/
if (uv__tty_is_slave(fd) && ttyname_r(fd, path, sizeof(path)) == 0)
- r = uv__open_cloexec(path, O_RDWR);
+ r = uv__open_cloexec(path, mode);
else
r = -1;
if (r < 0) {
/* fallback to using blocking writes */
- if (!readable)
+ if (mode != O_RDONLY)
flags |= UV_HANDLE_BLOCKING_WRITES;
goto skip;
}
@@ -154,22 +165,6 @@ int uv_tty_init(uv_loop_t* loop, uv_tty_t* tty, int fd, int readable) {
fd = newfd;
}
-#if defined(__APPLE__)
- /* Save the fd flags in case we need to restore them due to an error. */
- do
- saved_flags = fcntl(fd, F_GETFL);
- while (saved_flags == -1 && errno == EINTR);
-
- if (saved_flags == -1) {
- if (newfd != -1)
- uv__close(newfd);
- return UV__ERR(errno);
- }
-#endif
-
- /* Pacify the compiler. */
- (void) &saved_flags;
-
skip:
uv__stream_init(loop, (uv_stream_t*) tty, UV_TTY);
@@ -194,9 +189,9 @@ int uv_tty_init(uv_loop_t* loop, uv_tty_t* tty, int fd, int readable) {
}
#endif
- if (readable)
+ if (mode != O_WRONLY)
flags |= UV_HANDLE_READABLE;
- else
+ if (mode != O_RDONLY)
flags |= UV_HANDLE_WRITABLE;
uv__stream_open((uv_stream_t*) tty, fd, flags);
diff --git a/deps/uv/src/uv-common.h b/deps/uv/src/uv-common.h
index 3289950d009ccd..5555f83aee4864 100644
--- a/deps/uv/src/uv-common.h
+++ b/deps/uv/src/uv-common.h
@@ -164,8 +164,15 @@ void uv__fs_poll_close(uv_fs_poll_t* handle);
int uv__getaddrinfo_translate_error(int sys_err); /* EAI_* error. */
+enum uv__work_kind {
+ UV__WORK_CPU,
+ UV__WORK_FAST_IO,
+ UV__WORK_SLOW_IO
+};
+
void uv__work_submit(uv_loop_t* loop,
struct uv__work *w,
+ enum uv__work_kind kind,
void (*work)(struct uv__work *w),
void (*done)(struct uv__work *w, int status));
diff --git a/deps/uv/src/win/core.c b/deps/uv/src/win/core.c
index afdf01e7878913..bf80d77e273920 100644
--- a/deps/uv/src/win/core.c
+++ b/deps/uv/src/win/core.c
@@ -381,6 +381,57 @@ int uv_backend_timeout(const uv_loop_t* loop) {
}
+static void uv__poll_wine(uv_loop_t* loop, DWORD timeout) {
+ DWORD bytes;
+ ULONG_PTR key;
+ OVERLAPPED* overlapped;
+ uv_req_t* req;
+ int repeat;
+ uint64_t timeout_time;
+
+ timeout_time = loop->time + timeout;
+
+ for (repeat = 0; ; repeat++) {
+ GetQueuedCompletionStatus(loop->iocp,
+ &bytes,
+ &key,
+ &overlapped,
+ timeout);
+
+ if (overlapped) {
+ /* Package was dequeued */
+ req = uv_overlapped_to_req(overlapped);
+ uv_insert_pending_req(loop, req);
+
+ /* Some time might have passed waiting for I/O,
+ * so update the loop time here.
+ */
+ uv_update_time(loop);
+ } else if (GetLastError() != WAIT_TIMEOUT) {
+ /* Serious error */
+ uv_fatal_error(GetLastError(), "GetQueuedCompletionStatus");
+ } else if (timeout > 0) {
+ /* GetQueuedCompletionStatus can occasionally return a little early.
+ * Make sure that the desired timeout target time is reached.
+ */
+ uv_update_time(loop);
+ if (timeout_time > loop->time) {
+ timeout = (DWORD)(timeout_time - loop->time);
+ /* The first call to GetQueuedCompletionStatus should return very
+ * close to the target time and the second should reach it, but
+ * this is not stated in the documentation. To make sure a busy
+ * loop cannot happen, the timeout is increased exponentially
+ * starting on the third round.
+ */
+ timeout += repeat ? (1 << (repeat - 1)) : 0;
+ continue;
+ }
+ }
+ break;
+ }
+}
+
+
static void uv__poll(uv_loop_t* loop, DWORD timeout) {
BOOL success;
uv_req_t* req;
@@ -473,7 +524,11 @@ int uv_run(uv_loop_t *loop, uv_run_mode mode) {
if ((mode == UV_RUN_ONCE && !ran_pending) || mode == UV_RUN_DEFAULT)
timeout = uv_backend_timeout(loop);
- uv__poll(loop, timeout);
+ if (pGetQueuedCompletionStatusEx)
+ uv__poll(loop, timeout);
+ else
+ uv__poll_wine(loop, timeout);
+
uv_check_invoke(loop);
uv_process_endgames(loop);
diff --git a/deps/uv/src/win/fs-event.c b/deps/uv/src/win/fs-event.c
index 226e6e7aee6c09..25809ea4f2f605 100644
--- a/deps/uv/src/win/fs-event.c
+++ b/deps/uv/src/win/fs-event.c
@@ -83,7 +83,7 @@ static void uv_relative_path(const WCHAR* filename,
static int uv_split_path(const WCHAR* filename, WCHAR** dir,
WCHAR** file) {
size_t len, i;
-
+
if (filename == NULL) {
if (dir != NULL)
*dir = NULL;
diff --git a/deps/uv/src/win/fs.c b/deps/uv/src/win/fs.c
index 71b6a81a0d5a8a..812c1a6de583d2 100644
--- a/deps/uv/src/win/fs.c
+++ b/deps/uv/src/win/fs.c
@@ -55,7 +55,11 @@
do { \
if (cb != NULL) { \
uv__req_register(loop, req); \
- uv__work_submit(loop, &req->work_req, uv__fs_work, uv__fs_done); \
+ uv__work_submit(loop, \
+ &req->work_req, \
+ UV__WORK_FAST_IO, \
+ uv__fs_work, \
+ uv__fs_done); \
return 0; \
} else { \
uv__fs_work(&req->work_req); \
@@ -1513,10 +1517,10 @@ static void fs__fchmod(uv_fs_t* req) {
SET_REQ_WIN32_ERROR(req, pRtlNtStatusToDosError(nt_status));
goto fchmod_cleanup;
}
-
+
/* Test if the Archive attribute is cleared */
if ((file_info.FileAttributes & FILE_ATTRIBUTE_ARCHIVE) == 0) {
- /* Set Archive flag, otherwise setting or clearing the read-only
+ /* Set Archive flag, otherwise setting or clearing the read-only
flag will not work */
file_info.FileAttributes |= FILE_ATTRIBUTE_ARCHIVE;
nt_status = pNtSetInformationFile(handle,
diff --git a/deps/uv/src/win/getaddrinfo.c b/deps/uv/src/win/getaddrinfo.c
index 063b4937cdad24..614ea8e376e8af 100644
--- a/deps/uv/src/win/getaddrinfo.c
+++ b/deps/uv/src/win/getaddrinfo.c
@@ -368,6 +368,7 @@ int uv_getaddrinfo(uv_loop_t* loop,
if (getaddrinfo_cb) {
uv__work_submit(loop,
&req->work_req,
+ UV__WORK_SLOW_IO,
uv__getaddrinfo_work,
uv__getaddrinfo_done);
return 0;
diff --git a/deps/uv/src/win/getnameinfo.c b/deps/uv/src/win/getnameinfo.c
index 71785a9fa65718..b3773380c21d70 100644
--- a/deps/uv/src/win/getnameinfo.c
+++ b/deps/uv/src/win/getnameinfo.c
@@ -145,6 +145,7 @@ int uv_getnameinfo(uv_loop_t* loop,
if (getnameinfo_cb) {
uv__work_submit(loop,
&req->work_req,
+ UV__WORK_SLOW_IO,
uv__getnameinfo_work,
uv__getnameinfo_done);
return 0;
diff --git a/deps/uv/src/win/pipe.c b/deps/uv/src/win/pipe.c
index 382290e69f4afa..9a3cbc8a1e26e1 100644
--- a/deps/uv/src/win/pipe.c
+++ b/deps/uv/src/win/pipe.c
@@ -2347,7 +2347,7 @@ int uv_pipe_chmod(uv_pipe_t* handle, int mode) {
error = GetLastError();
goto clean_sid;
}
-
+
memset(&ea, 0, sizeof(EXPLICIT_ACCESS));
if (mode & UV_READABLE)
ea.grfAccessPermissions |= GENERIC_READ | FILE_WRITE_ATTRIBUTES;
diff --git a/deps/uv/src/win/req.c b/deps/uv/src/win/req.c
deleted file mode 100644
index 111cc5e28936fc..00000000000000
--- a/deps/uv/src/win/req.c
+++ /dev/null
@@ -1,25 +0,0 @@
-/* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- * IN THE SOFTWARE.
- */
-
-#include
-
-#include "uv.h"
-#include "internal.h"
diff --git a/deps/uv/src/win/thread.c b/deps/uv/src/win/thread.c
index 6e41dcd8a087da..56ca41aab0b759 100644
--- a/deps/uv/src/win/thread.c
+++ b/deps/uv/src/win/thread.c
@@ -118,7 +118,7 @@ int uv_thread_create(uv_thread_t *tid, void (*entry)(void *arg), void *arg) {
ctx->arg = arg;
/* Create the thread in suspended state so we have a chance to pass
- * its own creation handle to it */
+ * its own creation handle to it */
thread = (HANDLE) _beginthreadex(NULL,
0,
uv__thread_start,
diff --git a/deps/uv/src/win/tty.c b/deps/uv/src/win/tty.c
index d62aafb7d8c921..32ccf74ca8cb6a 100644
--- a/deps/uv/src/win/tty.c
+++ b/deps/uv/src/win/tty.c
@@ -172,9 +172,12 @@ void uv_console_init(void) {
}
-int uv_tty_init(uv_loop_t* loop, uv_tty_t* tty, uv_file fd, int readable) {
+int uv_tty_init(uv_loop_t* loop, uv_tty_t* tty, uv_file fd, int unused) {
+ BOOL readable;
+ DWORD NumberOfEvents;
HANDLE handle;
CONSOLE_SCREEN_BUFFER_INFO screen_buffer_info;
+ (void)unused;
uv__once_init();
handle = (HANDLE) uv__get_osfhandle(fd);
@@ -199,6 +202,7 @@ int uv_tty_init(uv_loop_t* loop, uv_tty_t* tty, uv_file fd, int readable) {
fd = -1;
}
+ readable = GetNumberOfConsoleInputEvents(handle, &NumberOfEvents);
if (!readable) {
/* Obtain the screen buffer info with the output handle. */
if (!GetConsoleScreenBufferInfo(handle, &screen_buffer_info)) {
@@ -382,12 +386,6 @@ int uv_tty_set_mode(uv_tty_t* tty, uv_tty_mode_t mode) {
}
-int uv_is_tty(uv_file file) {
- DWORD result;
- return GetConsoleMode((HANDLE) _get_osfhandle(file), &result) != 0;
-}
-
-
int uv_tty_get_winsize(uv_tty_t* tty, int* width, int* height) {
CONSOLE_SCREEN_BUFFER_INFO info;
@@ -1035,6 +1033,7 @@ int uv_tty_read_stop(uv_tty_t* handle) {
/* Cancel raw read. Write some bullshit event to force the console wait to
* return. */
memset(&record, 0, sizeof record);
+ record.EventType = FOCUS_EVENT;
if (!WriteConsoleInputW(handle->handle, &record, 1, &written)) {
return GetLastError();
}
@@ -2181,14 +2180,14 @@ void uv_process_tty_write_req(uv_loop_t* loop, uv_tty_t* handle,
void uv_tty_close(uv_tty_t* handle) {
assert(handle->u.fd == -1 || handle->u.fd > 2);
+ if (handle->flags & UV_HANDLE_READING)
+ uv_tty_read_stop(handle);
+
if (handle->u.fd == -1)
CloseHandle(handle->handle);
else
close(handle->u.fd);
- if (handle->flags & UV_HANDLE_READING)
- uv_tty_read_stop(handle);
-
handle->u.fd = -1;
handle->handle = INVALID_HANDLE_VALUE;
handle->flags &= ~(UV_HANDLE_READABLE | UV_HANDLE_WRITABLE);
diff --git a/deps/uv/src/win/udp.c b/deps/uv/src/win/udp.c
index 402aeea6666b5a..37df849f8faf20 100644
--- a/deps/uv/src/win/udp.c
+++ b/deps/uv/src/win/udp.c
@@ -366,7 +366,7 @@ int uv__udp_recv_start(uv_udp_t* handle, uv_alloc_cb alloc_cb,
int err;
if (handle->flags & UV_HANDLE_READING) {
- return WSAEALREADY;
+ return UV_EALREADY;
}
err = uv_udp_maybe_bind(handle,
@@ -374,7 +374,7 @@ int uv__udp_recv_start(uv_udp_t* handle, uv_alloc_cb alloc_cb,
sizeof(uv_addr_ip4_any_),
0);
if (err)
- return err;
+ return uv_translate_sys_error(err);
handle->flags |= UV_HANDLE_READING;
INCREASE_ACTIVE_COUNT(loop, handle);
diff --git a/deps/uv/src/win/winapi.c b/deps/uv/src/win/winapi.c
index 0fd598eacb4503..2c09b448a95c01 100644
--- a/deps/uv/src/win/winapi.c
+++ b/deps/uv/src/win/winapi.c
@@ -34,6 +34,9 @@ sNtQueryVolumeInformationFile pNtQueryVolumeInformationFile;
sNtQueryDirectoryFile pNtQueryDirectoryFile;
sNtQuerySystemInformation pNtQuerySystemInformation;
+/* Kernel32 function pointers */
+sGetQueuedCompletionStatusEx pGetQueuedCompletionStatusEx;
+
/* Powrprof.dll function pointer */
sPowerRegisterSuspendResumeNotification pPowerRegisterSuspendResumeNotification;
@@ -45,6 +48,7 @@ void uv_winapi_init(void) {
HMODULE ntdll_module;
HMODULE powrprof_module;
HMODULE user32_module;
+ HMODULE kernel32_module;
ntdll_module = GetModuleHandleA("ntdll.dll");
if (ntdll_module == NULL) {
@@ -98,6 +102,15 @@ void uv_winapi_init(void) {
uv_fatal_error(GetLastError(), "GetProcAddress");
}
+ kernel32_module = GetModuleHandleA("kernel32.dll");
+ if (kernel32_module == NULL) {
+ uv_fatal_error(GetLastError(), "GetModuleHandleA");
+ }
+
+ pGetQueuedCompletionStatusEx = (sGetQueuedCompletionStatusEx) GetProcAddress(
+ kernel32_module,
+ "GetQueuedCompletionStatusEx");
+
powrprof_module = LoadLibraryA("powrprof.dll");
if (powrprof_module != NULL) {
pPowerRegisterSuspendResumeNotification = (sPowerRegisterSuspendResumeNotification)
diff --git a/deps/uv/src/win/winapi.h b/deps/uv/src/win/winapi.h
index d0fcfd8e7ae021..cfbac52eb1d6f4 100644
--- a/deps/uv/src/win/winapi.h
+++ b/deps/uv/src/win/winapi.h
@@ -4642,6 +4642,14 @@ typedef NTSTATUS (NTAPI *sNtQueryDirectoryFile)
# define ERROR_MUI_FILE_NOT_LOADED 15105
#endif
+typedef BOOL (WINAPI *sGetQueuedCompletionStatusEx)
+ (HANDLE CompletionPort,
+ LPOVERLAPPED_ENTRY lpCompletionPortEntries,
+ ULONG ulCount,
+ PULONG ulNumEntriesRemoved,
+ DWORD dwMilliseconds,
+ BOOL fAlertable);
+
/* from powerbase.h */
#ifndef DEVICE_NOTIFY_CALLBACK
# define DEVICE_NOTIFY_CALLBACK 2
@@ -4704,6 +4712,9 @@ extern sNtQueryVolumeInformationFile pNtQueryVolumeInformationFile;
extern sNtQueryDirectoryFile pNtQueryDirectoryFile;
extern sNtQuerySystemInformation pNtQuerySystemInformation;
+/* Kernel32 function pointers */
+extern sGetQueuedCompletionStatusEx pGetQueuedCompletionStatusEx;
+
/* Powrprof.dll function pointer */
extern sPowerRegisterSuspendResumeNotification pPowerRegisterSuspendResumeNotification;
diff --git a/deps/uv/test/runner-win.c b/deps/uv/test/runner-win.c
index ce972705470019..aa52d7cc5aa9a6 100644
--- a/deps/uv/test/runner-win.c
+++ b/deps/uv/test/runner-win.c
@@ -228,7 +228,7 @@ int process_copy_output(process_info_t* p, FILE* stream) {
while (fgets(buf, sizeof(buf), f) != NULL)
print_lines(buf, strlen(buf), stream);
-
+
if (ferror(f))
return -1;
diff --git a/deps/uv/test/test-barrier.c b/deps/uv/test/test-barrier.c
index dfd2dbdef1b1d0..89858db5711482 100644
--- a/deps/uv/test/test-barrier.c
+++ b/deps/uv/test/test-barrier.c
@@ -104,3 +104,45 @@ TEST_IMPL(barrier_3) {
return 0;
}
+
+static void serial_worker(void* data) {
+ uv_barrier_t* barrier;
+
+ barrier = data;
+ if (uv_barrier_wait(barrier) > 0)
+ uv_barrier_destroy(barrier);
+
+ uv_sleep(100); /* Wait a bit before terminating. */
+}
+
+/* Ensure that uv_barrier_wait returns positive only after all threads have
+ * exited the barrier. If this value is returned too early and the barrier is
+ * destroyed prematurely, then this test may see a crash. */
+TEST_IMPL(barrier_serial_thread) {
+ uv_thread_t threads[4];
+ uv_barrier_t barrier;
+ unsigned i;
+
+ ASSERT(0 == uv_barrier_init(&barrier, ARRAY_SIZE(threads) + 1));
+
+ for (i = 0; i < ARRAY_SIZE(threads); ++i)
+ ASSERT(0 == uv_thread_create(&threads[i], serial_worker, &barrier));
+
+ if (uv_barrier_wait(&barrier) > 0)
+ uv_barrier_destroy(&barrier);
+
+ for (i = 0; i < ARRAY_SIZE(threads); ++i)
+ ASSERT(0 == uv_thread_join(&threads[i]));
+
+ return 0;
+}
+
+/* Single thread uv_barrier_wait should return correct return value. */
+TEST_IMPL(barrier_serial_thread_single) {
+ uv_barrier_t barrier;
+
+ ASSERT(0 == uv_barrier_init(&barrier, 1));
+ ASSERT(0 < uv_barrier_wait(&barrier));
+ uv_barrier_destroy(&barrier);
+ return 0;
+}
diff --git a/deps/uv/test/test-condvar.c b/deps/uv/test/test-condvar.c
index ec60f16403ad0b..50f3c047c00cd2 100644
--- a/deps/uv/test/test-condvar.c
+++ b/deps/uv/test/test-condvar.c
@@ -259,7 +259,7 @@ TEST_IMPL(condvar_5) {
* https://msdn.microsoft.com/en-us/library/ms687069(VS.85).aspx */
elapsed = after - before;
ASSERT(0.75 * timeout <= elapsed); /* 1.0 too large for Windows. */
- ASSERT(elapsed <= 1.5 * timeout); /* 1.1 too small for OSX. */
+ ASSERT(elapsed <= 5.0 * timeout); /* MacOS has reported failures up to 1.75. */
worker_config_destroy(&wc);
diff --git a/deps/uv/test/test-fork.c b/deps/uv/test/test-fork.c
index 2a1ddc497a133f..f47ae3e656299e 100644
--- a/deps/uv/test/test-fork.c
+++ b/deps/uv/test/test-fork.c
@@ -283,6 +283,7 @@ TEST_IMPL(fork_signal_to_child_closed) {
int sync_pipe[2];
int sync_pipe2[2];
char sync_buf[1];
+ int r;
fork_signal_cb_called = 0; /* reset */
@@ -326,9 +327,10 @@ TEST_IMPL(fork_signal_to_child_closed) {
/* Don't run the loop. Wait for the parent to call us */
printf("Waiting on parent in child\n");
/* Wait for parent. read may fail if the parent tripped an ASSERT
- and exited, so this isn't in an ASSERT.
+ and exited, so this ASSERT is generous.
*/
- read(sync_pipe2[0], sync_buf, 1);
+ r = read(sync_pipe2[0], sync_buf, 1);
+ ASSERT(-1 <= r && r <= 1);
ASSERT(0 == fork_signal_cb_called);
printf("Exiting child \n");
/* Note that we're deliberately not running the loop
diff --git a/deps/uv/test/test-fs.c b/deps/uv/test/test-fs.c
index 9c1e8bec205f5d..01f5a7b0236514 100644
--- a/deps/uv/test/test-fs.c
+++ b/deps/uv/test/test-fs.c
@@ -26,6 +26,7 @@
#include /* memset */
#include
#include
+#include /* INT_MAX, PATH_MAX, IOV_MAX */
/* FIXME we shouldn't need to branch in this file */
#if defined(__unix__) || defined(__POSIX__) || \
@@ -120,6 +121,31 @@ static char test_buf[] = "test-buffer\n";
static char test_buf2[] = "second-buffer\n";
static uv_buf_t iov;
+#ifdef _WIN32
+int uv_test_getiovmax(void) {
+ return INT32_MAX; /* Emulated by libuv, so no real limit. */
+}
+#else
+int uv_test_getiovmax(void) {
+#if defined(IOV_MAX)
+ return IOV_MAX;
+#elif defined(_SC_IOV_MAX)
+ static int iovmax = -1;
+ if (iovmax == -1) {
+ iovmax = sysconf(_SC_IOV_MAX);
+ /* On some embedded devices (arm-linux-uclibc based ip camera),
+ * sysconf(_SC_IOV_MAX) can not get the correct value. The return
+ * value is -1 and the errno is EINPROGRESS. Degrade the value to 1.
+ */
+ if (iovmax == -1) iovmax = 1;
+ }
+ return iovmax;
+#else
+ return 1024;
+#endif
+}
+#endif
+
#ifdef _WIN32
/*
* This tag and guid have no special meaning, and don't conflict with
@@ -2752,19 +2778,44 @@ TEST_IMPL(fs_write_multiple_bufs) {
memset(buf, 0, sizeof(buf));
memset(buf2, 0, sizeof(buf2));
+ /* Read the strings back to separate buffers. */
+ iovs[0] = uv_buf_init(buf, sizeof(test_buf));
+ iovs[1] = uv_buf_init(buf2, sizeof(test_buf2));
+ ASSERT(lseek(open_req1.result, 0, SEEK_CUR) == 0);
+ r = uv_fs_read(NULL, &read_req, open_req1.result, iovs, 2, -1, NULL);
+ ASSERT(r >= 0);
+ ASSERT(read_req.result == sizeof(test_buf) + sizeof(test_buf2));
+ ASSERT(strcmp(buf, test_buf) == 0);
+ ASSERT(strcmp(buf2, test_buf2) == 0);
+ uv_fs_req_cleanup(&read_req);
+
+ iov = uv_buf_init(buf, sizeof(buf));
+ r = uv_fs_read(NULL, &read_req, open_req1.result, &iov, 1, -1, NULL);
+ ASSERT(r == 0);
+ ASSERT(read_req.result == 0);
+ uv_fs_req_cleanup(&read_req);
+
/* Read the strings back to separate buffers. */
iovs[0] = uv_buf_init(buf, sizeof(test_buf));
iovs[1] = uv_buf_init(buf2, sizeof(test_buf2));
r = uv_fs_read(NULL, &read_req, open_req1.result, iovs, 2, 0, NULL);
ASSERT(r >= 0);
- ASSERT(read_req.result >= 0);
+ if (read_req.result == sizeof(test_buf)) {
+ /* Infer that preadv is not available. */
+ uv_fs_req_cleanup(&read_req);
+ r = uv_fs_read(NULL, &read_req, open_req1.result, &iovs[1], 1, read_req.result, NULL);
+ ASSERT(r >= 0);
+ ASSERT(read_req.result == sizeof(test_buf2));
+ } else {
+ ASSERT(read_req.result == sizeof(test_buf) + sizeof(test_buf2));
+ }
ASSERT(strcmp(buf, test_buf) == 0);
ASSERT(strcmp(buf2, test_buf2) == 0);
uv_fs_req_cleanup(&read_req);
iov = uv_buf_init(buf, sizeof(buf));
r = uv_fs_read(NULL, &read_req, open_req1.result, &iov, 1,
- read_req.result, NULL);
+ sizeof(test_buf) + sizeof(test_buf2), NULL);
ASSERT(r == 0);
ASSERT(read_req.result == 0);
uv_fs_req_cleanup(&read_req);
@@ -2783,12 +2834,15 @@ TEST_IMPL(fs_write_multiple_bufs) {
TEST_IMPL(fs_write_alotof_bufs) {
- const size_t iovcount = 54321;
+ size_t iovcount;
+ size_t iovmax;
uv_buf_t* iovs;
char* buffer;
size_t index;
int r;
+ iovcount = 54321;
+
/* Setup. */
unlink("test_file");
@@ -2796,6 +2850,7 @@ TEST_IMPL(fs_write_alotof_bufs) {
iovs = malloc(sizeof(*iovs) * iovcount);
ASSERT(iovs != NULL);
+ iovmax = uv_test_getiovmax();
r = uv_fs_open(NULL,
&open_req1,
@@ -2829,7 +2884,10 @@ TEST_IMPL(fs_write_alotof_bufs) {
iovs[index] = uv_buf_init(buffer + index * sizeof(test_buf),
sizeof(test_buf));
- r = uv_fs_read(NULL, &read_req, open_req1.result, iovs, iovcount, 0, NULL);
+ ASSERT(lseek(open_req1.result, 0, SEEK_SET) == 0);
+ r = uv_fs_read(NULL, &read_req, open_req1.result, iovs, iovcount, -1, NULL);
+ if (iovcount > iovmax)
+ iovcount = iovmax;
ASSERT(r >= 0);
ASSERT((size_t)read_req.result == sizeof(test_buf) * iovcount);
@@ -2841,13 +2899,14 @@ TEST_IMPL(fs_write_alotof_bufs) {
uv_fs_req_cleanup(&read_req);
free(buffer);
+ ASSERT(lseek(open_req1.result, write_req.result, SEEK_SET) == write_req.result);
iov = uv_buf_init(buf, sizeof(buf));
r = uv_fs_read(NULL,
&read_req,
open_req1.result,
&iov,
1,
- read_req.result,
+ -1,
NULL);
ASSERT(r == 0);
ASSERT(read_req.result == 0);
@@ -2868,14 +2927,19 @@ TEST_IMPL(fs_write_alotof_bufs) {
TEST_IMPL(fs_write_alotof_bufs_with_offset) {
- const size_t iovcount = 54321;
+ size_t iovcount;
+ size_t iovmax;
uv_buf_t* iovs;
char* buffer;
size_t index;
int r;
int64_t offset;
- char* filler = "0123456789";
- int filler_len = strlen(filler);
+ char* filler;
+ int filler_len;
+
+ filler = "0123456789";
+ filler_len = strlen(filler);
+ iovcount = 54321;
/* Setup. */
unlink("test_file");
@@ -2884,6 +2948,7 @@ TEST_IMPL(fs_write_alotof_bufs_with_offset) {
iovs = malloc(sizeof(*iovs) * iovcount);
ASSERT(iovs != NULL);
+ iovmax = uv_test_getiovmax();
r = uv_fs_open(NULL,
&open_req1,
@@ -2927,6 +2992,10 @@ TEST_IMPL(fs_write_alotof_bufs_with_offset) {
r = uv_fs_read(NULL, &read_req, open_req1.result,
iovs, iovcount, offset, NULL);
ASSERT(r >= 0);
+ if (r == sizeof(test_buf))
+ iovcount = 1; /* Infer that preadv is not available. */
+ else if (iovcount > iovmax)
+ iovcount = iovmax;
ASSERT((size_t)read_req.result == sizeof(test_buf) * iovcount);
for (index = 0; index < iovcount; ++index)
@@ -2940,7 +3009,7 @@ TEST_IMPL(fs_write_alotof_bufs_with_offset) {
r = uv_fs_stat(NULL, &stat_req, "test_file", NULL);
ASSERT(r == 0);
ASSERT((int64_t)((uv_stat_t*)stat_req.ptr)->st_size ==
- offset + (int64_t)(iovcount * sizeof(test_buf)));
+ offset + (int64_t)write_req.result);
uv_fs_req_cleanup(&stat_req);
iov = uv_buf_init(buf, sizeof(buf));
@@ -2949,7 +3018,7 @@ TEST_IMPL(fs_write_alotof_bufs_with_offset) {
open_req1.result,
&iov,
1,
- read_req.result + offset,
+ offset + write_req.result,
NULL);
ASSERT(r == 0);
ASSERT(read_req.result == 0);
@@ -2969,6 +3038,175 @@ TEST_IMPL(fs_write_alotof_bufs_with_offset) {
}
+#ifdef _WIN32
+
+TEST_IMPL(fs_partial_read) {
+ RETURN_SKIP("Test not implemented on Windows.");
+}
+
+TEST_IMPL(fs_partial_write) {
+ RETURN_SKIP("Test not implemented on Windows.");
+}
+
+#else /* !_WIN32 */
+
+struct thread_ctx {
+ pthread_t pid;
+ int fd;
+ char* data;
+ int size;
+ int interval;
+ int doread;
+};
+
+static void thread_main(void* arg) {
+ const struct thread_ctx* ctx;
+ int size;
+ char* data;
+
+ ctx = (struct thread_ctx*)arg;
+ size = ctx->size;
+ data = ctx->data;
+
+ while (size > 0) {
+ ssize_t result;
+ int nbytes;
+ nbytes = size < ctx->interval ? size : ctx->interval;
+ if (ctx->doread) {
+ result = write(ctx->fd, data, nbytes);
+ /* Should not see EINTR (or other errors) */
+ ASSERT(result == nbytes);
+ } else {
+ result = read(ctx->fd, data, nbytes);
+ /* Should not see EINTR (or other errors),
+ * but might get a partial read if we are faster than the writer
+ */
+ ASSERT(result > 0 && result <= nbytes);
+ }
+
+ pthread_kill(ctx->pid, SIGUSR1);
+ size -= result;
+ data += result;
+ }
+}
+
+static void sig_func(uv_signal_t* handle, int signum) {
+ uv_signal_stop(handle);
+}
+
+static size_t uv_test_fs_buf_offset(uv_buf_t* bufs, size_t size) {
+ size_t offset;
+ /* Figure out which bufs are done */
+ for (offset = 0; size > 0 && bufs[offset].len <= size; ++offset)
+ size -= bufs[offset].len;
+
+ /* Fix a partial read/write */
+ if (size > 0) {
+ bufs[offset].base += size;
+ bufs[offset].len -= size;
+ }
+ return offset;
+}
+
+static void test_fs_partial(int doread) {
+ struct thread_ctx ctx;
+ uv_thread_t thread;
+ uv_signal_t signal;
+ int pipe_fds[2];
+ size_t iovcount;
+ uv_buf_t* iovs;
+ char* buffer;
+ size_t index;
+
+ iovcount = 54321;
+
+ iovs = malloc(sizeof(*iovs) * iovcount);
+ ASSERT(iovs != NULL);
+
+ ctx.pid = pthread_self();
+ ctx.doread = doread;
+ ctx.interval = 1000;
+ ctx.size = sizeof(test_buf) * iovcount;
+ ctx.data = malloc(ctx.size);
+ ASSERT(ctx.data != NULL);
+ buffer = malloc(ctx.size);
+ ASSERT(buffer != NULL);
+
+ for (index = 0; index < iovcount; ++index)
+ iovs[index] = uv_buf_init(buffer + index * sizeof(test_buf), sizeof(test_buf));
+
+ loop = uv_default_loop();
+
+ ASSERT(0 == uv_signal_init(loop, &signal));
+ ASSERT(0 == uv_signal_start(&signal, sig_func, SIGUSR1));
+
+ ASSERT(0 == pipe(pipe_fds));
+
+ ctx.fd = pipe_fds[doread];
+ ASSERT(0 == uv_thread_create(&thread, thread_main, &ctx));
+
+ if (doread) {
+ uv_buf_t* read_iovs;
+ int nread;
+ read_iovs = iovs;
+ nread = 0;
+ while (nread < ctx.size) {
+ int result;
+ result = uv_fs_read(loop, &read_req, pipe_fds[0], read_iovs, iovcount, -1, NULL);
+ if (result > 0) {
+ size_t read_iovcount;
+ read_iovcount = uv_test_fs_buf_offset(read_iovs, result);
+ read_iovs += read_iovcount;
+ iovcount -= read_iovcount;
+ nread += result;
+ } else {
+ ASSERT(result == UV_EINTR);
+ }
+ uv_fs_req_cleanup(&read_req);
+ }
+ } else {
+ int result;
+ result = uv_fs_write(loop, &write_req, pipe_fds[1], iovs, iovcount, -1, NULL);
+ ASSERT(write_req.result == result);
+ ASSERT(result == ctx.size);
+ uv_fs_req_cleanup(&write_req);
+ }
+
+ ASSERT(0 == memcmp(buffer, ctx.data, ctx.size));
+
+ ASSERT(0 == uv_thread_join(&thread));
+ ASSERT(0 == uv_run(loop, UV_RUN_DEFAULT));
+
+ ASSERT(0 == close(pipe_fds[1]));
+ uv_close((uv_handle_t*) &signal, NULL);
+
+ { /* Make sure we read everything that we wrote. */
+ int result;
+ result = uv_fs_read(loop, &read_req, pipe_fds[0], iovs, 1, -1, NULL);
+ ASSERT(result == 0);
+ uv_fs_req_cleanup(&read_req);
+ }
+ ASSERT(0 == close(pipe_fds[0]));
+
+ free(iovs);
+ free(buffer);
+ free(ctx.data);
+
+ MAKE_VALGRIND_HAPPY();
+}
+
+TEST_IMPL(fs_partial_read) {
+ test_fs_partial(1);
+ return 0;
+}
+
+TEST_IMPL(fs_partial_write) {
+ test_fs_partial(0);
+ return 0;
+}
+
+#endif/* _WIN32 */
+
TEST_IMPL(fs_read_write_null_arguments) {
int r;
@@ -3313,7 +3551,7 @@ TEST_IMPL(fs_exclusive_sharing_mode) {
int call_icacls(const char* command, ...) {
char icacls_command[1024];
va_list args;
-
+
va_start(args, command);
vsnprintf(icacls_command, ARRAYSIZE(icacls_command), command, args);
va_end(args);
@@ -3335,7 +3573,7 @@ TEST_IMPL(fs_open_readonly_acl) {
attrib -r test_file_icacls
del test_file_icacls
*/
-
+
/* Setup - clear the ACL and remove the file */
loop = uv_default_loop();
r = uv_os_get_passwd(&pwd);
@@ -3345,7 +3583,7 @@ TEST_IMPL(fs_open_readonly_acl) {
uv_fs_chmod(loop, &req, "test_file_icacls", S_IWUSR, NULL);
unlink("test_file_icacls");
- /* Create the file */
+ /* Create the file */
r = uv_fs_open(loop,
&open_req1,
"test_file_icacls",
@@ -3370,7 +3608,7 @@ TEST_IMPL(fs_open_readonly_acl) {
if (r != 0) {
goto acl_cleanup;
}
-
+
/* Try opening the file */
r = uv_fs_open(NULL, &open_req1, "test_file_icacls", O_RDONLY, 0, NULL);
if (r < 0) {
diff --git a/deps/uv/test/test-handle-fileno.c b/deps/uv/test/test-handle-fileno.c
index 3fe933adebdd87..8a093e2ea46e2c 100644
--- a/deps/uv/test/test-handle-fileno.c
+++ b/deps/uv/test/test-handle-fileno.c
@@ -27,7 +27,7 @@ static int get_tty_fd(void) {
/* Make sure we have an FD that refers to a tty */
#ifdef _WIN32
HANDLE handle;
- handle = CreateFileA("conout$",
+ handle = CreateFileA("conin$",
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL,
@@ -107,11 +107,15 @@ TEST_IMPL(handle_fileno) {
} else {
r = uv_tty_init(loop, &tty, tty_fd, 0);
ASSERT(r == 0);
+ ASSERT(uv_is_readable((uv_stream_t*) &tty));
+ ASSERT(!uv_is_writable((uv_stream_t*) &tty));
r = uv_fileno((uv_handle_t*) &tty, &fd);
ASSERT(r == 0);
uv_close((uv_handle_t*) &tty, NULL);
r = uv_fileno((uv_handle_t*) &tty, &fd);
ASSERT(r == UV_EBADF);
+ ASSERT(!uv_is_readable((uv_stream_t*) &tty));
+ ASSERT(!uv_is_writable((uv_stream_t*) &tty));
}
uv_run(loop, UV_RUN_DEFAULT);
diff --git a/deps/uv/test/test-list.h b/deps/uv/test/test-list.h
index b501722d4dc83b..1bd062da3d2e4b 100644
--- a/deps/uv/test/test-list.h
+++ b/deps/uv/test/test-list.h
@@ -37,6 +37,8 @@ TEST_DECLARE (default_loop_close)
TEST_DECLARE (barrier_1)
TEST_DECLARE (barrier_2)
TEST_DECLARE (barrier_3)
+TEST_DECLARE (barrier_serial_thread)
+TEST_DECLARE (barrier_serial_thread_single)
TEST_DECLARE (condvar_1)
TEST_DECLARE (condvar_2)
TEST_DECLARE (condvar_3)
@@ -50,6 +52,7 @@ TEST_DECLARE (tty)
TEST_DECLARE (tty_raw)
TEST_DECLARE (tty_empty_write)
TEST_DECLARE (tty_large_write)
+TEST_DECLARE (tty_raw_cancel)
#endif
TEST_DECLARE (tty_file)
TEST_DECLARE (tty_pty)
@@ -339,6 +342,8 @@ TEST_DECLARE (get_osfhandle_valid_handle)
TEST_DECLARE (open_osfhandle_valid_handle)
TEST_DECLARE (fs_write_alotof_bufs)
TEST_DECLARE (fs_write_alotof_bufs_with_offset)
+TEST_DECLARE (fs_partial_read)
+TEST_DECLARE (fs_partial_write)
TEST_DECLARE (fs_file_pos_after_op_with_offset)
TEST_DECLARE (fs_null_req)
#ifdef _WIN32
@@ -456,6 +461,8 @@ TASK_LIST_START
TEST_ENTRY (barrier_1)
TEST_ENTRY (barrier_2)
TEST_ENTRY (barrier_3)
+ TEST_ENTRY (barrier_serial_thread)
+ TEST_ENTRY (barrier_serial_thread_single)
TEST_ENTRY (condvar_1)
TEST_ENTRY (condvar_2)
TEST_ENTRY (condvar_3)
@@ -480,6 +487,7 @@ TASK_LIST_START
TEST_ENTRY (tty_raw)
TEST_ENTRY (tty_empty_write)
TEST_ENTRY (tty_large_write)
+ TEST_ENTRY (tty_raw_cancel)
#endif
TEST_ENTRY (tty_file)
TEST_ENTRY (tty_pty)
@@ -884,6 +892,8 @@ TASK_LIST_START
TEST_ENTRY (fs_write_multiple_bufs)
TEST_ENTRY (fs_write_alotof_bufs)
TEST_ENTRY (fs_write_alotof_bufs_with_offset)
+ TEST_ENTRY (fs_partial_read)
+ TEST_ENTRY (fs_partial_write)
TEST_ENTRY (fs_read_write_null_arguments)
TEST_ENTRY (fs_file_pos_after_op_with_offset)
TEST_ENTRY (fs_null_req)
diff --git a/deps/uv/test/test-pipe-close-stdout-read-stdin.c b/deps/uv/test/test-pipe-close-stdout-read-stdin.c
index 4ab14789a3858b..c8804b0e189249 100644
--- a/deps/uv/test/test-pipe-close-stdout-read-stdin.c
+++ b/deps/uv/test/test-pipe-close-stdout-read-stdin.c
@@ -66,7 +66,8 @@ TEST_IMPL(pipe_close_stdout_read_stdin) {
*/
close(fd[1]);
/* block until write end of pipe is closed */
- read(fd[0], &buf, 1);
+ r = read(fd[0], &buf, 1);
+ ASSERT(-1 <= r && r <= 1);
close(0);
r = dup(fd[0]);
ASSERT(r != -1);
diff --git a/deps/uv/test/test-process-priority.c b/deps/uv/test/test-process-priority.c
index ebee6b90afd555..b3d0a85bdd70ec 100644
--- a/deps/uv/test/test-process-priority.c
+++ b/deps/uv/test/test-process-priority.c
@@ -54,8 +54,10 @@ TEST_IMPL(process_priority) {
#ifndef _WIN32
ASSERT(priority == i);
#else
+ /* On Windows, only elevated users can set UV_PRIORITY_HIGHEST. Other
+ users will silently be set to UV_PRIORITY_HIGH. */
if (i < UV_PRIORITY_HIGH)
- ASSERT(priority == UV_PRIORITY_HIGHEST);
+ ASSERT(priority == UV_PRIORITY_HIGHEST || priority == UV_PRIORITY_HIGH);
else if (i < UV_PRIORITY_ABOVE_NORMAL)
ASSERT(priority == UV_PRIORITY_HIGH);
else if (i < UV_PRIORITY_NORMAL)
diff --git a/deps/uv/test/test-spawn.c b/deps/uv/test/test-spawn.c
index 1ab6e78807ff5f..4fcd905eed7500 100644
--- a/deps/uv/test/test-spawn.c
+++ b/deps/uv/test/test-spawn.c
@@ -1733,6 +1733,7 @@ TEST_IMPL(spawn_inherit_streams) {
uv_buf_t buf;
unsigned int i;
int r;
+ int bidir;
uv_write_t write_req;
uv_loop_t* loop;
@@ -1751,6 +1752,15 @@ TEST_IMPL(spawn_inherit_streams) {
ASSERT(uv_pipe_open(&pipe_stdout_child, fds_stdout[1]) == 0);
ASSERT(uv_pipe_open(&pipe_stdin_parent, fds_stdin[1]) == 0);
ASSERT(uv_pipe_open(&pipe_stdout_parent, fds_stdout[0]) == 0);
+ ASSERT(uv_is_readable((uv_stream_t*) &pipe_stdin_child));
+ ASSERT(uv_is_writable((uv_stream_t*) &pipe_stdout_child));
+ ASSERT(uv_is_writable((uv_stream_t*) &pipe_stdin_parent));
+ ASSERT(uv_is_readable((uv_stream_t*) &pipe_stdout_parent));
+ /* Some systems (SVR4) open a bidirectional pipe, most don't. */
+ bidir = uv_is_writable((uv_stream_t*) &pipe_stdin_child);
+ ASSERT(uv_is_readable((uv_stream_t*) &pipe_stdout_child) == bidir);
+ ASSERT(uv_is_readable((uv_stream_t*) &pipe_stdin_parent) == bidir);
+ ASSERT(uv_is_writable((uv_stream_t*) &pipe_stdout_parent) == bidir);
child_stdio[0].flags = UV_INHERIT_STREAM;
child_stdio[0].data.stream = (uv_stream_t *)&pipe_stdin_child;
diff --git a/deps/uv/test/test-tty.c b/deps/uv/test/test-tty.c
index 6aaeda8f59619b..979a6ec38d7fcd 100644
--- a/deps/uv/test/test-tty.c
+++ b/deps/uv/test/test-tty.c
@@ -96,9 +96,13 @@ TEST_IMPL(tty) {
r = uv_tty_init(uv_default_loop(), &tty_in, ttyin_fd, 1); /* Readable. */
ASSERT(r == 0);
+ ASSERT(uv_is_readable((uv_stream_t*) &tty_in));
+ ASSERT(!uv_is_writable((uv_stream_t*) &tty_in));
r = uv_tty_init(uv_default_loop(), &tty_out, ttyout_fd, 0); /* Writable. */
ASSERT(r == 0);
+ ASSERT(!uv_is_readable((uv_stream_t*) &tty_out));
+ ASSERT(uv_is_writable((uv_stream_t*) &tty_out));
r = uv_tty_get_winsize(&tty_out, &width, &height);
ASSERT(r == 0);
@@ -186,6 +190,8 @@ TEST_IMPL(tty_raw) {
r = uv_tty_init(uv_default_loop(), &tty_in, ttyin_fd, 1); /* Readable. */
ASSERT(r == 0);
+ ASSERT(uv_is_readable((uv_stream_t*) &tty_in));
+ ASSERT(!uv_is_writable((uv_stream_t*) &tty_in));
r = uv_read_start((uv_stream_t*)&tty_in, tty_raw_alloc, tty_raw_read);
ASSERT(r == 0);
@@ -242,6 +248,8 @@ TEST_IMPL(tty_empty_write) {
r = uv_tty_init(uv_default_loop(), &tty_out, ttyout_fd, 0); /* Writable. */
ASSERT(r == 0);
+ ASSERT(!uv_is_readable((uv_stream_t*) &tty_out));
+ ASSERT(uv_is_writable((uv_stream_t*) &tty_out));
bufs[0].len = 0;
bufs[0].base = &dummy[0];
@@ -302,6 +310,41 @@ TEST_IMPL(tty_large_write) {
MAKE_VALGRIND_HAPPY();
return 0;
}
+
+TEST_IMPL(tty_raw_cancel) {
+ int r;
+ int ttyin_fd;
+ uv_tty_t tty_in;
+ uv_loop_t* loop;
+ HANDLE handle;
+
+ loop = uv_default_loop();
+ /* Make sure we have an FD that refers to a tty */
+ handle = CreateFileA("conin$",
+ GENERIC_READ | GENERIC_WRITE,
+ FILE_SHARE_READ | FILE_SHARE_WRITE,
+ NULL,
+ OPEN_EXISTING,
+ FILE_ATTRIBUTE_NORMAL,
+ NULL);
+ ASSERT(handle != INVALID_HANDLE_VALUE);
+ ttyin_fd = _open_osfhandle((intptr_t) handle, 0);
+ ASSERT(ttyin_fd >= 0);
+ ASSERT(UV_TTY == uv_guess_handle(ttyin_fd));
+
+ r = uv_tty_init(uv_default_loop(), &tty_in, ttyin_fd, 1); /* Readable. */
+ ASSERT(r == 0);
+ r = uv_tty_set_mode(&tty_in, UV_TTY_MODE_RAW);
+ ASSERT(r == 0);
+ r = uv_read_start((uv_stream_t*)&tty_in, tty_raw_alloc, tty_raw_read);
+ ASSERT(r == 0);
+
+ r = uv_read_stop((uv_stream_t*) &tty_in);
+ ASSERT(r == 0);
+
+ MAKE_VALGRIND_HAPPY();
+ return 0;
+}
#endif
@@ -309,6 +352,8 @@ TEST_IMPL(tty_file) {
#ifndef _WIN32
uv_loop_t loop;
uv_tty_t tty;
+ uv_tty_t tty_ro;
+ uv_tty_t tty_wo;
int fd;
ASSERT(0 == uv_loop_init(&loop));
@@ -334,13 +379,40 @@ TEST_IMPL(tty_file) {
ASSERT(0 == close(fd));
}
- fd = open("/dev/tty", O_RDONLY);
+ fd = open("/dev/tty", O_RDWR);
if (fd != -1) {
ASSERT(0 == uv_tty_init(&loop, &tty, fd, 1));
- ASSERT(0 == close(fd));
+ ASSERT(0 == close(fd)); /* TODO: it's indeterminate who owns fd now */
+ ASSERT(uv_is_readable((uv_stream_t*) &tty));
+ ASSERT(uv_is_writable((uv_stream_t*) &tty));
uv_close((uv_handle_t*) &tty, NULL);
+ ASSERT(!uv_is_readable((uv_stream_t*) &tty));
+ ASSERT(!uv_is_writable((uv_stream_t*) &tty));
+ }
+
+ fd = open("/dev/tty", O_RDONLY);
+ if (fd != -1) {
+ ASSERT(0 == uv_tty_init(&loop, &tty_ro, fd, 1));
+ ASSERT(0 == close(fd)); /* TODO: it's indeterminate who owns fd now */
+ ASSERT(uv_is_readable((uv_stream_t*) &tty_ro));
+ ASSERT(!uv_is_writable((uv_stream_t*) &tty_ro));
+ uv_close((uv_handle_t*) &tty_ro, NULL);
+ ASSERT(!uv_is_readable((uv_stream_t*) &tty_ro));
+ ASSERT(!uv_is_writable((uv_stream_t*) &tty_ro));
}
+ fd = open("/dev/tty", O_WRONLY);
+ if (fd != -1) {
+ ASSERT(0 == uv_tty_init(&loop, &tty_wo, fd, 0));
+ ASSERT(0 == close(fd)); /* TODO: it's indeterminate who owns fd now */
+ ASSERT(!uv_is_readable((uv_stream_t*) &tty_wo));
+ ASSERT(uv_is_writable((uv_stream_t*) &tty_wo));
+ uv_close((uv_handle_t*) &tty_wo, NULL);
+ ASSERT(!uv_is_readable((uv_stream_t*) &tty_wo));
+ ASSERT(!uv_is_writable((uv_stream_t*) &tty_wo));
+ }
+
+
ASSERT(0 == uv_run(&loop, UV_RUN_DEFAULT));
ASSERT(0 == uv_loop_close(&loop));
@@ -370,6 +442,10 @@ TEST_IMPL(tty_pty) {
ASSERT(0 == uv_tty_init(&loop, &slave_tty, slave_fd, 0));
ASSERT(0 == uv_tty_init(&loop, &master_tty, master_fd, 0));
+ ASSERT(uv_is_readable((uv_stream_t*) &slave_tty));
+ ASSERT(uv_is_writable((uv_stream_t*) &slave_tty));
+ ASSERT(uv_is_readable((uv_stream_t*) &master_tty));
+ ASSERT(uv_is_writable((uv_stream_t*) &master_tty));
/* Check if the file descriptor was reopened. If it is,
* UV_HANDLE_BLOCKING_WRITES (value 0x100000) isn't set on flags.
*/
diff --git a/deps/uv/uv.gyp b/deps/uv/uv.gyp
index 37dcb3604f4c72..5148a850ab4c15 100644
--- a/deps/uv/uv.gyp
+++ b/deps/uv/uv.gyp
@@ -116,7 +116,6 @@
'src/win/poll.c',
'src/win/process.c',
'src/win/process-stdio.c',
- 'src/win/req.c',
'src/win/req-inl.h',
'src/win/signal.c',
'src/win/snprintf.c',
diff --git a/deps/v8/BUILD.gn b/deps/v8/BUILD.gn
index fbb34a0b3dc14c..19ffdb38867782 100644
--- a/deps/v8/BUILD.gn
+++ b/deps/v8/BUILD.gn
@@ -828,6 +828,8 @@ action("postmortem-metadata") {
"src/objects/js-regexp-string-iterator.h",
"src/objects/map.h",
"src/objects/map-inl.h",
+ "src/objects/name.h",
+ "src/objects/name-inl.h",
"src/objects/scope-info.h",
"src/objects/script.h",
"src/objects/script-inl.h",
diff --git a/deps/v8/gypfiles/features.gypi b/deps/v8/gypfiles/features.gypi
index 69ff763be04ab5..35a078e8af2fd2 100644
--- a/deps/v8/gypfiles/features.gypi
+++ b/deps/v8/gypfiles/features.gypi
@@ -29,9 +29,16 @@
{
'variables': {
- 'variables': {
- 'v8_target_arch%': '<(target_arch)',
- },
+ 'v8_target_arch%': '<(target_arch)',
+
+ # Emulate GN variables
+ 'conditions': [
+ ['OS=="android"', { # GYP reverts OS to linux so use `-D OS=android`
+ 'is_android': 1,
+ }, {
+ 'is_android': 0,
+ }],
+ ],
# Allows the embedder to add a custom suffix to the version string.
'v8_embedder_string%': '',
@@ -95,6 +102,8 @@
# Enable mitigations for executing untrusted code.
'v8_untrusted_code_mitigations%': 'true',
+
+ 'v8_enable_handle_zapping%': 1,
},
'target_defaults': {
'conditions': [
@@ -105,7 +114,7 @@
'defines': ['ENABLE_DISASSEMBLER',],
}],
['v8_promise_internal_field_count!=0', {
- 'defines': ['V8_PROMISE_INTERNAL_FIELD_COUNT','v8_promise_internal_field_count'],
+ 'defines': ['V8_PROMISE_INTERNAL_FIELD_COUNT=<(v8_promise_internal_field_count)'],
}],
['v8_enable_gdbjit==1', {
'defines': ['ENABLE_GDB_JIT_INTERFACE',],
@@ -155,30 +164,10 @@
['v8_untrusted_code_mitigations=="false"', {
'defines': ['DISABLE_UNTRUSTED_CODE_MITIGATIONS',],
}],
+ ['v8_enable_handle_zapping==1', {
+ 'defines': ['ENABLE_HANDLE_ZAPPING',],
+ }],
], # conditions
- 'configurations': {
- 'DebugBaseCommon': {
- 'abstract': 1,
- 'variables': {
- 'v8_enable_handle_zapping%': 1,
- },
- 'conditions': [
- ['v8_enable_handle_zapping==1', {
- 'defines': ['ENABLE_HANDLE_ZAPPING',],
- }],
- ],
- }, # Debug
- 'Release': {
- 'variables': {
- 'v8_enable_handle_zapping%': 1,
- },
- 'conditions': [
- ['v8_enable_handle_zapping==1', {
- 'defines': ['ENABLE_HANDLE_ZAPPING',],
- }],
- ], # conditions
- }, # Release
- }, # configurations
'defines': [
'V8_GYP_BUILD',
'V8_TYPED_ARRAY_MAX_SIZE_IN_HEAP=<(v8_typed_array_max_size_in_heap)',
diff --git a/deps/v8/gypfiles/inspector.gyp b/deps/v8/gypfiles/inspector.gyp
deleted file mode 100644
index c0b503d9cec51f..00000000000000
--- a/deps/v8/gypfiles/inspector.gyp
+++ /dev/null
@@ -1,89 +0,0 @@
-# Copyright 2016 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.
-
-{
- 'variables': {
- 'protocol_path': '../third_party/inspector_protocol',
- 'inspector_path': '../src/inspector',
- },
- 'includes': [
- 'inspector.gypi',
- '../third_party/inspector_protocol/inspector_protocol.gypi',
- ],
- 'targets': [
- { 'target_name': 'inspector_injected_script',
- 'type': 'none',
- 'toolsets': ['target'],
- 'actions': [
- {
- 'action_name': 'convert_js_to_cpp_char_array',
- 'inputs': [
- '<(inspector_path)/build/xxd.py',
- '<(inspector_injected_script_source)',
- ],
- 'outputs': [
- '<(inspector_generated_injected_script)',
- ],
- 'action': [
- 'python',
- '<(inspector_path)/build/xxd.py',
- 'InjectedScriptSource_js',
- '<(inspector_path)/injected-script-source.js',
- '<@(_outputs)'
- ],
- },
- ],
- # Since this target generates header files, it needs to be a hard dependency.
- 'hard_dependency': 1,
- },
- { 'target_name': 'protocol_compatibility',
- 'type': 'none',
- 'toolsets': ['target'],
- 'actions': [
- {
- 'action_name': 'protocol_compatibility',
- 'inputs': [
- '<(inspector_path)/js_protocol.json',
- ],
- 'outputs': [
- '<@(SHARED_INTERMEDIATE_DIR)/src/js_protocol.stamp',
- ],
- 'action': [
- 'python',
- '<(protocol_path)/CheckProtocolCompatibility.py',
- '--stamp', '<@(_outputs)',
- '<(inspector_path)/js_protocol.json',
- ],
- 'message': 'Generating inspector protocol sources from protocol json definition',
- },
- ]
- },
- { 'target_name': 'protocol_generated_sources',
- 'type': 'none',
- 'dependencies': [ 'protocol_compatibility' ],
- 'toolsets': ['target'],
- 'actions': [
- {
- 'action_name': 'protocol_generated_sources',
- 'inputs': [
- '<(inspector_path)/js_protocol.json',
- '<(inspector_path)/inspector_protocol_config.json',
- '<@(inspector_protocol_files)',
- ],
- 'outputs': [
- '<@(inspector_generated_sources)',
- ],
- 'action': [
- 'python',
- '<(protocol_path)/CodeGenerator.py',
- '--jinja_dir', '../third_party',
- '--output_base', '<(SHARED_INTERMEDIATE_DIR)/src/inspector',
- '--config', '<(inspector_path)/inspector_protocol_config.json',
- ],
- 'message': 'Generating inspector protocol sources from protocol json',
- },
- ]
- },
- ],
-}
diff --git a/deps/v8/gypfiles/inspector.gypi b/deps/v8/gypfiles/inspector.gypi
index 00cbbfaecb7f28..be42ea8b783ff8 100644
--- a/deps/v8/gypfiles/inspector.gypi
+++ b/deps/v8/gypfiles/inspector.gypi
@@ -4,6 +4,9 @@
{
'variables': {
+ 'protocol_path': '../third_party/inspector_protocol',
+ 'inspector_path': '../src/inspector',
+
'inspector_generated_sources': [
'<(SHARED_INTERMEDIATE_DIR)/src/inspector/protocol/Forward.h',
'<(SHARED_INTERMEDIATE_DIR)/src/inspector/protocol/Protocol.cpp',
@@ -29,8 +32,6 @@
'inspector_generated_injected_script': '<(SHARED_INTERMEDIATE_DIR)/src/inspector/injected-script-source.h',
'inspector_all_sources': [
- '<@(inspector_generated_sources)',
- '<(inspector_generated_injected_script)',
'../include/v8-inspector.h',
'../include/v8-inspector-protocol.h',
'../src/inspector/injected-script.cc',
@@ -86,5 +87,64 @@
'../src/inspector/wasm-translation.cc',
'../src/inspector/wasm-translation.h',
]
- }
+ },
+ 'includes': [
+ '../third_party/inspector_protocol/inspector_protocol.gypi',
+ ],
+ 'actions': [
+ {
+ 'action_name': 'protocol_compatibility',
+ 'inputs': [
+ '<(inspector_path)/js_protocol.json',
+ ],
+ 'outputs': [
+ '<@(SHARED_INTERMEDIATE_DIR)/src/js_protocol.stamp',
+ ],
+ 'action': [
+ 'python',
+ '<(protocol_path)/CheckProtocolCompatibility.py',
+ '--stamp', '<@(_outputs)',
+ '<(inspector_path)/js_protocol.json',
+ ],
+ 'message': 'Checking inspector protocol compatibility',
+ },
+ {
+ 'action_name': 'protocol_generated_sources',
+ 'inputs': [
+ '<(inspector_path)/js_protocol.json',
+ '<(inspector_path)/inspector_protocol_config.json',
+ '<@(inspector_protocol_files)',
+ ],
+ 'outputs': [
+ '<@(inspector_generated_sources)',
+ ],
+ 'process_outputs_as_sources': 1,
+ 'action': [
+ 'python',
+ '<(protocol_path)/CodeGenerator.py',
+ '--jinja_dir', '../third_party',
+ '--output_base', '<(SHARED_INTERMEDIATE_DIR)/src/inspector',
+ '--config', '<(inspector_path)/inspector_protocol_config.json',
+ ],
+ 'message': 'Generating inspector protocol sources from protocol json',
+ },
+ {
+ 'action_name': 'convert_js_to_cpp_char_array',
+ 'inputs': [
+ '<(inspector_path)/build/xxd.py',
+ '<(inspector_injected_script_source)',
+ ],
+ 'outputs': [
+ '<(inspector_generated_injected_script)',
+ ],
+ 'process_outputs_as_sources': 1,
+ 'action': [
+ 'python',
+ '<(inspector_path)/build/xxd.py',
+ 'InjectedScriptSource_js',
+ '<(inspector_path)/injected-script-source.js',
+ '<@(_outputs)'
+ ],
+ },
+ ],
}
diff --git a/deps/v8/gypfiles/toolchain.gypi b/deps/v8/gypfiles/toolchain.gypi
index 97d2192ed828a7..7f497fac91e2b2 100644
--- a/deps/v8/gypfiles/toolchain.gypi
+++ b/deps/v8/gypfiles/toolchain.gypi
@@ -1425,5 +1425,24 @@
}],
],
}, # configurations
+ 'msvs_disabled_warnings': [
+ 4245, # Conversion with signed/unsigned mismatch.
+ 4267, # Conversion with possible loss of data.
+ 4324, # Padding structure due to alignment.
+ 4701, # Potentially uninitialized local variable.
+ 4702, # Unreachable code.
+ 4703, # Potentially uninitialized local pointer variable.
+ 4709, # Comma operator within array index expr (bugged).
+ 4714, # Function marked forceinline not inlined.
+
+ # MSVC assumes that control can get past an exhaustive switch and then
+ # warns if there's no return there (see https://crbug.com/v8/7658)
+ 4715, # Not all control paths return a value.
+
+ 4718, # Recursive call has no side-effect.
+ 4723, # https://crbug.com/v8/7771
+ 4724, # https://crbug.com/v8/7771
+ 4800, # Forcing value to bool.
+ ],
}, # target_defaults
}
diff --git a/deps/v8/gypfiles/v8.gyp b/deps/v8/gypfiles/v8.gyp
index 5417365888ef06..8c78f022551e66 100644
--- a/deps/v8/gypfiles/v8.gyp
+++ b/deps/v8/gypfiles/v8.gyp
@@ -7,19 +7,20 @@
'v8_code': 1,
'v8_random_seed%': 314159265,
'v8_vector_stores%': 0,
- 'embed_script%': "",
- 'warmup_script%': "",
+ 'v8_embed_script%': "",
'v8_extra_library_files%': [],
'v8_experimental_extra_library_files%': [],
'mksnapshot_exec': '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)mksnapshot<(EXECUTABLE_SUFFIX)',
'v8_os_page_size%': 0,
+ 'torque_generated_pure_headers': [
+ '<(SHARED_INTERMEDIATE_DIR)/torque-generated/builtin-definitions-from-dsl.h',
+ ],
},
- 'includes': ['toolchain.gypi', 'features.gypi', 'inspector.gypi'],
+ 'includes': ['toolchain.gypi', 'features.gypi'],
'targets': [
{
'target_name': 'v8',
- 'dependencies_traverse': 1,
- 'dependencies': ['v8_maybe_snapshot', 'v8_dump_build_config#target'],
+ 'dependencies': [ 'v8_maybe_snapshot' ],
'conditions': [
['want_separate_host_toolset==1', {
'toolsets': ['host', 'target'],
@@ -60,11 +61,55 @@
}],
],
'direct_dependent_settings': {
- 'include_dirs': [
- '../include/',
- ],
+ 'include_dirs': [ '../include/', ],
},
- },
+ 'actions': [
+ {
+ 'action_name': 'v8_dump_build_config',
+ 'toolsets': ['target'],
+ 'inputs': [
+ '../tools/testrunner/utils/dump_build_config_gyp.py',
+ ],
+ 'outputs': [
+ '<(PRODUCT_DIR)/v8_build_config.json',
+ ],
+ 'variables': {
+ 'v8_dump_build_config_args': [
+ '<(PRODUCT_DIR)/v8_build_config.json',
+ 'dcheck_always_on=<(dcheck_always_on)',
+ 'is_asan=<(asan)',
+ 'is_cfi=<(cfi_vptr)',
+ 'is_component_build=<(component)',
+ 'is_debug=<(CONFIGURATION_NAME)',
+ # Not available in gyp.
+ 'is_gcov_coverage=0',
+ 'is_msan=<(msan)',
+ 'is_tsan=<(tsan)',
+ # Not available in gyp.
+ 'is_ubsan_vptr=0',
+ 'target_cpu=<(target_arch)',
+ 'v8_enable_i18n_support=<(v8_enable_i18n_support)',
+ 'v8_enable_verify_predictable=<(v8_enable_verify_predictable)',
+ 'v8_target_cpu=<(v8_target_arch)',
+ 'v8_use_snapshot=<(v8_use_snapshot)',
+ ]
+ },
+ 'conditions': [
+ ['v8_target_arch=="mips" or v8_target_arch=="mipsel" \
+ or v8_target_arch=="mips64" or v8_target_arch=="mips64el"', {
+ 'v8_dump_build_config_args':[
+ 'mips_arch_variant=<(mips_arch_variant)',
+ 'mips_use_msa=<(mips_use_msa)',
+ ],
+ }],
+ ],
+ 'action': [
+ 'python', '../tools/testrunner/utils/dump_build_config_gyp.py',
+ '<@(v8_dump_build_config_args)',
+ ],
+ },
+ ],
+ }, # v8
{
# This rule delegates to either v8_snapshot, v8_nosnapshot, or
# v8_external_snapshot, depending on the current variables.
@@ -86,21 +131,9 @@
}],
['v8_use_snapshot=="true" and v8_use_external_startup_data==1 and want_separate_host_toolset==0', {
'dependencies': ['v8_base', 'v8_external_snapshot'],
- 'inputs': [ '<(PRODUCT_DIR)/snapshot_blob.bin', ],
}],
['v8_use_snapshot=="true" and v8_use_external_startup_data==1 and want_separate_host_toolset==1', {
'dependencies': ['v8_base', 'v8_external_snapshot'],
- 'target_conditions': [
- ['_toolset=="host"', {
- 'inputs': [
- '<(PRODUCT_DIR)/snapshot_blob_host.bin',
- ],
- }, {
- 'inputs': [
- '<(PRODUCT_DIR)/snapshot_blob.bin',
- ],
- }],
- ],
}],
['want_separate_host_toolset==1', {
'toolsets': ['host', 'target'],
@@ -108,24 +141,27 @@
'toolsets': ['target'],
}],
]
- },
+ }, # v8_maybe_snapshot
{
'target_name': 'v8_init',
'type': 'static_library',
'dependencies': [
'v8_initializers',
- 'v8_torque#host',
+ # We need this transitive dependency, since it also does codegen.
+ 'v8_base',
],
'variables': {
'optimize': 'max',
},
- 'include_dirs+': [
+ 'include_dirs': [
'..',
'../include/',
+ # This is for `gen/builtins-generated`
+ '<(SHARED_INTERMEDIATE_DIR)',
],
'sources': [
'../src/setup-isolate-full.cc',
- '<(SHARED_INTERMEDIATE_DIR)/torque-generated/builtin-definitions-from-dsl.h',
+ '<@(torque_generated_pure_headers)',
],
'conditions': [
['want_separate_host_toolset==1', {
@@ -134,18 +170,17 @@
'toolsets': ['target'],
}],
],
- },
+ }, # v8_init
{
'target_name': 'v8_initializers',
'type': 'static_library',
'dependencies': [
'v8_base',
- 'v8_torque#host',
],
'variables': {
'optimize': 'max',
},
- 'include_dirs+': [
+ 'include_dirs': [
'..',
'../include/',
],
@@ -223,6 +258,7 @@
'<(SHARED_INTERMEDIATE_DIR)/torque-generated/builtins-base-from-dsl-gen.h',
'<(SHARED_INTERMEDIATE_DIR)/torque-generated/builtins-typed-array-from-dsl-gen.cc',
'<(SHARED_INTERMEDIATE_DIR)/torque-generated/builtins-typed-array-from-dsl-gen.h',
+ '<@(torque_generated_pure_headers)',
],
'conditions': [
['want_separate_host_toolset==1', {
@@ -276,7 +312,7 @@
],
}],
],
- },
+ }, # v8_initializers
{
'target_name': 'v8_snapshot',
'type': 'static_library',
@@ -308,67 +344,66 @@
'dependencies': [
'v8_base',
],
- 'include_dirs+': [
+ 'include_dirs': [
'..',
'<(DEPTH)',
],
+ 'variables': {
+ 'mksnapshot_flags': [ '--turbo_instruction_scheduling', ],
+ 'conditional_snapshot_outputs': [ ],
+ 'conditional_inputs': [ ],
+ 'conditions': [
+ ['v8_random_seed != 0', {
+ 'mksnapshot_flags': ['--random-seed', '<(v8_random_seed)'],
+ }],
+ ['v8_os_page_size != 0', {
+ 'mksnapshot_flags': ['--v8_os_page_size', '<(v8_os_page_size)'],
+ }],
+ ['v8_use_external_startup_data !=0 ', {
+ 'conditional_snapshot_outputs': [ '<(INTERMEDIATE_DIR)/snapshot_blob.bin', ],
+ 'mksnapshot_flags': [ '--startup_blob', '<(INTERMEDIATE_DIR)/snapshot_blob.bin', ]
+ }, {
+ 'conditional_snapshot_outputs': [ "<(INTERMEDIATE_DIR)/snapshot.cc" ],
+ 'mksnapshot_flags': [ '--startup_src', '<(INTERMEDIATE_DIR)/snapshot.cc', ]
+ }],
+ ['v8_embed_script != ""', {
+ 'conditional_inputs': [ '<(v8_embed_script)' ],
+ 'mksnapshot_flags': [ '<(v8_embed_script)' ],
+ }],
+ ],
+ },
'sources': [
- '<(SHARED_INTERMEDIATE_DIR)/libraries.cc',
- '<(SHARED_INTERMEDIATE_DIR)/extras-libraries.cc',
'<(SHARED_INTERMEDIATE_DIR)/experimental-extras-libraries.cc',
- '<(INTERMEDIATE_DIR)/snapshot.cc',
+ '<(SHARED_INTERMEDIATE_DIR)/extras-libraries.cc',
+ '<(SHARED_INTERMEDIATE_DIR)/libraries.cc',
'../src/setup-isolate-deserialize.cc',
],
'actions': [
{
'action_name': 'run_mksnapshot',
+ 'message': 'generating: >@(conditional_snapshot_outputs)',
'inputs': [
'<(mksnapshot_exec)',
- ],
- 'conditions': [
- ['embed_script!=""', {
- 'inputs': [
- '<(embed_script)',
- ],
- }],
- ['warmup_script!=""', {
- 'inputs': [
- '<(warmup_script)',
- ],
- }],
+ '>@(conditional_inputs)',
],
'outputs': [
- '<(INTERMEDIATE_DIR)/snapshot.cc',
+ '>@(conditional_snapshot_outputs)',
],
- 'variables': {
- 'mksnapshot_flags': [],
- 'conditions': [
- ['v8_random_seed!=0', {
- 'mksnapshot_flags': ['--random-seed', '<(v8_random_seed)'],
- }],
- ['v8_vector_stores!=0', {
- 'mksnapshot_flags': ['--vector-stores'],
- }],
- ],
- },
+ 'process_outputs_as_sources': 1,
'action': [
- '<(mksnapshot_exec)',
- '<@(mksnapshot_flags)',
- '--startup_src', '<@(INTERMEDIATE_DIR)/snapshot.cc',
- '<(embed_script)',
- '<(warmup_script)',
+ '>@(_inputs)',
+ '>@(mksnapshot_flags)',
],
},
],
- },
+ }, # v8_snapshot
{
'target_name': 'v8_nosnapshot',
'type': 'static_library',
'dependencies': [
'v8_base',
- 'v8_torque#host',
],
- 'include_dirs+': [
+ 'include_dirs': [
'..',
'<(DEPTH)',
],
@@ -392,143 +427,27 @@
],
}],
]
- },
- {
- 'target_name': 'v8_external_snapshot',
- 'type': 'static_library',
- 'conditions': [
- [ 'v8_use_external_startup_data==1', {
- 'conditions': [
- ['want_separate_host_toolset==1', {
- 'toolsets': ['host', 'target'],
- 'dependencies': [
- 'mksnapshot#host',
- 'js2c#host',
- 'natives_blob',
- ]}, {
- 'toolsets': ['target'],
- 'dependencies': [
- 'mksnapshot',
- 'js2c',
- 'natives_blob',
- ],
- }],
- ['component=="shared_library"', {
- 'defines': [
- 'BUILDING_V8_SHARED',
- ],
- 'direct_dependent_settings': {
- 'defines': [
- 'USING_V8_SHARED',
- ],
- },
- }],
- ],
- 'dependencies': [
- 'v8_base',
- ],
- 'include_dirs+': [
- '..',
- '<(DEPTH)',
- ],
- 'sources': [
- '../src/setup-isolate-deserialize.cc',
- '../src/snapshot/natives-external.cc',
- '../src/snapshot/snapshot-external.cc',
- ],
- 'actions': [
- {
- 'action_name': 'run_mksnapshot (external)',
- 'inputs': [
- '<(mksnapshot_exec)',
- ],
- 'variables': {
- 'mksnapshot_flags': [],
- 'conditions': [
- ['v8_random_seed!=0', {
- 'mksnapshot_flags': ['--random-seed', '<(v8_random_seed)'],
- }],
- ['v8_vector_stores!=0', {
- 'mksnapshot_flags': ['--vector-stores'],
- }],
- ['v8_os_page_size!=0', {
- 'mksnapshot_flags': ['--v8_os_page_size', '<(v8_os_page_size)'],
- }],
- ],
- },
- 'conditions': [
- ['embed_script!=""', {
- 'inputs': [
- '<(embed_script)',
- ],
- }],
- ['warmup_script!=""', {
- 'inputs': [
- '<(warmup_script)',
- ],
- }],
- ['want_separate_host_toolset==1', {
- 'target_conditions': [
- ['_toolset=="host"', {
- 'outputs': [
- '<(PRODUCT_DIR)/snapshot_blob_host.bin',
- ],
- 'action': [
- '<(mksnapshot_exec)',
- '<@(mksnapshot_flags)',
- '--startup_blob', '<(PRODUCT_DIR)/snapshot_blob_host.bin',
- '<(embed_script)',
- '<(warmup_script)',
- ],
- }, {
- 'outputs': [
- '<(PRODUCT_DIR)/snapshot_blob.bin',
- ],
- 'action': [
- '<(mksnapshot_exec)',
- '<@(mksnapshot_flags)',
- '--startup_blob', '<(PRODUCT_DIR)/snapshot_blob.bin',
- '<(embed_script)',
- '<(warmup_script)',
- ],
- }],
- ],
- }, {
- 'outputs': [
- '<(PRODUCT_DIR)/snapshot_blob.bin',
- ],
- 'action': [
- '<(mksnapshot_exec)',
- '<@(mksnapshot_flags)',
- '--startup_blob', '<(PRODUCT_DIR)/snapshot_blob.bin',
- '<(embed_script)',
- '<(warmup_script)',
- ],
- }],
- ],
- },
- ],
- }],
- ],
- },
+ }, # v8_nosnapshot
{
'target_name': 'v8_base',
'type': 'static_library',
+ # Since this target is a static-library, but as a side effect it generates
+ # header files, it needs to be a hard dependency.
+ 'hard_dependency': 1,
+ 'includes': [ 'inspector.gypi' ],
'dependencies': [
'v8_libbase',
'v8_libsampler',
'v8_torque#host',
- 'inspector.gyp:protocol_generated_sources#target',
- 'inspector.gyp:inspector_injected_script#target',
],
'direct_dependent_settings': {
- 'include_dirs+': ['<(SHARED_INTERMEDIATE_DIR)'],
+ 'include_dirs': ['<(SHARED_INTERMEDIATE_DIR)'],
},
'objs': ['foo.o'],
'variables': {
'optimize': 'max',
},
- 'include_dirs+': [
+ 'include_dirs': [
'..',
'<(DEPTH)',
'<(SHARED_INTERMEDIATE_DIR)'
@@ -1558,7 +1477,7 @@
'../src/zone/zone-segment.h',
'../src/zone/zone.cc',
'../src/zone/zone.h',
- '<(SHARED_INTERMEDIATE_DIR)/torque-generated/builtin-definitions-from-dsl.h',
+ '<@(torque_generated_pure_headers)',
],
'conditions': [
['want_separate_host_toolset==1', {
@@ -1870,9 +1789,10 @@
],
}],
['v8_postmortem_support=="true"', {
+ 'dependencies': [ 'postmortem-metadata#target' ],
'sources': [
'<(SHARED_INTERMEDIATE_DIR)/debug-support.cc',
- ]
+ ],
}],
['v8_enable_i18n_support==1', {
'dependencies': [
@@ -1913,7 +1833,7 @@
],
}],
],
- },
+ }, # v8_base
{
'target_name': 'v8_libbase',
'type': '<(component)',
@@ -1921,11 +1841,11 @@
'variables': {
'optimize': 'max',
},
- 'include_dirs+': [
+ 'include_dirs': [
'..',
],
'direct_dependent_settings': {
- 'include_dirs+': ['..'],
+ 'include_dirs': ['..'],
},
'sources': [
'../src/base/adapters.h',
@@ -2246,7 +2166,7 @@
}
],
],
- },
+ }, # v8_libbase
{
'target_name': 'v8_libplatform',
'type': '<(component)',
@@ -2256,15 +2176,15 @@
'dependencies': [
'v8_libbase',
],
- 'include_dirs+': [
+ 'include_dirs': [
'..',
'<(DEPTH)',
'../include/',
],
'sources': [
- '../include//libplatform/libplatform-export.h',
- '../include//libplatform/libplatform.h',
- '../include//libplatform/v8-tracing.h',
+ '../include/libplatform/libplatform-export.h',
+ '../include/libplatform/libplatform.h',
+ '../include/libplatform/v8-tracing.h',
'../src/libplatform/default-foreground-task-runner.cc',
'../src/libplatform/default-foreground-task-runner.h',
'../src/libplatform/default-platform.cc',
@@ -2301,7 +2221,7 @@
'../include/',
],
},
- },
+ }, # v8_libplatform
{
'target_name': 'v8_libsampler',
'type': 'static_library',
@@ -2311,7 +2231,7 @@
'dependencies': [
'v8_libbase',
],
- 'include_dirs+': [
+ 'include_dirs': [
'..',
'../include/',
],
@@ -2331,11 +2251,16 @@
'../include/',
],
},
- },
+ }, # v8_libsampler
{
'target_name': 'natives_blob',
'type': 'none',
'conditions': [
+ ['want_separate_host_toolset==1', {
+ 'toolsets': ['host', 'target'],
+ }, {
+ 'toolsets': ['target'],
+ }],
[ 'v8_use_external_startup_data==1', {
'conditions': [
['want_separate_host_toolset==1', {
@@ -2344,51 +2269,99 @@
'dependencies': ['js2c'],
}],
],
- 'actions': [{
- 'action_name': 'concatenate_natives_blob',
- 'inputs': [
- '../tools//concatenate-files.py',
- '<(SHARED_INTERMEDIATE_DIR)/libraries.bin',
- '<(SHARED_INTERMEDIATE_DIR)/libraries-extras.bin',
- '<(SHARED_INTERMEDIATE_DIR)/libraries-experimental-extras.bin',
- ],
- 'conditions': [
- ['want_separate_host_toolset==1', {
- 'target_conditions': [
- ['_toolset=="host"', {
- 'outputs': [
- '<(PRODUCT_DIR)/natives_blob_host.bin',
- ],
- 'action': [
- 'python', '<@(_inputs)', '<(PRODUCT_DIR)/natives_blob_host.bin'
- ],
- }, {
- 'outputs': [
- '<(PRODUCT_DIR)/natives_blob.bin',
- ],
- 'action': [
- 'python', '<@(_inputs)', '<(PRODUCT_DIR)/natives_blob.bin'
- ],
- }],
- ],
- }, {
- 'outputs': [
- '<(PRODUCT_DIR)/natives_blob.bin',
- ],
- 'action': [
- 'python', '<@(_inputs)', '<(PRODUCT_DIR)/natives_blob.bin'
- ],
- }],
- ],
- }],
- }],
- ['want_separate_host_toolset==1', {
- 'toolsets': ['host', 'target'],
- }, {
- 'toolsets': ['target'],
+ 'actions': [
+ {
+ 'action_name': 'js2c_bin',
+ 'inputs': [
+ '../tools/js2c.py',
+ '<@(library_files)',
+ ],
+ 'outputs': ['<@(libraries_bin_file)'],
+ 'action': [
+ 'python',
+ '../tools/js2c.py',
+ '<(SHARED_INTERMEDIATE_DIR)/libraries.cc',
+ 'CORE',
+ '<@(library_files)',
+ '--startup_blob', '<@(libraries_bin_file)',
+ '--nojs',
+ ],
+ },
+ {
+ 'action_name': 'js2c_extras_bin',
+ 'inputs': [
+ '../tools/js2c.py',
+ '<@(v8_extra_library_files)',
+ ],
+ 'outputs': ['<@(libraries_extras_bin_file)'],
+ 'action': [
+ 'python',
+ '../tools/js2c.py',
+ '<(SHARED_INTERMEDIATE_DIR)/extras-libraries.cc',
+ 'EXTRAS',
+ '<@(v8_extra_library_files)',
+ '--startup_blob', '<@(libraries_extras_bin_file)',
+ '--nojs',
+ ],
+ },
+ {
+ 'action_name': 'js2c_experimental_extras_bin',
+ 'inputs': [
+ '../tools/js2c.py',
+ '<@(v8_experimental_extra_library_files)',
+ ],
+ 'outputs': ['<@(libraries_experimental_extras_bin_file)'],
+ 'action': [
+ 'python',
+ '../tools/js2c.py',
+ '<(SHARED_INTERMEDIATE_DIR)/experimental-extras-libraries.cc',
+ 'EXPERIMENTAL_EXTRAS',
+ '<@(v8_experimental_extra_library_files)',
+ '--startup_blob', '<@(libraries_experimental_extras_bin_file)',
+ '--nojs',
+ ],
+ },
+ {
+ 'action_name': 'concatenate_natives_blob',
+ 'inputs': [
+ '../tools/concatenate-files.py',
+ '<(SHARED_INTERMEDIATE_DIR)/libraries.bin',
+ '<(SHARED_INTERMEDIATE_DIR)/libraries-extras.bin',
+ '<(SHARED_INTERMEDIATE_DIR)/libraries-experimental-extras.bin',
+ ],
+ 'conditions': [
+ ['want_separate_host_toolset==1', {
+ 'target_conditions': [
+ ['_toolset=="host"', {
+ 'outputs': [
+ '<(PRODUCT_DIR)/natives_blob_host.bin',
+ ],
+ 'action': [
+ 'python', '<@(_inputs)', '<(PRODUCT_DIR)/natives_blob_host.bin'
+ ],
+ }, {
+ 'outputs': [
+ '<(PRODUCT_DIR)/natives_blob.bin',
+ ],
+ 'action': [
+ 'python', '<@(_inputs)', '<(PRODUCT_DIR)/natives_blob.bin'
+ ],
+ }],
+ ],
+ }, {
+ 'outputs': [
+ '<(PRODUCT_DIR)/natives_blob.bin',
+ ],
+ 'action': [
+ 'python', '<@(_inputs)', '<(PRODUCT_DIR)/natives_blob.bin'
+ ],
+ }],
+ ],
+ },
+ ],
}],
]
- },
+ }, # natives_blob
{
'target_name': 'js2c',
'type': 'none',
@@ -2423,71 +2396,37 @@
{
'action_name': 'js2c',
'inputs': [
- '../tools//js2c.py',
+ '../tools/js2c.py',
'<@(library_files)',
],
'outputs': ['<(SHARED_INTERMEDIATE_DIR)/libraries.cc'],
'action': [
'python',
- '../tools//js2c.py',
+ '../tools/js2c.py',
'<(SHARED_INTERMEDIATE_DIR)/libraries.cc',
'CORE',
'<@(library_files)',
],
},
- {
- 'action_name': 'js2c_bin',
- 'inputs': [
- '../tools//js2c.py',
- '<@(library_files)',
- ],
- 'outputs': ['<@(libraries_bin_file)'],
- 'action': [
- 'python',
- '../tools//js2c.py',
- '<(SHARED_INTERMEDIATE_DIR)/libraries.cc',
- 'CORE',
- '<@(library_files)',
- '--startup_blob', '<@(libraries_bin_file)',
- '--nojs',
- ],
- },
- {
+ {
'action_name': 'js2c_extras',
'inputs': [
- '../tools//js2c.py',
+ '../tools/js2c.py',
'<@(v8_extra_library_files)',
],
'outputs': ['<(SHARED_INTERMEDIATE_DIR)/extras-libraries.cc'],
'action': [
'python',
- '../tools//js2c.py',
- '<(SHARED_INTERMEDIATE_DIR)/extras-libraries.cc',
- 'EXTRAS',
- '<@(v8_extra_library_files)',
- ],
- },
- {
- 'action_name': 'js2c_extras_bin',
- 'inputs': [
- '../tools//js2c.py',
- '<@(v8_extra_library_files)',
- ],
- 'outputs': ['<@(libraries_extras_bin_file)'],
- 'action': [
- 'python',
- '../tools//js2c.py',
+ '../tools/js2c.py',
'<(SHARED_INTERMEDIATE_DIR)/extras-libraries.cc',
'EXTRAS',
'<@(v8_extra_library_files)',
- '--startup_blob', '<@(libraries_extras_bin_file)',
- '--nojs',
],
},
{
'action_name': 'js2c_experimental_extras',
'inputs': [
- '../tools//js2c.py',
+ '../tools/js2c.py',
'<@(v8_experimental_extra_library_files)',
],
'outputs': [
@@ -2495,31 +2434,14 @@
],
'action': [
'python',
- '../tools//js2c.py',
+ '../tools/js2c.py',
'<(SHARED_INTERMEDIATE_DIR)/experimental-extras-libraries.cc',
'EXPERIMENTAL_EXTRAS',
'<@(v8_experimental_extra_library_files)',
],
},
- {
- 'action_name': 'js2c_experimental_extras_bin',
- 'inputs': [
- '../tools//js2c.py',
- '<@(v8_experimental_extra_library_files)',
- ],
- 'outputs': ['<@(libraries_experimental_extras_bin_file)'],
- 'action': [
- 'python',
- '../tools//js2c.py',
- '<(SHARED_INTERMEDIATE_DIR)/experimental-extras-libraries.cc',
- 'EXPERIMENTAL_EXTRAS',
- '<@(v8_experimental_extra_library_files)',
- '--startup_blob', '<@(libraries_experimental_extras_bin_file)',
- '--nojs',
- ],
- },
],
- },
+ }, # js2c
{
'target_name': 'torque',
'type': 'executable',
@@ -2896,7 +2818,7 @@
'../third_party/antlr4/runtime/Cpp/runtime/src/tree/xpath/XPathWildcardElement.cpp',
'../third_party/antlr4/runtime/Cpp/runtime/src/tree/xpath/XPathWildcardElement.h',
],
- },
+ }, # torque_base
{
'target_name': 'v8_torque',
'type': 'none',
@@ -2926,7 +2848,7 @@
'action': ['<@(_inputs)', '-o', '<(SHARED_INTERMEDIATE_DIR)/torque-generated'],
},
],
- },
+ }, # torque
{
'target_name': 'postmortem-metadata',
'type': 'none',
@@ -2948,6 +2870,8 @@
'../src/objects/js-regexp-string-iterator.h',
'../src/objects/map.h',
'../src/objects/map-inl.h',
+ '../src/objects/name.h',
+ '../src/objects/name-inl.h',
'../src/objects/scope-info.h',
'../src/objects/script.h',
'../src/objects/script-inl.h',
@@ -2958,24 +2882,24 @@
],
},
'actions': [
- {
- 'action_name': 'gen-postmortem-metadata',
- 'inputs': [
- '../tools//gen-postmortem-metadata.py',
- '<@(heapobject_files)',
- ],
- 'outputs': [
- '<(SHARED_INTERMEDIATE_DIR)/debug-support.cc',
- ],
- 'action': [
- 'python',
- '../tools//gen-postmortem-metadata.py',
- '<@(_outputs)',
- '<@(heapobject_files)'
- ]
- }
- ]
- },
+ {
+ 'action_name': 'gen-postmortem-metadata',
+ 'inputs': [
+ '../tools/gen-postmortem-metadata.py',
+ '<@(heapobject_files)',
+ ],
+ 'outputs': [
+ '<(SHARED_INTERMEDIATE_DIR)/debug-support.cc',
+ ],
+ 'action': [
+ 'python',
+ '../tools/gen-postmortem-metadata.py',
+ '<@(_outputs)',
+ '<@(heapobject_files)'
+ ],
+ },
+ ],
+ }, # postmortem-metadata
{
'target_name': 'mksnapshot',
'type': 'executable',
@@ -2986,7 +2910,7 @@
'v8_libplatform',
'v8_nosnapshot',
],
- 'include_dirs+': [
+ 'include_dirs': [
'..',
'<(DEPTH)',
],
@@ -3006,53 +2930,9 @@
'toolsets': ['target'],
}],
],
- },
+ }, # mksnapshot
{
- 'target_name': 'v8_dump_build_config',
- 'type': 'none',
- 'variables': {
- },
- 'actions': [
- {
- 'action_name': 'v8_dump_build_config',
- 'inputs': [
- '../tools//testrunner/utils/dump_build_config_gyp.py',
- ],
- 'outputs': [
- '<(PRODUCT_DIR)/v8_build_config.json',
- ],
- 'action': [
- 'python',
- '../tools//testrunner/utils/dump_build_config_gyp.py',
- '<(PRODUCT_DIR)/v8_build_config.json',
- 'dcheck_always_on=<(dcheck_always_on)',
- 'is_asan=<(asan)',
- 'is_cfi=<(cfi_vptr)',
- 'is_component_build=<(component)',
- 'is_debug=<(CONFIGURATION_NAME)',
- # Not available in gyp.
- 'is_gcov_coverage=0',
- 'is_msan=<(msan)',
- 'is_tsan=<(tsan)',
- # Not available in gyp.
- 'is_ubsan_vptr=0',
- 'target_cpu=<(target_arch)',
- 'v8_enable_i18n_support=<(v8_enable_i18n_support)',
- 'v8_enable_verify_predictable=<(v8_enable_verify_predictable)',
- 'v8_target_cpu=<(v8_target_arch)',
- 'v8_use_snapshot=<(v8_use_snapshot)',
- ],
- 'conditions': [
- ['v8_target_arch=="mips" or v8_target_arch=="mipsel" \
- or v8_target_arch=="mips64" or v8_target_arch=="mips64el"', {
- 'action':[
- 'mips_arch_variant=<(mips_arch_variant)',
- 'mips_use_msa=<(mips_use_msa)',
- ],
- }],
- ],
- },
- ],
- },
+ 'includes': [ 'v8_external_snapshot.gypi' ],
+ }, # v8_external_snapshot
],
}
diff --git a/deps/v8/gypfiles/v8_external_snapshot.gypi b/deps/v8/gypfiles/v8_external_snapshot.gypi
new file mode 100644
index 00000000000000..47fc911bae675c
--- /dev/null
+++ b/deps/v8/gypfiles/v8_external_snapshot.gypi
@@ -0,0 +1,119 @@
+# Keeping this separate since Node.js does use it
+{
+ 'target_name': 'v8_external_snapshot',
+ 'type': 'static_library',
+ 'conditions': [
+ [ 'v8_use_external_startup_data==1', {
+ 'conditions': [
+ ['want_separate_host_toolset==1', {
+ 'toolsets': ['host', 'target'],
+ 'dependencies': [
+ 'mksnapshot#host',
+ 'js2c#host',
+ 'natives_blob',
+ ]}, {
+ 'toolsets': ['target'],
+ 'dependencies': [
+ 'mksnapshot',
+ 'js2c',
+ 'natives_blob',
+ ],
+ }],
+ ['component=="shared_library"', {
+ 'defines': [
+ 'BUILDING_V8_SHARED',
+ ],
+ 'direct_dependent_settings': {
+ 'defines': [
+ 'USING_V8_SHARED',
+ ],
+ },
+ }],
+ ],
+ 'dependencies': [
+ 'v8_base',
+ ],
+ 'include_dirs+': [
+ '..',
+ '<(DEPTH)',
+ ],
+ 'sources': [
+ '../src/setup-isolate-deserialize.cc',
+ '../src/snapshot/natives-external.cc',
+ '../src/snapshot/snapshot-external.cc',
+ ],
+ 'actions': [
+ {
+ 'action_name': 'run_mksnapshot (external)',
+ 'inputs': [
+ '<(mksnapshot_exec)',
+ ],
+ 'variables': {
+ 'mksnapshot_flags': [],
+ 'conditions': [
+ ['v8_random_seed!=0', {
+ 'mksnapshot_flags': ['--random-seed', '<(v8_random_seed)'],
+ }],
+ ['v8_vector_stores!=0', {
+ 'mksnapshot_flags': ['--vector-stores'],
+ }],
+ ['v8_os_page_size!=0', {
+ 'mksnapshot_flags': ['--v8_os_page_size', '<(v8_os_page_size)'],
+ }],
+ ],
+ },
+ 'conditions': [
+ ['embed_script!=""', {
+ 'inputs': [
+ '<(embed_script)',
+ ],
+ }],
+ ['warmup_script!=""', {
+ 'inputs': [
+ '<(warmup_script)',
+ ],
+ }],
+ ['want_separate_host_toolset==1', {
+ 'target_conditions': [
+ ['_toolset=="host"', {
+ 'outputs': [
+ '<(PRODUCT_DIR)/snapshot_blob_host.bin',
+ ],
+ 'action': [
+ '<(mksnapshot_exec)',
+ '<@(mksnapshot_flags)',
+ '--startup_blob', '<(PRODUCT_DIR)/snapshot_blob_host.bin',
+ '<(embed_script)',
+ '<(warmup_script)',
+ ],
+ }, {
+ 'outputs': [
+ '<(PRODUCT_DIR)/snapshot_blob.bin',
+ ],
+ 'action': [
+ '<(mksnapshot_exec)',
+ '<@(mksnapshot_flags)',
+ '--startup_blob', '<(PRODUCT_DIR)/snapshot_blob.bin',
+ '<(embed_script)',
+ '<(warmup_script)',
+ ],
+ }],
+ ],
+ }, {
+ 'outputs': [
+ '<(PRODUCT_DIR)/snapshot_blob.bin',
+ ],
+ 'action': [
+ '<(mksnapshot_exec)',
+ '<@(mksnapshot_flags)',
+ '--startup_blob', '<(PRODUCT_DIR)/snapshot_blob.bin',
+ '<(embed_script)',
+ '<(warmup_script)',
+ ],
+ }],
+ ],
+ },
+ ],
+ }],
+ ],
+}
diff --git a/deps/v8/include/libplatform/libplatform.h b/deps/v8/include/libplatform/libplatform.h
index 2c830bf834b786..d001514f9883be 100644
--- a/deps/v8/include/libplatform/libplatform.h
+++ b/deps/v8/include/libplatform/libplatform.h
@@ -41,7 +41,7 @@ V8_PLATFORM_EXPORT std::unique_ptr NewDefaultPlatform(
InProcessStackDumping::kDisabled,
std::unique_ptr tracing_controller = {});
-V8_PLATFORM_EXPORT V8_DEPRECATE_SOON(
+V8_PLATFORM_EXPORT V8_DEPRECATED(
"Use NewDefaultPlatform instead",
v8::Platform* CreateDefaultPlatform(
int thread_pool_size = 0,
diff --git a/deps/v8/include/v8-inspector.h b/deps/v8/include/v8-inspector.h
index 6de8234fb83bcf..cb5ceff037b131 100644
--- a/deps/v8/include/v8-inspector.h
+++ b/deps/v8/include/v8-inspector.h
@@ -214,6 +214,11 @@ class V8_EXPORT V8InspectorClient {
virtual bool canExecuteScripts(int contextGroupId) { return true; }
virtual void maxAsyncCallStackDepthChanged(int depth) {}
+
+ virtual std::unique_ptr resourceNameToUrl(
+ const StringView& resourceName) {
+ return nullptr;
+ }
};
// These stack trace ids are intended to be passed between debuggers and be
diff --git a/deps/v8/include/v8.h b/deps/v8/include/v8.h
index 05ab9b05210ab4..55ad7c8cf220cc 100644
--- a/deps/v8/include/v8.h
+++ b/deps/v8/include/v8.h
@@ -1019,8 +1019,12 @@ class V8_EXPORT PrimitiveArray {
public:
static Local New(Isolate* isolate, int length);
int Length() const;
- void Set(int index, Local item);
- Local Get(int index);
+ V8_DEPRECATED("Use Isolate* version",
+ void Set(int index, Local item));
+ V8_DEPRECATED("Use Isolate* version",
+ Local Get(int index));
+ void Set(Isolate* isolate, int index, Local item);
+ Local Get(Isolate* isolate, int index);
};
/**
@@ -1735,8 +1739,8 @@ class V8_EXPORT StackTrace {
/**
* Returns a StackFrame at a particular index.
*/
- V8_DEPRECATE_SOON("Use Isolate version",
- Local GetFrame(uint32_t index) const);
+ V8_DEPRECATED("Use Isolate version",
+ Local GetFrame(uint32_t index) const);
Local GetFrame(Isolate* isolate, uint32_t index) const;
/**
@@ -2432,25 +2436,25 @@ class V8_EXPORT Value : public Data {
Local context) const;
V8_WARN_UNUSED_RESULT MaybeLocal ToInt32(Local context) const;
- V8_DEPRECATE_SOON("Use maybe version",
- Local ToBoolean(Isolate* isolate) const);
- V8_DEPRECATE_SOON("Use maybe version",
- Local ToNumber(Isolate* isolate) const);
- V8_DEPRECATE_SOON("Use maybe version",
- Local ToString(Isolate* isolate) const);
- V8_DEPRECATE_SOON("Use maybe version",
- Local