diff --git a/.eslintignore b/.eslintignore
index 80959ce611ee58..bdfdfaeab2388d 100644
--- a/.eslintignore
+++ b/.eslintignore
@@ -1,9 +1,7 @@
node_modules
-lib/internal/v8.js
lib/internal/v8_prof_polyfill.js
lib/punycode.js
test/addons/??_*
-test/es-module/test-esm-dynamic-import.js
test/fixtures
test/message/esm_display_syntax_error.mjs
tools/icu
diff --git a/.eslintrc.js b/.eslintrc.js
index e504e085eb387f..ab0baf1c85dfca 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -17,7 +17,10 @@ Module._findPath = (request, paths, isMain) => {
if (!r && hacks.includes(request)) {
try {
return require.resolve(`./tools/node_modules/${request}`);
- } catch {
+ // Keep the variable in place to ensure that ESLint started by older Node.js
+ // versions work as expected.
+ // eslint-disable-next-line no-unused-vars
+ } catch (e) {
return require.resolve(
`./tools/node_modules/eslint/node_modules/${request}`);
}
@@ -220,6 +223,7 @@ module.exports = {
}],
'no-useless-call': 'error',
'no-useless-concat': 'error',
+ 'no-useless-constructor': 'error',
'no-useless-escape': 'error',
'no-useless-return': 'error',
'no-void': 'error',
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 845b38f657e45b..b1a68ab12dfbd7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -26,7 +26,8 @@ release.
-10.15.2
+10.15.3
+10.15.2 10.15.1 10.15.0 10.14.2
diff --git a/COLLABORATOR_GUIDE.md b/COLLABORATOR_GUIDE.md
index 0be47023ea7263..2d45f25c6ab219 100644
--- a/COLLABORATOR_GUIDE.md
+++ b/COLLABORATOR_GUIDE.md
@@ -72,61 +72,48 @@ issues and pull requests can always be re-opened if necessary.
A pull request is _author ready_ when:
* There is a CI run in progress or completed.
-* There are at least two Collaborator approvals, or at least one approval if the
- pull request is older than 7 days.
+* There is at least one Collaborator approval.
* There are no outstanding review comments.
-Please always add the `author ready` label to the PR in that case. Please always
-remove it again as soon as the conditions are not met anymore.
+Please always add the `author ready` label to the pull request in that case.
+Please always remove it again as soon as the conditions are not met anymore.
### Handling own pull requests
-When you open a pull request, it is recommended to start a CI right away (see
-[testing and CI](#testing-and-ci) for instructions) and to post the link to it
-in a comment in the pull request. Starting a new CI after each update is also
-recommended (for example, after an additional code change or after rebasing).
+When you open a pull request, [start a CI](#testing-and-ci) right away and post
+the link to it in a comment in the pull request. Later, after new code changes
+or rebasing, start a new CI.
-As soon as the PR is ready to land, please do so. Landing your own pull requests
-allows other Collaborators to focus on other pull requests. If your pull request
-is still awaiting the [minimum time to land](#waiting-for-approvals), add the
-`author ready` label so other Collaborators know it can land as soon as the time
-ends. If instead you wish to land the PR yourself, indicate this intent by using
-the "assign yourself" button, to self-assign the PR.
+As soon as the pull request is ready to land, please do so. This allows other
+Collaborators to focus on other pull requests. If your pull request is not ready
+to land but is [author ready](#author-ready-pull-requests), add the
+`author ready` label. If you wish to land the pull request yourself, use the
+"assign yourself" link to self-assign it.
## Accepting Modifications
-All modifications to the Node.js code and documentation should be performed via
-GitHub pull requests, including modifications by Collaborators and TSC members.
-A pull request must be reviewed, and must also be tested with CI, before being
-landed into the codebase. There may be exceptions to the latter (the changed
-code cannot be tested with a CI or similar). If that is the case, please leave a
-comment that explains why the PR does not require a CI run.
+Contributors propose modifications to Node.js using GitHub pull requests. This
+includes modifications proposed by TSC members and other Collaborators. A pull
+request must pass code review and CI before landing into the codebase.
### Code Reviews
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.
+lands. One Collaborator approval is enough if the pull request has been open
+for more than seven 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.
See [Who to CC in the issue tracker](#who-to-cc-in-the-issue-tracker).
-If you are unsure about the modification and are not prepared to take
-full responsibility for the change, defer to another Collaborator.
-
If you are the first Collaborator to approve a pull request that has no CI yet,
-please start one (see [testing and CI](#testing-and-ci) for further information
-on how to do that) and post the link to the CI in the PR. Please also start a
-new CI in case the PR creator pushed new code since the last CI run (due to
-e.g., an addressed review comment or a rebase).
-
-In case there are already enough approvals (`LGTM`), a CI run, and the PR is
-open longer than the minimum waiting time without any open comments, please do
-not (only) add another approval. Instead go ahead and land the PR after checking
-the CI outcome.
+please [start one](#testing-and-ci). Post the link to the CI in the PR. Please
+also start a new CI if the PR creator pushed new code since the last CI run.
### Consensus Seeking
@@ -153,61 +140,60 @@ the TSC meeting agenda.
#### Helpful resources
-* How to respectfully and usefully review code, part [one](https://mtlynch.io/human-code-reviews-1/) and [two](https://mtlynch.io/human-code-reviews-2/)
-* [How to write a positive code review](https://css-tricks.com/code-review-etiquette/)
+* [How to Do Code Reviews Like a Human (Part One)](https://mtlynch.io/human-code-reviews-1/)
+* [How to Do Code Reviews Like a Human (Part Two)](https://mtlynch.io/human-code-reviews-2/)
+* [Code Review Etiquette](https://css-tricks.com/code-review-etiquette/)
### Waiting for Approvals
-Before landing pull requests, sufficient time should be left for input
-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:
+Before landing pull requests, allow 48 hours for input from other Collaborators.
+Certain types of pull requests can be fast-tracked and may land 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.
+ * `code-and-learn` tasks often fall into this category.
* `good-first-issue` pull requests may also be suitable.
* Changes that fix regressions:
* Regressions that break the workflow (red CI or broken compilation).
* 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` 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. A request to
-fast-track a PR made by a different Collaborator than the pull-request author
-counts as a fast-track approval.
+To propose fast-tracking a pull request, apply the `fast-track` label. Then add
+a comment that Collaborators may upvote.
+
+If someone disagrees with the fast-tracking request, remove the label. Do not
+fast-track the pull request in that case.
+
+The pull request may be fast-tracked if two Collaborators approve the
+fast-tracking request. To land, the pull request itself still needs two
+Collaborator approvals and a passing CI.
+
+Collaborators may request fast-tracking of pull requests they did not author.
+In that case only, the request itself is also one fast-track approval. Upvote
+the comment anyway to avoid any doubt.
### Testing and CI
-All bugfixes require a test case which demonstrates the defect. The
-test should *fail* before the change, and *pass* after the change.
+All fixes must have a test case which demonstrates the defect. The test should
+fail before the change, and pass after the change.
-All pull requests that modify executable code should also include a test case
-and must be subjected to continuous integration tests on the
-[project CI server](https://ci.nodejs.org/). The pull request should have a CI
-status indicator.
+All pull requests must pass continuous integration tests on the
+[project CI server](https://ci.nodejs.org/).
-Do not land any Pull Requests without passing (green or yellow) CI runs. If you
-believe any failed (red or grey) CI sub-tasks are unrelated to the change in the
-Pull Request, use "Resume Build" in the left navigation of the relevant
-`node-test-pull-request` job. It will create a new `node-test-pull-request` run
-that preserves all the green results from the current job but re-runs everything
-else.
+Do not land any pull requests without passing (green or yellow) CI runs. If
+there are CI failures unrelated to the change in the pull request, try "Resume
+Build". It is in the left navigation of the relevant `node-test-pull-request`
+job. It will preserve all the green results from the current job but re-run
+everything else.
#### Useful CI Jobs
* [`node-test-pull-request`](https://ci.nodejs.org/job/node-test-pull-request/)
-is the standard CI run we do to check Pull Requests. It triggers
-`node-test-commit`, which runs the `build-ci` and `test-ci` targets on all
-supported platforms.
+is the CI job to test pull requests. It runs the `build-ci` and `test-ci`
+targets on all supported platforms.
* [`node-test-pull-request-lite-pipeline`](https://ci.nodejs.org/job/node-test-pull-request-lite-pipeline/)
-only runs the linter job, as well as the tests on LinuxONE, which is very fast.
-This is useful for changes that only affect comments or documentation.
+runs the linter job. It also runs the tests on a very fast host. This is useful
+for changes that only affect comments or documentation.
* [`citgm-smoker`](https://ci.nodejs.org/job/citgm-smoker/)
uses [`CitGM`](https://github.com/nodejs/citgm) to allow you to run
@@ -216,74 +202,48 @@ useful to check whether a change will cause breakage in the ecosystem. To test
Node.js ABI changes you can run [`citgm-abi-smoker`](https://ci.nodejs.org/job/citgm-abi-smoker/).
* [`node-stress-single-test`](https://ci.nodejs.org/job/node-stress-single-test/)
-is designed to allow one to run a group of tests over and over on a specific
-platform to confirm that the test is reliable.
+can run a group of tests over and over on a specific platform. Use it to check
+that the tests are reliable.
* [`node-test-commit-v8-linux`](https://ci.nodejs.org/job/node-test-commit-v8-linux/)
-is designed to allow validation of changes to the copy of V8 in the Node.js
-tree by running the standard V8 tests. It should be run whenever the
-level of V8 within Node.js is updated or new patches are floated on V8.
+runs the standard V8 tests. Run it when updating V8 in Node.js or floating new
+patches on V8.
* [`node-test-commit-custom-suites`](https://ci.nodejs.org/job/node-test-commit-custom-suites/)
-can be used to customize what tests are run and with what parameters. For
-example, it can be used to execute tests which are not executed in a typical
-`node-test-commit` run (such as tests in the `internet` or `pummel`
-directories). It can also be used to make sure tests pass when provided with a
-flag not typically used in other CI test runs (such as `--worker`).
+enables customization of test suites and parameters. It can execute test suites
+not used in other CI test runs (such as tests in the `internet` or `pummel`
+directories). It can also make sure tests pass when provided with a flag not
+used in other CI test runs (such as `--worker`).
### Internal vs. Public API
-Due to the nature of the JavaScript language, it can often be difficult to
-establish a clear distinction between which parts of the Node.js implementation
-represent the public API Node.js users should assume to be stable and which
-are part of the internal implementation details of Node.js itself. A rule of
-thumb is to base the determination off what functionality is actually
-documented in the official Node.js API documentation. However, it has been
-repeatedly demonstrated that either the documentation does not completely cover
-implemented behavior or that Node.js users have come to rely heavily on
-undocumented aspects of the Node.js implementation.
-
-The following general rules should be followed to determine which aspects of the
-Node.js API are internal:
-
-- All functionality exposed via `process.binding(...)` is internal.
-- All functionality implemented in `lib/internal/**/*.js` is internal unless it
- is re-exported by code in `lib/*.js` or documented as part of the Node.js
- Public API.
-- Any object property or method whose key is a non-exported `Symbol` is an
- internal property.
-- Any object property or method whose key begins with the underscore `_` prefix
- is internal unless it is documented as part of the Node.js Public API.
-- Any object, property, method, argument, behavior, or event not documented in
- the Node.js documentation is internal.
-- Any native C/C++ APIs/ABIs exported by the Node.js `*.h` header files that
- are hidden behind the `NODE_WANT_INTERNALS` flag are internal.
-
-Exceptions can be made if use or behavior of a given internal API can be
-demonstrated to be sufficiently relied upon by the Node.js ecosystem such that
-any changes would cause too much breakage. The threshold for what qualifies as
-too much breakage is to be decided on a case-by-case basis by the TSC.
-
-If it is determined that a currently undocumented object, property, method,
-argument, or event *should* be documented, then a pull request adding the
-documentation is required in order for it to be considered part of the public
-API.
-
-Making a determination about whether something *should* be documented can be
-difficult and will need to be handled on a case-by-case basis. For instance, if
-one documented API cannot be used successfully without the use of a second
-*currently undocumented* API, then the second API *should* be documented. If
-using an API in a manner currently undocumented achieves a particular useful
-result, a decision will need to be made whether or not that falls within the
-supported scope of that API; and if it does, it should be documented.
-
-See [Breaking Changes to Internal Elements](#breaking-changes-to-internal-elements)
-on how to handle those types of changes.
+All functionality in the official Node.js documentation is part of the public
+API. Any undocumented object, property, method, argument, behavior, or event is
+internal. There are exceptions to this rule. Node.js users have come to rely on
+some undocumented behaviors. Collaborators treat many of those undocumented
+behaviors as public.
+
+All undocumented functionality exposed via `process.binding(...)` is internal.
+
+All undocumented functionality in `lib/internal/**/*.js` is internal. It is
+public, though, if it is re-exported by code in `lib/*.js`.
+
+Non-exported `Symbol` properties and methods are internal.
+
+Any undocumented object property or method that begins with `_` is internal.
+
+Any native C/C++ APIs/ABIs requiring the `NODE_WANT_INTERNALS` flag are
+internal.
+
+Sometimes, there is disagreement about whether functionality is internal or
+public. In those cases, the TSC makes a determination.
+
+For undocumented APIs that are public, open a pull request documenting the API.
### Breaking Changes
-Backwards-incompatible changes may land on the master branch at any time after
-sufficient review by Collaborators and approval of at least two TSC members.
+At least two TSC members must approve backward-incompatible changes to the
+master branch.
Examples of breaking changes include:
@@ -294,11 +254,6 @@ Examples of breaking changes include:
* altering expected timing of an event
* changing the side effects of using a particular API
-Purely additive changes (e.g. adding new events to `EventEmitter`
-implementations, adding new arguments to a method in a way that allows
-existing code to continue working without modification, or adding new
-properties to an options argument) are semver-minor changes.
-
#### Breaking Changes and Deprecations
With a few exceptions outlined below, when backward-incompatible changes to a
diff --git a/CPP_STYLE_GUIDE.md b/CPP_STYLE_GUIDE.md
index 5099f34ea866c9..b82ed7cc190ec8 100644
--- a/CPP_STYLE_GUIDE.md
+++ b/CPP_STYLE_GUIDE.md
@@ -21,6 +21,7 @@
* [Use explicit pointer comparisons](#use-explicit-pointer-comparisons)
* [Ownership and Smart Pointers](#ownership-and-smart-pointers)
* [Avoid non-const references](#avoid-non-const-references)
+ * [Use AliasedBuffers to manipulate TypedArrays](#use-aliasedbuffers-to-manipulate-typedarrays)
* [Others](#others)
* [Type casting](#type-casting)
* [Using `auto`](#using-auto)
@@ -257,6 +258,21 @@ class ExampleClass {
};
```
+### Use AliasedBuffers to manipulate TypedArrays
+
+When working with typed arrays that involve direct data modification
+from C++, use an `AliasedBuffer` when possible. The API abstraction and
+the usage scope of `AliasedBuffer` are documented in [aliased_buffer.h][].
+
+```c++
+// Create an AliasedBuffer.
+AliasedBuffer data;
+...
+
+// Modify the data through natural operator semantics.
+data[0] = 12345;
+```
+
## Others
### Type casting
@@ -382,3 +398,4 @@ even `try` and `catch` **will** break.
[Run Time Type Information]: https://en.wikipedia.org/wiki/Run-time_type_information
[cppref_auto_ptr]: https://en.cppreference.com/w/cpp/memory/auto_ptr
[without C++ exception handling]: https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_exceptions.html#intro.using.exception.no
+[aliased_buffer.h]: https://github.com/nodejs/node/blob/master/src/aliased_buffer.h#L12
diff --git a/Makefile b/Makefile
index 3a343301d640bc..4e7263924cf19a 100644
--- a/Makefile
+++ b/Makefile
@@ -647,16 +647,16 @@ out/doc/api/assets/%: doc/api_assets/% out/doc/api/assets
run-npm-ci = $(PWD)/$(NPM) ci
+LINK_DATA = out/doc/apilinks.json
gen-api = tools/doc/generate.js --node-version=$(FULLVERSION) \
- --apilinks=out/apilinks.json $< --output-directory=out/doc/api
-gen-apilink = tools/doc/apilinks.js $(wildcard lib/*.js) > $@
+ --apilinks=$(LINK_DATA) $< --output-directory=out/doc/api
+gen-apilink = tools/doc/apilinks.js $(LINK_DATA) $(wildcard lib/*.js)
-out/apilinks.json: $(wildcard lib/*.js) tools/doc/apilinks.js
+$(LINK_DATA): $(wildcard lib/*.js) tools/doc/apilinks.js
$(call available-node, $(gen-apilink))
out/doc/api/%.json out/doc/api/%.html: doc/api/%.md tools/doc/generate.js \
- tools/doc/html.js tools/doc/json.js tools/doc/apilinks.js | \
- out/apilinks.json
+ tools/doc/html.js tools/doc/json.js tools/doc/apilinks.js | $(LINK_DATA)
$(call available-node, $(gen-api))
out/doc/api/all.html: $(apidocs_html) tools/doc/allhtml.js \
@@ -806,13 +806,29 @@ BINARYNAME=$(TARNAME)-$(PLATFORM)-$(ARCH)
endif
BINARYTAR=$(BINARYNAME).tar
# OSX doesn't have xz installed by default, http://macpkg.sourceforge.net/
-XZ=$(shell which xz > /dev/null 2>&1; echo $$?)
+HAS_XZ ?= $(shell which xz > /dev/null 2>&1; [ $$? -eq 0 ] && echo 1 || echo 0)
+# Supply SKIP_XZ=1 to explicitly skip .tar.xz creation
+SKIP_XZ ?= 0
+XZ = $(shell [ $(HAS_XZ) -eq 1 -a $(SKIP_XZ) -eq 0 ] && echo 1 || echo 0)
XZ_COMPRESSION ?= 9e
PKG=$(TARNAME).pkg
MACOSOUTDIR=out/macos
+ifeq ($(SKIP_XZ), 1)
+check-xz:
+ @echo "SKIP_XZ=1 supplied, skipping .tar.xz creation"
+else
+ifeq ($(HAS_XZ), 1)
+check-xz:
+else
+check-xz:
+ @echo "No xz command, cannot continue"
+ @exit 1
+endif
+endif
+
.PHONY: release-only
-release-only:
+release-only: check-xz
@if [ "$(DISTTYPE)" = "release" ] && `grep -q REPLACEME doc/api/*.md`; then \
echo 'Please update REPLACEME in Added: tags in doc/api/*.md (See doc/releases.md)' ; \
exit 1 ; \
@@ -938,7 +954,7 @@ $(TARBALL): release-only $(NODE_EXE) doc
tar -cf $(TARNAME).tar $(TARNAME)
$(RM) -r $(TARNAME)
gzip -c -f -9 $(TARNAME).tar > $(TARNAME).tar.gz
-ifeq ($(XZ), 0)
+ifeq ($(XZ), 1)
xz -c -f -$(XZ_COMPRESSION) $(TARNAME).tar > $(TARNAME).tar.xz
endif
$(RM) $(TARNAME).tar
@@ -952,7 +968,7 @@ tar-upload: tar
chmod 664 $(TARNAME).tar.gz
scp -p $(TARNAME).tar.gz $(STAGINGSERVER):nodejs/$(DISTTYPEDIR)/$(FULLVERSION)/$(TARNAME).tar.gz
ssh $(STAGINGSERVER) "touch nodejs/$(DISTTYPEDIR)/$(FULLVERSION)/$(TARNAME).tar.gz.done"
-ifeq ($(XZ), 0)
+ifeq ($(XZ), 1)
chmod 664 $(TARNAME).tar.xz
scp -p $(TARNAME).tar.xz $(STAGINGSERVER):nodejs/$(DISTTYPEDIR)/$(FULLVERSION)/$(TARNAME).tar.xz
ssh $(STAGINGSERVER) "touch nodejs/$(DISTTYPEDIR)/$(FULLVERSION)/$(TARNAME).tar.xz.done"
@@ -978,7 +994,7 @@ $(TARBALL)-headers: release-only
tar -cf $(TARNAME)-headers.tar $(TARNAME)
$(RM) -r $(TARNAME)
gzip -c -f -9 $(TARNAME)-headers.tar > $(TARNAME)-headers.tar.gz
-ifeq ($(XZ), 0)
+ifeq ($(XZ), 1)
xz -c -f -$(XZ_COMPRESSION) $(TARNAME)-headers.tar > $(TARNAME)-headers.tar.xz
endif
$(RM) $(TARNAME)-headers.tar
@@ -990,7 +1006,7 @@ tar-headers-upload: tar-headers
chmod 664 $(TARNAME)-headers.tar.gz
scp -p $(TARNAME)-headers.tar.gz $(STAGINGSERVER):nodejs/$(DISTTYPEDIR)/$(FULLVERSION)/$(TARNAME)-headers.tar.gz
ssh $(STAGINGSERVER) "touch nodejs/$(DISTTYPEDIR)/$(FULLVERSION)/$(TARNAME)-headers.tar.gz.done"
-ifeq ($(XZ), 0)
+ifeq ($(XZ), 1)
chmod 664 $(TARNAME)-headers.tar.xz
scp -p $(TARNAME)-headers.tar.xz $(STAGINGSERVER):nodejs/$(DISTTYPEDIR)/$(FULLVERSION)/$(TARNAME)-headers.tar.xz
ssh $(STAGINGSERVER) "touch nodejs/$(DISTTYPEDIR)/$(FULLVERSION)/$(TARNAME)-headers.tar.xz.done"
@@ -1015,7 +1031,7 @@ endif
tar -cf $(BINARYNAME).tar $(BINARYNAME)
$(RM) -r $(BINARYNAME)
gzip -c -f -9 $(BINARYNAME).tar > $(BINARYNAME).tar.gz
-ifeq ($(XZ), 0)
+ifeq ($(XZ), 1)
xz -c -f -$(XZ_COMPRESSION) $(BINARYNAME).tar > $(BINARYNAME).tar.xz
endif
$(RM) $(BINARYNAME).tar
@@ -1030,7 +1046,7 @@ binary-upload: binary
chmod 664 $(TARNAME)-$(OSTYPE)-$(ARCH).tar.gz
scp -p $(TARNAME)-$(OSTYPE)-$(ARCH).tar.gz $(STAGINGSERVER):nodejs/$(DISTTYPEDIR)/$(FULLVERSION)/$(TARNAME)-$(OSTYPE)-$(ARCH).tar.gz
ssh $(STAGINGSERVER) "touch nodejs/$(DISTTYPEDIR)/$(FULLVERSION)/$(TARNAME)-$(OSTYPE)-$(ARCH).tar.gz.done"
-ifeq ($(XZ), 0)
+ifeq ($(XZ), 1)
chmod 664 $(TARNAME)-$(OSTYPE)-$(ARCH).tar.xz
scp -p $(TARNAME)-$(OSTYPE)-$(ARCH).tar.xz $(STAGINGSERVER):nodejs/$(DISTTYPEDIR)/$(FULLVERSION)/$(TARNAME)-$(OSTYPE)-$(ARCH).tar.xz
ssh $(STAGINGSERVER) "touch nodejs/$(DISTTYPEDIR)/$(FULLVERSION)/$(TARNAME)-$(OSTYPE)-$(ARCH).tar.xz.done"
@@ -1079,7 +1095,7 @@ tools/.docmdlintstamp: $(LINT_MD_DOC_FILES)
LINT_MD_TARGETS = src lib benchmark test tools/doc tools/icu
LINT_MD_ROOT_DOCS := $(wildcard *.md)
LINT_MD_MISC_FILES := $(shell find $(LINT_MD_TARGETS) -type f \
- -not -path '*node_modules*' -not -path 'test/fixtures/*' -name '*.md') \
+ ! -path '*node_modules*' ! -path 'test/fixtures/*' -name '*.md') \
$(LINT_MD_ROOT_DOCS)
run-lint-misc-md = tools/lint-md.js -q -f $(LINT_MD_MISC_FILES)
# Lint other changed markdown files maintained by us
@@ -1200,10 +1216,14 @@ tools/.cpplintstamp: $(LINT_CPP_FILES)
@$(PYTHON) tools/check-imports.py
@touch $@
-lint-addon-docs: test/addons/.docbuildstamp
+.PHONY: lint-addon-docs
+lint-addon-docs: tools/.doclintstamp
+
+tools/.doclintstamp: test/addons/.docbuildstamp
@echo "Running C++ linter on addon docs..."
@$(PYTHON) tools/cpplint.py $(CPPLINT_QUIET) --filter=$(ADDON_DOC_LINT_FLAGS) \
$(LINT_CPP_ADDON_DOC_FILES_GLOB)
+ @touch $@
cpplint: lint-cpp
@echo "Please use lint-cpp instead of cpplint"
@@ -1223,7 +1243,7 @@ ifneq ("","$(wildcard tools/pip/site-packages)")
lint-py:
PYTHONPATH=tools/pip $(PYTHON) -m flake8 . \
--count --show-source --statistics --select=E901,E999,F821,F822,F823 \
- --exclude=deps,lib,src,tools/*_macros.py,tools/gyp,tools/jinja2,tools/pip
+ --exclude=.git,deps,lib,src,tools/*_macros.py,tools/gyp,tools/inspector_protocol,tools/jinja2,tools/markupsafe,tools/pip
else
lint-py:
@echo "Python linting with flake8 is not avalible"
diff --git a/README.md b/README.md
index 71da2e4b59ff80..3e2d61ecd882b5 100644
--- a/README.md
+++ b/README.md
@@ -50,11 +50,10 @@ 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
- information.
+* [#node.js channel on chat.freenode.net][]
* [Node.js Discord Community](https://discordapp.com/invite/v7rrPdE)
-* [Node.js Slack Community](https://node-js.slack.com/): Visit
- [nodeslackers.com](http://www.nodeslackers.com/) to register.
+* [Node.js Slack Community](https://node-js.slack.com/)
+ * To register: [nodeslackers.com](http://www.nodeslackers.com/)
GitHub issues are for tracking enhancements and bugs, not general support.
@@ -83,7 +82,7 @@ your expectations.
Current and LTS releases follow [Semantic Versioning](https://semver.org). A
member of the Release Team [signs](#release-keys) each Current and LTS release.
For more information, see the
-[Release README](https://github.com/nodejs/Release).
+[Release README](https://github.com/nodejs/Release#readme).
### Download
@@ -249,6 +248,8 @@ For information about the governance of the Node.js project, see
**Andreas Madsen** <amwebdk@gmail.com> (he/him)
* [AnnaMag](https://github.com/AnnaMag) -
**Anna M. Kedzierska** <anna.m.kedzierska@gmail.com>
+* [antsmartian](https://github.com/antsmartian) -
+**Anto Aravinth** <anto.aravinth.cse@gmail.com> (he/him)
* [apapirovski](https://github.com/apapirovski) -
**Anatoli Papirovski** <apapirovski@mac.com> (he/him)
* [aqrln](https://github.com/aqrln) -
@@ -550,11 +551,14 @@ GPG keys used to sign Node.js releases:
`DD8F2338BAE7501E3DD5AC78C273792F7D83545D`
* **Ruben Bridgewater** <ruben@bridgewater.de>
`A48C2BEE680E841632CD4E44F07496B3EB3C1762`
+* **Shelley Vohr** <shelley.vohr@gmail.com>
+`B9E2F5981AA6E0CD28160D9FF13993A75599653C`
To import the full set of trusted release keys:
```shell
gpg --keyserver pool.sks-keyservers.net --recv-keys 4ED778F539E3634C779C87C6D7062848A1AB005C
+gpg --keyserver pool.sks-keyservers.net --recv-keys B9E2F5981AA6E0CD28160D9FF13993A75599653C
gpg --keyserver pool.sks-keyservers.net --recv-keys 94AE36675C464D64BAFA68DD7434390BDBE9B9C5
gpg --keyserver pool.sks-keyservers.net --recv-keys B9AE9905FFD7803F25714661B63B535A4C206CA9
gpg --keyserver pool.sks-keyservers.net --recv-keys 77984A986EBC2AA786BC0F66B01FBB92821C587A
diff --git a/common.gypi b/common.gypi
index 0a4ed881a5b925..4c643398ac222b 100644
--- a/common.gypi
+++ b/common.gypi
@@ -33,7 +33,7 @@
# Reset this number to 0 on major V8 upgrades.
# Increment by one for each non-official patch applied to deps/v8.
- 'v8_embedder_string': '-node.12',
+ 'v8_embedder_string': '-node.51',
# Enable disassembler for `--print-code` v8 options
'v8_enable_disassembler': 1,
@@ -117,6 +117,17 @@
'cflags': [ '-gxcoff' ],
'ldflags': [ '-Wl,-bbigtoc' ],
'conditions': [
+ ['target_arch=="ppc64"', {
+ 'ldflags': [
+ '-Wl,-blibpath:/usr/lib:/lib:'
+ '/opt/freeware/lib/pthread/ppc64'
+ ],
+ }],
+ ['target_arch=="ppc"', {
+ 'ldflags': [
+ '-Wl,-blibpath:/usr/lib:/lib:/opt/freeware/lib/pthread'
+ ],
+ }],
['"<(real_os_name)"=="OS400"', {
'ldflags': [
'-Wl,-blibpath:/QOpenSys/pkgs/lib:/QOpenSys/usr/lib',
@@ -421,11 +432,18 @@
'variables': {'real_os_name': ' debug::WeakMap::Get(v8::Local context,
+ v8::Local key) {
+ PREPARE_FOR_EXECUTION(context, WeakMap, Get, Value);
+ auto self = Utils::OpenHandle(this);
+ Local result;
+ i::Handle argv[] = {Utils::OpenHandle(*key)};
+ has_pending_exception =
+ !ToLocal(i::Execution::Call(isolate, isolate->weakmap_get(), self,
+ arraysize(argv), argv),
+ &result);
+ RETURN_ON_FAILED_EXECUTION(Value);
+ RETURN_ESCAPED(result);
+}
+
+v8::MaybeLocal debug::WeakMap::Set(
+ v8::Local context, v8::Local key,
+ v8::Local value) {
+ PREPARE_FOR_EXECUTION(context, WeakMap, Set, WeakMap);
+ auto self = Utils::OpenHandle(this);
+ i::Handle result;
+ i::Handle argv[] = {Utils::OpenHandle(*key),
+ Utils::OpenHandle(*value)};
+ has_pending_exception = !i::Execution::Call(isolate, isolate->weakmap_set(),
+ self, arraysize(argv), argv)
+ .ToHandle(&result);
+ RETURN_ON_FAILED_EXECUTION(WeakMap);
+ RETURN_ESCAPED(Local::Cast(Utils::ToLocal(result)));
+}
+
+Local debug::WeakMap::New(v8::Isolate* isolate) {
+ i::Isolate* i_isolate = reinterpret_cast(isolate);
+ LOG_API(i_isolate, WeakMap, New);
+ ENTER_V8_NO_SCRIPT_NO_EXCEPTION(i_isolate);
+ i::Handle obj = i_isolate->factory()->NewJSWeakMap();
+ return ToApiHandle(obj);
+}
+
+debug::WeakMap* debug::WeakMap::Cast(v8::Value* value) {
+ return static_cast(value);
+}
+
const char* CpuProfileNode::GetFunctionNameStr() const {
const i::ProfileNode* node = reinterpret_cast(this);
return node->entry()->name();
diff --git a/deps/v8/src/api.h b/deps/v8/src/api.h
index 342ab855ac011c..8df1a1539b8a44 100644
--- a/deps/v8/src/api.h
+++ b/deps/v8/src/api.h
@@ -124,6 +124,7 @@ class RegisteredExtension {
V(Proxy, JSProxy) \
V(debug::GeneratorObject, JSGeneratorObject) \
V(debug::Script, Script) \
+ V(debug::WeakMap, JSWeakMap) \
V(Promise, JSPromise) \
V(Primitive, Object) \
V(PrimitiveArray, FixedArray) \
diff --git a/deps/v8/src/bootstrapper.cc b/deps/v8/src/bootstrapper.cc
index 548ef5109a9a68..f0cd00a62c2491 100644
--- a/deps/v8/src/bootstrapper.cc
+++ b/deps/v8/src/bootstrapper.cc
@@ -3250,7 +3250,9 @@ void Genesis::InitializeGlobal(Handle global_object,
SimpleInstallFunction(prototype, "delete",
Builtins::kWeakMapPrototypeDelete, 1, true);
- SimpleInstallFunction(prototype, "get", Builtins::kWeakMapGet, 1, true);
+ Handle weakmap_get = SimpleInstallFunction(prototype, "get",
+ Builtins::kWeakMapGet, 1, true);
+ native_context()->set_weakmap_get(*weakmap_get);
SimpleInstallFunction(prototype, "has", Builtins::kWeakMapHas, 1, true);
Handle weakmap_set = SimpleInstallFunction(
prototype, "set", Builtins::kWeakMapPrototypeSet, 2, true);
diff --git a/deps/v8/src/contexts.h b/deps/v8/src/contexts.h
index b66bb94a4b41ec..af75fa7243264e 100644
--- a/deps/v8/src/contexts.h
+++ b/deps/v8/src/contexts.h
@@ -108,6 +108,7 @@ enum ContextLookupFlags {
V(WASM_RUNTIME_ERROR_FUNCTION_INDEX, JSFunction, \
wasm_runtime_error_function) \
V(WEAKMAP_SET_INDEX, JSFunction, weakmap_set) \
+ V(WEAKMAP_GET_INDEX, JSFunction, weakmap_get) \
V(WEAKSET_ADD_INDEX, JSFunction, weakset_add)
#define NATIVE_CONTEXT_FIELDS(V) \
diff --git a/deps/v8/src/counters.h b/deps/v8/src/counters.h
index 255c8db7c6bb54..e873252fa1bcaa 100644
--- a/deps/v8/src/counters.h
+++ b/deps/v8/src/counters.h
@@ -730,6 +730,9 @@ class RuntimeCallTimer final {
V(Map_Has) \
V(Map_New) \
V(Map_Set) \
+ V(WeakMap_Get) \
+ V(WeakMap_Set) \
+ V(WeakMap_New) \
V(Message_GetEndColumn) \
V(Message_GetLineNumber) \
V(Message_GetSourceLine) \
diff --git a/deps/v8/src/debug/debug-interface.h b/deps/v8/src/debug/debug-interface.h
index 2210b4e87f1bc6..169b73a9ea8116 100644
--- a/deps/v8/src/debug/debug-interface.h
+++ b/deps/v8/src/debug/debug-interface.h
@@ -515,6 +515,20 @@ bool SetFunctionBreakpoint(v8::Local function,
v8::Platform* GetCurrentPlatform();
+class WeakMap : public v8::Object {
+ public:
+ V8_WARN_UNUSED_RESULT v8::MaybeLocal Get(
+ v8::Local context, v8::Local key);
+ V8_WARN_UNUSED_RESULT v8::MaybeLocal Set(
+ v8::Local context, v8::Local key,
+ v8::Local value);
+
+ static Local New(v8::Isolate* isolate);
+ V8_INLINE static WeakMap* Cast(Value* obj);
+
+ private:
+ WeakMap();
+};
} // namespace debug
} // namespace v8
diff --git a/deps/v8/src/heap/store-buffer.cc b/deps/v8/src/heap/store-buffer.cc
index d73e3235c158df..657aa9212a6153 100644
--- a/deps/v8/src/heap/store-buffer.cc
+++ b/deps/v8/src/heap/store-buffer.cc
@@ -30,22 +30,28 @@ StoreBuffer::StoreBuffer(Heap* heap)
}
void StoreBuffer::SetUp() {
- // Allocate 3x the buffer size, so that we can start the new store buffer
- // aligned to 2x the size. This lets us use a bit test to detect the end of
- // the area.
+ const size_t requested_size = kStoreBufferSize * kStoreBuffers;
+ // Allocate buffer memory aligned at least to kStoreBufferSize. This lets us
+ // use a bit test to detect the ends of the buffers.
+ const size_t alignment =
+ std::max(kStoreBufferSize, AllocatePageSize());
+ void* hint = AlignedAddress(heap_->GetRandomMmapAddr(), alignment);
VirtualMemory reservation;
- if (!AllocVirtualMemory(kStoreBufferSize * 3, heap_->GetRandomMmapAddr(),
- &reservation)) {
+ if (!AlignedAllocVirtualMemory(requested_size, alignment, hint,
+ &reservation)) {
heap_->FatalProcessOutOfMemory("StoreBuffer::SetUp");
}
+
Address start = reservation.address();
- start_[0] = reinterpret_cast(::RoundUp(start, kStoreBufferSize));
+ const size_t allocated_size = reservation.size();
+
+ start_[0] = reinterpret_cast(start);
limit_[0] = start_[0] + (kStoreBufferSize / kPointerSize);
start_[1] = limit_[0];
limit_[1] = start_[1] + (kStoreBufferSize / kPointerSize);
- Address* vm_limit = reinterpret_cast(start + reservation.size());
-
+ // Sanity check the buffers.
+ Address* vm_limit = reinterpret_cast(start + allocated_size);
USE(vm_limit);
for (int i = 0; i < kStoreBuffers; i++) {
DCHECK(reinterpret_cast(start_[i]) >= reservation.address());
@@ -55,8 +61,9 @@ void StoreBuffer::SetUp() {
DCHECK_EQ(0, reinterpret_cast(limit_[i]) & kStoreBufferMask);
}
- if (!reservation.SetPermissions(reinterpret_cast(start_[0]),
- kStoreBufferSize * kStoreBuffers,
+ // Set RW permissions only on the pages we use.
+ const size_t used_size = RoundUp(requested_size, CommitPageSize());
+ if (!reservation.SetPermissions(start, used_size,
PageAllocator::kReadWrite)) {
heap_->FatalProcessOutOfMemory("StoreBuffer::SetUp");
}
@@ -65,7 +72,6 @@ void StoreBuffer::SetUp() {
virtual_memory_.TakeControl(&reservation);
}
-
void StoreBuffer::TearDown() {
if (virtual_memory_.IsReserved()) virtual_memory_.Free();
top_ = nullptr;
diff --git a/deps/v8/src/inspector/v8-debugger.cc b/deps/v8/src/inspector/v8-debugger.cc
index 6e4e6a1752e3ab..4fec951390c2f0 100644
--- a/deps/v8/src/inspector/v8-debugger.cc
+++ b/deps/v8/src/inspector/v8-debugger.cc
@@ -703,11 +703,37 @@ v8::MaybeLocal V8Debugger::generatorScopes(
return getTargetScopes(context, generator, GENERATOR);
}
+v8::MaybeLocal V8Debugger::stableObjectId(
+ v8::Local context, v8::Local value) {
+ DCHECK(value->IsObject());
+ if (m_stableObjectId.IsEmpty()) {
+ m_stableObjectId.Reset(m_isolate, v8::debug::WeakMap::New(m_isolate));
+ }
+ v8::Local stableObjectId =
+ m_stableObjectId.Get(m_isolate);
+ v8::Local idValue;
+ if (!stableObjectId->Get(context, value).ToLocal(&idValue) ||
+ !idValue->IsUint32()) {
+ idValue = v8::Integer::NewFromUnsigned(m_isolate, ++m_lastStableObjectId);
+ stableObjectId->Set(context, value, idValue).ToLocalChecked();
+ }
+ return idValue.As();
+}
+
v8::MaybeLocal V8Debugger::internalProperties(
v8::Local context, v8::Local value) {
v8::Local properties;
if (!v8::debug::GetInternalProperties(m_isolate, value).ToLocal(&properties))
return v8::MaybeLocal();
+ if (value->IsObject()) {
+ v8::Local id;
+ if (stableObjectId(context, value).ToLocal(&id)) {
+ createDataProperty(
+ context, properties, properties->Length(),
+ toV8StringInternalized(m_isolate, "[[StableObjectId]]"));
+ createDataProperty(context, properties, properties->Length(), id);
+ }
+ }
if (value->IsFunction()) {
v8::Local function = value.As();
v8::Local location;
diff --git a/deps/v8/src/inspector/v8-debugger.h b/deps/v8/src/inspector/v8-debugger.h
index 351e5b66adbf8b..dd8c7f66192183 100644
--- a/deps/v8/src/inspector/v8-debugger.h
+++ b/deps/v8/src/inspector/v8-debugger.h
@@ -185,6 +185,9 @@ class V8Debugger : public v8::debug::DebugDelegate {
int currentContextGroupId();
+ v8::MaybeLocal stableObjectId(v8::Local,
+ v8::Local);
+
v8::Isolate* m_isolate;
V8InspectorImpl* m_inspector;
int m_enableCount;
@@ -241,6 +244,9 @@ class V8Debugger : public v8::debug::DebugDelegate {
std::unique_ptr m_terminateExecutionCallback;
+ uint32_t m_lastStableObjectId = 0;
+ v8::Global m_stableObjectId;
+
WasmTranslation m_wasmTranslation;
DISALLOW_COPY_AND_ASSIGN(V8Debugger);
diff --git a/deps/v8/src/regexp/ppc/regexp-macro-assembler-ppc.cc b/deps/v8/src/regexp/ppc/regexp-macro-assembler-ppc.cc
index fdda46424eac98..aca0b269950963 100644
--- a/deps/v8/src/regexp/ppc/regexp-macro-assembler-ppc.cc
+++ b/deps/v8/src/regexp/ppc/regexp-macro-assembler-ppc.cc
@@ -142,8 +142,13 @@ int RegExpMacroAssemblerPPC::stack_limit_slack() {
void RegExpMacroAssemblerPPC::AdvanceCurrentPosition(int by) {
if (by != 0) {
- __ addi(current_input_offset(), current_input_offset(),
- Operand(by * char_size()));
+ if (is_int16(by * char_size())) {
+ __ addi(current_input_offset(), current_input_offset(),
+ Operand(by * char_size()));
+ } else {
+ __ mov(r0, Operand(by * char_size()));
+ __ add(current_input_offset(), r0, current_input_offset());
+ }
}
}
@@ -1272,7 +1277,12 @@ void RegExpMacroAssemblerPPC::LoadCurrentCharacterUnchecked(int cp_offset,
Register offset = current_input_offset();
if (cp_offset != 0) {
// r25 is not being used to store the capture start index at this point.
- __ addi(r25, current_input_offset(), Operand(cp_offset * char_size()));
+ if (is_int16(cp_offset * char_size())) {
+ __ addi(r25, current_input_offset(), Operand(cp_offset * char_size()));
+ } else {
+ __ mov(r25, Operand(cp_offset * char_size()));
+ __ add(r25, r25, current_input_offset());
+ }
offset = r25;
}
// The lwz, stw, lhz, sth instructions can do unaligned accesses, if the CPU
diff --git a/deps/v8/src/wasm/module-compiler.cc b/deps/v8/src/wasm/module-compiler.cc
index 180c025a4965da..2b0eac818aa2fe 100644
--- a/deps/v8/src/wasm/module-compiler.cc
+++ b/deps/v8/src/wasm/module-compiler.cc
@@ -2653,20 +2653,20 @@ void InstanceBuilder::LoadTableSegments(Handle instance) {
// Update the local dispatch table first.
uint32_t sig_id = module_->signature_ids[function->sig_index];
- WasmInstanceObject* target_instance = *instance;
+ Handle target_instance = instance;
Address call_target;
const bool is_import = func_index < module_->num_imported_functions;
if (is_import) {
// For imported calls, take target instance and address from the
// import table.
ImportedFunctionEntry entry(instance, func_index);
- target_instance = entry.instance();
+ target_instance = handle(entry.instance(), isolate_);
call_target = entry.target();
} else {
call_target = native_module->GetCallTargetForFunction(func_index);
}
IndirectFunctionTableEntry(instance, table_index)
- .set(sig_id, target_instance, call_target);
+ .set(sig_id, *target_instance, call_target);
if (!table_instance.table_object.is_null()) {
// Update the table object's other dispatch tables.
@@ -2700,17 +2700,16 @@ void InstanceBuilder::LoadTableSegments(Handle instance) {
}
table_instance.js_wrappers->set(table_index,
*js_wrappers_[func_index]);
- // UpdateDispatchTables() should update this instance as well.
+ // UpdateDispatchTables() updates all other dispatch tables, since
+ // we have not yet added the dispatch table we are currently building.
WasmTableObject::UpdateDispatchTables(
isolate_, table_instance.table_object, table_index, function->sig,
- instance, call_target);
+ target_instance, call_target);
}
}
}
- // TODO(titzer): we add the new dispatch table at the end to avoid
- // redundant work and also because the new instance is not yet fully
- // initialized.
+ // Add the new dispatch table at the end to avoid redundant lookups.
if (!table_instance.table_object.is_null()) {
// Add the new dispatch table to the WebAssembly.Table object.
WasmTableObject::AddDispatchTable(isolate_, table_instance.table_object,
diff --git a/deps/v8/test/inspector/debugger/eval-scopes-expected.txt b/deps/v8/test/inspector/debugger/eval-scopes-expected.txt
index 71d6618c8e8387..4c93498c68f134 100644
--- a/deps/v8/test/inspector/debugger/eval-scopes-expected.txt
+++ b/deps/v8/test/inspector/debugger/eval-scopes-expected.txt
@@ -2,6 +2,12 @@ Tests that variables introduced in eval scopes are accessible
{
id :
result : {
+ internalProperties : [
+ [0] : {
+ name : [[StableObjectId]]
+ value :
+ }
+ ]
result : [
[0] : {
configurable : true
diff --git a/deps/v8/test/inspector/debugger/scope-skip-variables-with-empty-name-expected.txt b/deps/v8/test/inspector/debugger/scope-skip-variables-with-empty-name-expected.txt
index 626f9787c37993..6fbe355eff54c1 100644
--- a/deps/v8/test/inspector/debugger/scope-skip-variables-with-empty-name-expected.txt
+++ b/deps/v8/test/inspector/debugger/scope-skip-variables-with-empty-name-expected.txt
@@ -2,6 +2,12 @@ Tests that scopes do not report variables with empty names
{
id :
result : {
+ internalProperties : [
+ [0] : {
+ name : [[StableObjectId]]
+ value :
+ }
+ ]
result : [
[0] : {
configurable : true
diff --git a/deps/v8/test/inspector/protocol-test.js b/deps/v8/test/inspector/protocol-test.js
index 9b7ba0aafe6f37..7163dd68785a00 100644
--- a/deps/v8/test/inspector/protocol-test.js
+++ b/deps/v8/test/inspector/protocol-test.js
@@ -45,6 +45,8 @@ InspectorTest.logMessage = function(originalMessage) {
var objects = [ message ];
while (objects.length) {
var object = objects.shift();
+ if (object && object.name === '[[StableObjectId]]')
+ object.value = '';
for (var key in object) {
if (nonStableFields.has(key))
object[key] = `<${key}>`;
diff --git a/deps/v8/test/inspector/runtime/es6-module-expected.txt b/deps/v8/test/inspector/runtime/es6-module-expected.txt
index 25ba52e0341c2e..051ef6ceae183c 100644
--- a/deps/v8/test/inspector/runtime/es6-module-expected.txt
+++ b/deps/v8/test/inspector/runtime/es6-module-expected.txt
@@ -128,6 +128,12 @@ console.log(239)
{
id :
result : {
+ internalProperties : [
+ [0] : {
+ name : [[StableObjectId]]
+ value :
+ }
+ ]
result : [
[0] : {
configurable : true
diff --git a/deps/v8/test/inspector/runtime/get-properties-expected.txt b/deps/v8/test/inspector/runtime/get-properties-expected.txt
index 8b48e65c3b7060..5707ffc5afd2de 100644
--- a/deps/v8/test/inspector/runtime/get-properties-expected.txt
+++ b/deps/v8/test/inspector/runtime/get-properties-expected.txt
@@ -5,6 +5,7 @@ Running test: testObject5
foo own string cat
Internal properties
[[PrimitiveValue]] number 5
+ [[StableObjectId]]:
Running test: testNotOwn
__defineGetter__ inherited function undefined
@@ -23,6 +24,8 @@ Running test: testNotOwn
toLocaleString inherited function undefined
toString inherited function undefined
valueOf inherited function undefined
+Internal properties
+ [[StableObjectId]]:
Running test: testAccessorsOnly
b own no value, getter, setter
@@ -34,6 +37,8 @@ Running test: testArray
2 own string blue
__proto__ own object undefined
length own number 3
+Internal properties
+ [[StableObjectId]]:
Running test: testBound
__proto__ own function undefined
@@ -42,14 +47,19 @@ Running test: testBound
Internal properties
[[BoundArgs]] object undefined
[[BoundThis]] object undefined
+ [[StableObjectId]]:
[[TargetFunction]] function undefined
Running test: testObjectThrowsLength
__proto__ own object undefined
length own no value, getter
+Internal properties
+ [[StableObjectId]]:
Running test: testTypedArrayWithoutLength
__proto__ own object undefined
+Internal properties
+ [[StableObjectId]]:
Running test: testArrayBuffer
[[Int8Array]]
@@ -62,6 +72,8 @@ Running test: testArrayBuffer
6 own number 1
7 own number 1
__proto__ own object undefined
+Internal properties
+ [[StableObjectId]]:
[[Uint8Array]]
0 own number 1
1 own number 1
@@ -72,18 +84,26 @@ Running test: testArrayBuffer
6 own number 1
7 own number 1
__proto__ own object undefined
+Internal properties
+ [[StableObjectId]]:
[[Int16Array]]
0 own number 257
1 own number 257
2 own number 257
3 own number 257
__proto__ own object undefined
+Internal properties
+ [[StableObjectId]]:
[[Int32Array]]
0 own number 16843009
1 own number 16843009
__proto__ own object undefined
+Internal properties
+ [[StableObjectId]]:
Running test: testArrayBufferWithBrokenUintCtor
[[Int8Array]] own object undefined
[[Uint8Array]] own object undefined
__proto__ own object undefined
+Internal properties
+ [[StableObjectId]]:
diff --git a/deps/v8/test/inspector/runtime/get-properties-on-proxy-expected.txt b/deps/v8/test/inspector/runtime/get-properties-on-proxy-expected.txt
index a0437f4af6d644..efde782ae32b78 100644
--- a/deps/v8/test/inspector/runtime/get-properties-on-proxy-expected.txt
+++ b/deps/v8/test/inspector/runtime/get-properties-on-proxy-expected.txt
@@ -54,6 +54,10 @@ Testing regular Proxy
value : false
}
}
+ [3] : {
+ name : [[StableObjectId]]
+ value :
+ }
]
result : [
]
@@ -114,6 +118,10 @@ Testing revocable Proxy
value : false
}
}
+ [3] : {
+ name : [[StableObjectId]]
+ value :
+ }
]
result : [
]
@@ -166,6 +174,10 @@ Testing revocable Proxy
value : true
}
}
+ [3] : {
+ name : [[StableObjectId]]
+ value :
+ }
]
result : [
]
diff --git a/deps/v8/test/inspector/runtime/get-properties.js b/deps/v8/test/inspector/runtime/get-properties.js
index d2b2c754a311e2..0386fdea6d87c5 100644
--- a/deps/v8/test/inspector/runtime/get-properties.js
+++ b/deps/v8/test/inspector/runtime/get-properties.js
@@ -94,7 +94,10 @@ async function logGetPropertiesResult(objectId, flags = { ownProperties: true })
for (var i = 0; i < internalPropertyArray.length; i++) {
var p = internalPropertyArray[i];
var v = p.value;
- InspectorTest.log(" " + p.name + " " + v.type + " " + v.value);
+ if (p.name !== '[[StableObjectId]]')
+ InspectorTest.log(" " + p.name + " " + v.type + " " + v.value);
+ else
+ InspectorTest.log(" [[StableObjectId]]: ");
}
}
diff --git a/deps/v8/test/inspector/runtime/internal-properties-entries-expected.txt b/deps/v8/test/inspector/runtime/internal-properties-entries-expected.txt
index d395067efe72b1..1d09e8dc1ebe77 100644
--- a/deps/v8/test/inspector/runtime/internal-properties-entries-expected.txt
+++ b/deps/v8/test/inspector/runtime/internal-properties-entries-expected.txt
@@ -15,6 +15,12 @@ expression: new Map([[1,2],[3,4]])
{
id :
result : {
+ internalProperties : [
+ [0] : {
+ name : [[StableObjectId]]
+ value :
+ }
+ ]
result : [
[0] : {
configurable : true
@@ -65,6 +71,12 @@ expression: new Map()
{
id :
result : {
+ internalProperties : [
+ [0] : {
+ name : [[StableObjectId]]
+ value :
+ }
+ ]
result : [
[0] : {
configurable : false
@@ -97,6 +109,12 @@ expression: new Map([[1,2],[3,4]]).entries()
{
id :
result : {
+ internalProperties : [
+ [0] : {
+ name : [[StableObjectId]]
+ value :
+ }
+ ]
result : [
[0] : {
configurable : true
@@ -151,6 +169,12 @@ expression: it = new Map([[1,2],[3,4]]).entries(); it.next(); it
{
id :
result : {
+ internalProperties : [
+ [0] : {
+ name : [[StableObjectId]]
+ value :
+ }
+ ]
result : [
[0] : {
configurable : true
@@ -190,6 +214,12 @@ expression: it = new Map([[1,2],[3,4]]).keys(); it.next(); it
{
id :
result : {
+ internalProperties : [
+ [0] : {
+ name : [[StableObjectId]]
+ value :
+ }
+ ]
result : [
[0] : {
configurable : true
@@ -229,6 +259,12 @@ expression: it = new Map([[1,2],[3,4]]).values(); it.next(); it
{
id :
result : {
+ internalProperties : [
+ [0] : {
+ name : [[StableObjectId]]
+ value :
+ }
+ ]
result : [
[0] : {
configurable : true
@@ -265,6 +301,12 @@ expression: it = new Map([[1,2],[3,4]]).entries(); it.next(); it.next(); it
{
id :
result : {
+ internalProperties : [
+ [0] : {
+ name : [[StableObjectId]]
+ value :
+ }
+ ]
result : [
[0] : {
configurable : false
@@ -295,6 +337,12 @@ expression: new Set([1,2])
{
id :
result : {
+ internalProperties : [
+ [0] : {
+ name : [[StableObjectId]]
+ value :
+ }
+ ]
result : [
[0] : {
configurable : true
@@ -345,6 +393,12 @@ expression: new Set()
{
id :
result : {
+ internalProperties : [
+ [0] : {
+ name : [[StableObjectId]]
+ value :
+ }
+ ]
result : [
[0] : {
configurable : false
@@ -375,6 +429,12 @@ expression: new Set([1,2]).values()
{
id :
result : {
+ internalProperties : [
+ [0] : {
+ name : [[StableObjectId]]
+ value :
+ }
+ ]
result : [
[0] : {
configurable : true
@@ -428,6 +488,12 @@ expression: it = new Set([1,2]).values(); it.next(); it
{
id :
result : {
+ internalProperties : [
+ [0] : {
+ name : [[StableObjectId]]
+ value :
+ }
+ ]
result : [
[0] : {
configurable : true
@@ -467,6 +533,12 @@ expression: it = new Set([1,2]).keys(); it.next(); it
{
id :
result : {
+ internalProperties : [
+ [0] : {
+ name : [[StableObjectId]]
+ value :
+ }
+ ]
result : [
[0] : {
configurable : true
@@ -506,6 +578,12 @@ expression: it = new Set([1,2]).entries(); it.next(); it
{
id :
result : {
+ internalProperties : [
+ [0] : {
+ name : [[StableObjectId]]
+ value :
+ }
+ ]
result : [
[0] : {
configurable : true
@@ -542,6 +620,12 @@ expression: it = new Set([1,2]).values(); it.next(); it.next(); it
{
id :
result : {
+ internalProperties : [
+ [0] : {
+ name : [[StableObjectId]]
+ value :
+ }
+ ]
result : [
[0] : {
configurable : false
@@ -566,6 +650,12 @@ expression: new WeakMap()
{
id :
result : {
+ internalProperties : [
+ [0] : {
+ name : [[StableObjectId]]
+ value :
+ }
+ ]
result : [
[0] : {
configurable : false
@@ -594,6 +684,12 @@ expression: new WeakMap([[{ a: 2 }, 42]])
{
id :
result : {
+ internalProperties : [
+ [0] : {
+ name : [[StableObjectId]]
+ value :
+ }
+ ]
result : [
[0] : {
configurable : true
@@ -632,6 +728,12 @@ expression: new WeakSet()
{
id :
result : {
+ internalProperties : [
+ [0] : {
+ name : [[StableObjectId]]
+ value :
+ }
+ ]
result : [
[0] : {
configurable : false
@@ -659,6 +761,12 @@ expression: new WeakSet([{a:2}])
{
id :
result : {
+ internalProperties : [
+ [0] : {
+ name : [[StableObjectId]]
+ value :
+ }
+ ]
result : [
[0] : {
configurable : true
diff --git a/deps/v8/test/inspector/runtime/internal-properties-expected.txt b/deps/v8/test/inspector/runtime/internal-properties-expected.txt
index a2e38ab013f472..c114696eb81352 100644
--- a/deps/v8/test/inspector/runtime/internal-properties-expected.txt
+++ b/deps/v8/test/inspector/runtime/internal-properties-expected.txt
@@ -7,6 +7,10 @@ expression: (function* foo() { yield 1 })
result : {
internalProperties : [
[0] : {
+ name : [[StableObjectId]]
+ value :
+ }
+ [1] : {
name : [[FunctionLocation]]
value : {
description : Object
@@ -19,14 +23,14 @@ expression: (function* foo() { yield 1 })
}
}
}
- [1] : {
+ [2] : {
name : [[IsGenerator]]
value : {
type : boolean
value : true
}
}
- [2] : {
+ [3] : {
name : [[Scopes]]
value : {
className : Array
@@ -47,6 +51,10 @@ expression: (function foo() {})
result : {
internalProperties : [
[0] : {
+ name : [[StableObjectId]]
+ value :
+ }
+ [1] : {
name : [[FunctionLocation]]
value : {
description : Object
@@ -59,7 +67,7 @@ expression: (function foo() {})
}
}
}
- [1] : {
+ [2] : {
name : [[Scopes]]
value : {
className : Array
@@ -87,6 +95,10 @@ expression: new Number(239)
value : 239
}
}
+ [1] : {
+ name : [[StableObjectId]]
+ value :
+ }
]
}
}
@@ -102,6 +114,10 @@ expression: new Boolean(false)
value : false
}
}
+ [1] : {
+ name : [[StableObjectId]]
+ value :
+ }
]
}
}
@@ -117,6 +133,10 @@ expression: new String('abc')
value : abc
}
}
+ [1] : {
+ name : [[StableObjectId]]
+ value :
+ }
]
}
}
@@ -133,6 +153,10 @@ expression: Object(Symbol(42))
type : symbol
}
}
+ [1] : {
+ name : [[StableObjectId]]
+ value :
+ }
]
}
}
@@ -149,6 +173,10 @@ expression: Object(BigInt(2))
unserializableValue : 2n
}
}
+ [1] : {
+ name : [[StableObjectId]]
+ value :
+ }
]
}
}
@@ -174,6 +202,10 @@ expression: Promise.resolve(42)
value : 42
}
}
+ [2] : {
+ name : [[StableObjectId]]
+ value :
+ }
]
}
}
@@ -195,6 +227,10 @@ expression: new Promise(() => undefined)
type : undefined
}
}
+ [2] : {
+ name : [[StableObjectId]]
+ value :
+ }
]
}
}
@@ -231,6 +267,10 @@ expression: gen1
}
}
[3] : {
+ name : [[StableObjectId]]
+ value :
+ }
+ [4] : {
name : [[GeneratorLocation]]
value : {
description : Object
@@ -243,7 +283,7 @@ expression: gen1
}
}
}
- [4] : {
+ [5] : {
name : [[Scopes]]
value : {
className : Array
@@ -287,6 +327,10 @@ expression: gen1.next();gen1
}
}
[3] : {
+ name : [[StableObjectId]]
+ value :
+ }
+ [4] : {
name : [[GeneratorLocation]]
value : {
description : Object
@@ -299,7 +343,7 @@ expression: gen1.next();gen1
}
}
}
- [4] : {
+ [5] : {
name : [[Scopes]]
value : {
className : Array
@@ -343,6 +387,10 @@ expression: gen1.next();gen1
}
}
[3] : {
+ name : [[StableObjectId]]
+ value :
+ }
+ [4] : {
name : [[GeneratorLocation]]
value : {
description : Object
@@ -391,6 +439,10 @@ expression: gen2
}
}
[3] : {
+ name : [[StableObjectId]]
+ value :
+ }
+ [4] : {
name : [[GeneratorLocation]]
value : {
description : Object
@@ -403,7 +455,7 @@ expression: gen2
}
}
}
- [4] : {
+ [5] : {
name : [[Scopes]]
value : {
className : Array
@@ -447,6 +499,10 @@ expression: gen2.next();gen2
}
}
[3] : {
+ name : [[StableObjectId]]
+ value :
+ }
+ [4] : {
name : [[GeneratorLocation]]
value : {
description : Object
@@ -459,7 +515,7 @@ expression: gen2.next();gen2
}
}
}
- [4] : {
+ [5] : {
name : [[Scopes]]
value : {
className : Array
@@ -503,6 +559,10 @@ expression: gen2.next();gen2
}
}
[3] : {
+ name : [[StableObjectId]]
+ value :
+ }
+ [4] : {
name : [[GeneratorLocation]]
value : {
description : Object
@@ -548,6 +608,10 @@ expression: (new Map([[1,2]])).entries()
}
}
[3] : {
+ name : [[StableObjectId]]
+ value :
+ }
+ [4] : {
name : [[Entries]]
value : {
className : Array
@@ -588,6 +652,10 @@ expression: (new Set([[1,2]])).entries()
}
}
[3] : {
+ name : [[StableObjectId]]
+ value :
+ }
+ [4] : {
name : [[Entries]]
value : {
className : Array
diff --git a/deps/v8/test/inspector/runtime/stable-object-id-expected.txt b/deps/v8/test/inspector/runtime/stable-object-id-expected.txt
new file mode 100644
index 00000000000000..937727e1089f59
--- /dev/null
+++ b/deps/v8/test/inspector/runtime/stable-object-id-expected.txt
@@ -0,0 +1,14 @@
+Checks that protocol returns the same RemoteObjectId for the same object
+
+Running test: testGlobal
+Compare global evaluated twice: true
+
+Running test: testObject
+Compare object evaluated twice: true
+
+Running test: testObjectInArray
+Compare first and second element: true
+
+Running test: testObjectOnPause
+Compare global and this: true
+Compare a and a on pause: true
diff --git a/deps/v8/test/inspector/runtime/stable-object-id.js b/deps/v8/test/inspector/runtime/stable-object-id.js
new file mode 100644
index 00000000000000..9a65e67d7f6855
--- /dev/null
+++ b/deps/v8/test/inspector/runtime/stable-object-id.js
@@ -0,0 +1,77 @@
+// Copyright 2018 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+let {session, contextGroup, Protocol} = InspectorTest.start(
+ 'Checks that protocol returns the same RemoteObjectId for the same object');
+
+InspectorTest.runAsyncTestSuite([
+ async function testGlobal() {
+ const {result:{result:{objectId:firstId}}} =
+ await Protocol.Runtime.evaluate({expression: 'this'});
+ const firstStableId = await stableObjectId(firstId);
+ const {result:{result:{objectId:secondId}}} =
+ await Protocol.Runtime.evaluate({expression: 'this'});
+ const secondStableId = await stableObjectId(secondId);
+ InspectorTest.log(
+ `Compare global evaluated twice: ${firstStableId === secondStableId}`);
+ },
+
+ async function testObject() {
+ const {result:{result:{objectId:firstId}}} =
+ await Protocol.Runtime.evaluate({expression: 'this.a = {}, this.a'});
+ const firstStableId = await stableObjectId(firstId);
+ const {result:{result:{objectId:secondId}}} =
+ await Protocol.Runtime.evaluate({expression: 'this.a'});
+ const secondStableId = await stableObjectId(secondId);
+ InspectorTest.log(
+ `Compare object evaluated twice: ${firstStableId === secondStableId}`);
+ },
+
+ async function testObjectInArray() {
+ await Protocol.Runtime.evaluate({expression: 'this.b = [this.a, this.a]'});
+ const {result:{result:{objectId:firstId}}} =
+ await Protocol.Runtime.evaluate({expression: 'this.b[0]'});
+ const firstStableId = await stableObjectId(firstId);
+ const {result:{result:{objectId:secondId}}} =
+ await Protocol.Runtime.evaluate({expression: 'this.b[1]'});
+ const secondStableId = await stableObjectId(secondId);
+ InspectorTest.log(
+ `Compare first and second element: ${firstStableId === secondStableId}`);
+ },
+
+ async function testObjectOnPause() {
+ const {result:{result:{objectId:globalId}}} =
+ await Protocol.Runtime.evaluate({expression: 'this'});
+ const globalStableId = await stableObjectId(globalId);
+ const {result:{result:{objectId:aId}}} =
+ await Protocol.Runtime.evaluate({expression: 'this.a'});
+ const aStableId = await stableObjectId(aId);
+ await Protocol.Debugger.enable();
+ Protocol.Runtime.evaluate({expression: 'debugger'});
+ const {params:{callFrames:[topFrame]}} =
+ await Protocol.Debugger.oncePaused();
+ const topFrameThisStableId = await stableObjectId(topFrame.this.objectId);
+ InspectorTest.log(
+ `Compare global and this: ${globalStableId === topFrameThisStableId}`);
+
+ const {result:{result: props}} = await Protocol.Runtime.getProperties({
+ objectId: topFrame.scopeChain[0].object.objectId
+ });
+ const {value:{objectId: aIdOnPause}} = props.find(prop => prop.name === 'a');
+ const aStableIdOnPause = await stableObjectId(aIdOnPause);
+ InspectorTest.log(`Compare a and a on pause: ${
+ aStableId === aStableIdOnPause}`);
+ }
+]);
+
+async function stableObjectId(objectId) {
+ const {result:{
+ internalProperties: props
+ }} = await Protocol.Runtime.getProperties({
+ objectId,
+ ownProperties: true,
+ generatePreview: false
+ });
+ return props.find(prop => prop.name === '[[StableObjectId]]').value.value;
+}
diff --git a/deps/v8/test/inspector/sessions/runtime-remote-object-expected.txt b/deps/v8/test/inspector/sessions/runtime-remote-object-expected.txt
index a8d0ec0c207895..7c6e69e05d69be 100644
--- a/deps/v8/test/inspector/sessions/runtime-remote-object-expected.txt
+++ b/deps/v8/test/inspector/sessions/runtime-remote-object-expected.txt
@@ -5,6 +5,12 @@ Retrieving properties in 2
{
id :
result : {
+ internalProperties : [
+ [0] : {
+ name : [[StableObjectId]]
+ value :
+ }
+ ]
result : [
[0] : {
configurable : true
@@ -38,6 +44,12 @@ Retrieving properties in 1
{
id :
result : {
+ internalProperties : [
+ [0] : {
+ name : [[StableObjectId]]
+ value :
+ }
+ ]
result : [
[0] : {
configurable : true
@@ -72,6 +84,12 @@ Retrieving properties in 1
{
id :
result : {
+ internalProperties : [
+ [0] : {
+ name : [[StableObjectId]]
+ value :
+ }
+ ]
result : [
[0] : {
configurable : true
diff --git a/deps/v8/test/mjsunit/wasm/import-table.js b/deps/v8/test/mjsunit/wasm/import-table.js
new file mode 100644
index 00000000000000..bb8bf7807b5cf5
--- /dev/null
+++ b/deps/v8/test/mjsunit/wasm/import-table.js
@@ -0,0 +1,244 @@
+// Copyright 2018 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --expose-wasm
+
+load("test/mjsunit/wasm/wasm-constants.js");
+load("test/mjsunit/wasm/wasm-module-builder.js");
+
+function addConstFunc(builder, val) {
+ return builder.addFunction("const" + val, kSig_i_v)
+ .addBody(wasmI32Const(val)).index;
+}
+
+function addSigs(builder, pad) {
+ for (let i = 0; i < pad; i++) {
+ let params = [];
+ for (let j = 0; j < i; j++) params.push(kWasmF32);
+ builder.addType(makeSig(params, []));
+ }
+
+ return { i_v: builder.addType(kSig_i_v) };
+}
+
+let kTableSize = 50;
+
+(function TestAliasedImportedTable() {
+ print(arguments.callee.name);
+
+ {
+ let builder = new WasmModuleBuilder();
+ let signums = addSigs(builder, 1);
+
+ builder.addImportedTable("m", "table", kTableSize, kTableSize);
+ let f15 = addConstFunc(builder, 15);
+ let call = builder.addFunction("call", kSig_i_i)
+ .addBody([
+ kExprGetLocal, 0,
+ kExprCallIndirect, signums.i_v, kTableZero
+ ])
+ .exportAs("call");
+ let f17 = addConstFunc(builder, 17);
+ builder.addExport("f15", f15);
+ builder.addExport("f17", f17);
+ builder.addFunctionTableInit(15, false, [f15], true);
+ builder.addFunctionTableInit(1, false, [call.index], true);
+
+ var mod1 = builder.toModule();
+ }
+
+ {
+ let builder = new WasmModuleBuilder();
+ let signums = addSigs(builder, 5); // ensure different sigids
+
+ builder.addImportedTable("m", "table", kTableSize, kTableSize);
+ let f15 = builder.addImport("m", "f15", kSig_i_v);
+ let f17 = builder.addImport("m", "f17", kSig_i_v);
+ let f21 = addConstFunc(builder, 21);
+ let call = builder.addFunction("call", kSig_i_i)
+ .addBody([
+ kExprGetLocal, 0,
+ kExprCallIndirect, signums.i_v, kTableZero
+ ])
+ .exportAs("call");
+ let f26 = addConstFunc(builder, 26);
+ builder.addFunctionTableInit(17, false, [f17], true);
+ builder.addFunctionTableInit(21, false, [f21], true);
+ builder.addFunctionTableInit(26, false, [f26], true);
+ builder.addFunctionTableInit(5, false, [call.index], true);
+
+ var mod2 = builder.toModule();
+ }
+
+ var table = new WebAssembly.Table({initial: kTableSize,
+ maximum: kTableSize, element: "anyfunc"});
+ var i1 = new WebAssembly.Instance(mod1, {m: {table: table}});
+
+ var i2 = new WebAssembly.Instance(mod2,
+ {m: {table: table, f15: i1.exports.f15, f17: i1.exports.f17}});
+
+ for (i of [15, 17, 21, 26]) {
+ print(i);
+ assertEquals(i, i1.exports.call(i));
+ assertEquals(i, i2.exports.call(i));
+ }
+ for (i of [0, 1, 5, 16]) {
+ assertThrows(() => i1.exports.call(i));
+ assertThrows(() => i2.exports.call(i));
+ }
+})();
+
+function addConstFuncUsingGlobal(builder, val) {
+ let g = builder.addGlobal(kWasmI32, false);
+ g.init = val;
+ return builder.addFunction("global" + val, kSig_i_v)
+ .addBody([kExprGetGlobal, g.index]).index;
+}
+
+(function TestAliasedImportedTableInstanceGlobals() {
+ print(arguments.callee.name);
+
+ {
+ let builder = new WasmModuleBuilder();
+ let signums = addSigs(builder, 1);
+
+ builder.addImportedTable("m", "table", kTableSize, kTableSize);
+ let f14 = addConstFuncUsingGlobal(builder, 14);
+ let call = builder.addFunction("call", kSig_i_i)
+ .addBody([
+ kExprGetLocal, 0,
+ kExprCallIndirect, signums.i_v, kTableZero
+ ])
+ .exportAs("call");
+ let f18 = addConstFuncUsingGlobal(builder, 18);
+ builder.addExport("f14", f14);
+ builder.addExport("f18", f18);
+ builder.addFunctionTableInit(14, false, [f14], true);
+ builder.addFunctionTableInit(1, false, [call.index], true);
+
+ var mod1 = builder.toModule();
+ }
+
+ {
+ let builder = new WasmModuleBuilder();
+ let signums = addSigs(builder, 3); // ensure different sigids
+
+ builder.addImportedTable("m", "table", kTableSize, kTableSize);
+ let f14 = builder.addImport("m", "f14", kSig_i_v);
+ let f18 = builder.addImport("m", "f18", kSig_i_v);
+ let f22 = addConstFuncUsingGlobal(builder, 22);
+ let call = builder.addFunction("call", kSig_i_i)
+ .addBody([
+ kExprGetLocal, 0,
+ kExprCallIndirect, signums.i_v, kTableZero
+ ])
+ .exportAs("call");
+ let f28 = addConstFuncUsingGlobal(builder, 28);
+ builder.addFunctionTableInit(18, false, [f18], true);
+ builder.addFunctionTableInit(22, false, [f22], true);
+ builder.addFunctionTableInit(28, false, [f28], true);
+ builder.addFunctionTableInit(5, false, [call.index], true);
+
+ var mod2 = builder.toModule();
+ }
+
+ var table = new WebAssembly.Table({initial: kTableSize,
+ maximum: kTableSize, element: "anyfunc"});
+ var i1 = new WebAssembly.Instance(mod1, {m: {table: table}});
+
+ var i2 = new WebAssembly.Instance(mod2,
+ {m: {table: table, f14: i1.exports.f14, f18: i1.exports.f18}});
+
+ for (i of [14, 18, 22, 28]) {
+ print(i);
+ assertEquals(i, i1.exports.call(i));
+ assertEquals(i, i2.exports.call(i));
+ }
+ for (i of [0, 1, 5, 16]) {
+ assertThrows(() => i1.exports.call(i));
+ assertThrows(() => i2.exports.call(i));
+ }
+})();
+
+
+function addConstFuncUsingMemory(builder, val) {
+ var addr = builder.address;
+ builder.address += 8;
+ var bytes = [val & 0xff, (val>>8) & 0xff, (val>>16) & 0xff, (val>>24) & 0xff];
+ builder.addDataSegment(addr, bytes);
+ return builder.addFunction("mem" + val, kSig_i_v)
+ .addBody([
+ ...wasmI32Const(addr),
+ kExprI32LoadMem, 0, 0
+ ]).index;
+}
+
+(function TestAliasedImportedTableInstanceMemories() {
+ print(arguments.callee.name);
+
+ {
+ let builder = new WasmModuleBuilder();
+ builder.address = 8;
+ let signums = addSigs(builder, 1);
+
+ builder.addMemory(1, 1, false);
+ builder.addImportedTable("m", "table", kTableSize, kTableSize);
+ let f13 = addConstFuncUsingMemory(builder, 13);
+ let call = builder.addFunction("call", kSig_i_i)
+ .addBody([
+ kExprGetLocal, 0,
+ kExprCallIndirect, signums.i_v, kTableZero
+ ])
+ .exportAs("call");
+ let f19 = addConstFuncUsingMemory(builder, 19);
+ builder.addExport("f13", f13);
+ builder.addExport("f19", f19);
+ builder.addFunctionTableInit(13, false, [f13], true);
+ builder.addFunctionTableInit(1, false, [call.index], true);
+
+ var mod1 = builder.toModule();
+ }
+
+ {
+ let builder = new WasmModuleBuilder();
+ builder.address = 8;
+ let signums = addSigs(builder, 4); // ensure different sigids
+
+ builder.addMemory(1, 1, false);
+ builder.addImportedTable("m", "table", kTableSize, kTableSize);
+ let f13 = builder.addImport("m", "f13", kSig_i_v);
+ let f19 = builder.addImport("m", "f19", kSig_i_v);
+ let f23 = addConstFuncUsingMemory(builder, 23);
+ let call = builder.addFunction("call", kSig_i_i)
+ .addBody([
+ kExprGetLocal, 0,
+ kExprCallIndirect, signums.i_v, kTableZero
+ ])
+ .exportAs("call");
+ let f29 = addConstFuncUsingMemory(builder, 29);
+ builder.addFunctionTableInit(19, false, [f19], true);
+ builder.addFunctionTableInit(23, false, [f23], true);
+ builder.addFunctionTableInit(29, false, [f29], true);
+ builder.addFunctionTableInit(5, false, [call.index], true);
+
+ var mod2 = builder.toModule();
+ }
+
+ var table = new WebAssembly.Table({initial: kTableSize,
+ maximum: kTableSize, element: "anyfunc"});
+ var i1 = new WebAssembly.Instance(mod1, {m: {table: table}});
+
+ var i2 = new WebAssembly.Instance(mod2,
+ {m: {table: table, f13: i1.exports.f13, f19: i1.exports.f19}});
+
+ for (i of [13, 19, 23, 29]) {
+ print(i);
+ assertEquals(i, i1.exports.call(i));
+ assertEquals(i, i2.exports.call(i));
+ }
+ for (i of [0, 1, 5, 16]) {
+ assertThrows(() => i1.exports.call(i));
+ assertThrows(() => i2.exports.call(i));
+ }
+})();
diff --git a/doc/api/async_hooks.md b/doc/api/async_hooks.md
index 6a6cc781a79f1f..ac38f8093567b7 100644
--- a/doc/api/async_hooks.md
+++ b/doc/api/async_hooks.md
@@ -150,9 +150,9 @@ Because printing to the console is an asynchronous operation, `console.log()`
will cause the AsyncHooks callbacks to be called. Using `console.log()` or
similar asynchronous operations inside an AsyncHooks callback function will thus
cause an infinite recursion. An easy solution to this when debugging is to use a
-synchronous logging operation such as `fs.writeSync(process.stdout.fd, msg)`.
-This will print to stdout and will not invoke AsyncHooks recursively because it
-is synchronous.
+synchronous logging operation such as `fs.writeFileSync(file, msg, flag)`.
+This will print to the file and will not invoke AsyncHooks recursively because
+it is synchronous.
```js
const fs = require('fs');
@@ -160,7 +160,7 @@ const util = require('util');
function debug(...args) {
// use a function like this one when debugging inside an AsyncHooks callback
- fs.writeSync(process.stdout.fd, `${util.format(...args)}\n`);
+ fs.writeFileSync('log.out', `${util.format(...args)}\n`, { flag: 'a' });
}
```
@@ -330,17 +330,20 @@ async_hooks.createHook({
},
before(asyncId) {
const indentStr = ' '.repeat(indent);
- fs.writeSync(process.stdout.fd, `${indentStr}before: ${asyncId}\n`);
+ fs.writeFileSync('log.out',
+ `${indentStr}before: ${asyncId}\n`, { flag: 'a' });
indent += 2;
},
after(asyncId) {
indent -= 2;
const indentStr = ' '.repeat(indent);
- fs.writeSync(process.stdout.fd, `${indentStr}after: ${asyncId}\n`);
+ fs.writeFileSync('log.out',
+ `${indentStr}after: ${asyncId}\n`, { flag: 'a' });
},
destroy(asyncId) {
const indentStr = ' '.repeat(indent);
- fs.writeSync(process.stdout.fd, `${indentStr}destroy: ${asyncId}\n`);
+ fs.writeFileSync('log.out',
+ `${indentStr}destroy: ${asyncId}\n`, { flag: 'a' });
},
}).enable();
@@ -479,13 +482,12 @@ The ID returned from `executionAsyncId()` is related to execution timing, not
causality (which is covered by `triggerAsyncId()`):
```js
-const server = net.createServer(function onConnection(conn) {
+const server = net.createServer((conn) => {
// Returns the ID of the server, not of the new connection, because the
- // onConnection callback runs in the execution scope of the server's
- // MakeCallback().
+ // callback runs in the execution scope of the server's MakeCallback().
async_hooks.executionAsyncId();
-}).listen(port, function onListening() {
+}).listen(port, () => {
// Returns the ID of a TickObject (i.e. process.nextTick()) because all
// callbacks passed to .listen() are wrapped in a nextTick().
async_hooks.executionAsyncId();
diff --git a/doc/api/child_process.md b/doc/api/child_process.md
index 04f8fa8a3d9bb6..0681b6bc47c2f3 100644
--- a/doc/api/child_process.md
+++ b/doc/api/child_process.md
@@ -325,6 +325,9 @@ changes:
* `args` {string[]} List of string arguments.
* `options` {Object}
* `cwd` {string} Current working directory of the child process.
+ * `detached` {boolean} Prepare child to run independently of its parent
+ process. Specific behavior depends on the platform, see
+ [`options.detached`][]).
* `env` {Object} Environment key-value pairs.
* `execPath` {string} Executable used to create the child process.
* `execArgv` {string[]} List of string arguments passed to the executable.
diff --git a/doc/api/crypto.md b/doc/api/crypto.md
index a23b1fe5d4fa0a..79d30b580d8cba 100644
--- a/doc/api/crypto.md
+++ b/doc/api/crypto.md
@@ -2220,7 +2220,9 @@ request.
### crypto.randomFillSync(buffer[, offset][, size])
+
+* {string}
+
+The request authority pseudo header field. It can also be accessed via
+`req.headers[':authority']`.
+
#### request.destroy([error])
+
+* {string}
+
+The request scheme pseudo header field indicating the scheme
+portion of the target URL.
+
#### request.setTimeout(msecs, callback)
```js
const { Writable } = require('stream');
@@ -1531,6 +1532,7 @@ changes:
* `final` {Function} Implementation for the
[`stream._final()`][stream-_final] method.
+
```js
const { Writable } = require('stream');
@@ -1702,11 +1704,6 @@ required elements of a custom [`Writable`][] stream instance:
const { Writable } = require('stream');
class MyWritable extends Writable {
- constructor(options) {
- super(options);
- // ...
- }
-
_write(chunk, encoding, callback) {
if (chunk.toString().indexOf('a') >= 0) {
callback(new Error('chunk is invalid'));
@@ -1780,6 +1777,7 @@ constructor and implement the `readable._read()` method.
* `destroy` {Function} Implementation for the
[`stream._destroy()`][readable-_destroy] method.
+
```js
const { Readable } = require('stream');
@@ -2038,6 +2036,7 @@ changes:
* `writableHighWaterMark` {number} Sets `highWaterMark` for the writable side
of the stream. Has no effect if `highWaterMark` is provided.
+
```js
const { Duplex } = require('stream');
@@ -2192,6 +2191,7 @@ output on the `Readable` side is not consumed.
* `flush` {Function} Implementation for the [`stream._flush()`][stream-_flush]
method.
+
```js
const { Transform } = require('stream');
diff --git a/doc/api/url.md b/doc/api/url.md
index 84f9b3684ff0b2..0789ecf70cbe3d 100644
--- a/doc/api/url.md
+++ b/doc/api/url.md
@@ -73,7 +73,9 @@ const myURL =
### Class: URL
* `obj` {Object} An object representing a collection of key-value pairs
@@ -627,7 +633,9 @@ console.log(params.toString());
#### Constructor: new URLSearchParams(iterable)
* `iterable` {Iterable} An iterable object whose elements are key-value pairs
@@ -785,7 +793,9 @@ console.log(params.toString());
#### urlSearchParams.sort()
Sort all existing name-value pairs in-place by their names. Sorting is done
@@ -836,7 +846,9 @@ for (const [name, value] of params) {
### url.domainToASCII(domain)
* `domain` {string}
@@ -859,7 +871,9 @@ console.log(url.domainToASCII('xn--iñvalid.com'));
### url.domainToUnicode(domain)
* `domain` {string}
@@ -881,6 +895,9 @@ console.log(url.domainToUnicode('xn--iñvalid.com'));
```
### url.fileURLToPath(url)
+
* `url` {URL | string} The file URL string or URL object to convert to a path.
* Returns: {string} The fully-resolved platform-specific Node.js file path.
@@ -942,6 +959,9 @@ console.log(url.format(myURL, { fragment: false, unicode: true, auth: false }));
```
### url.pathToFileURL(path)
+
* `path` {string} The path to convert to a File URL.
* Returns: {URL} The file URL object.
diff --git a/doc/api/v8.md b/doc/api/v8.md
index e16e8645090713..2d76eb3a0f70f8 100644
--- a/doc/api/v8.md
+++ b/doc/api/v8.md
@@ -156,7 +156,7 @@ Usage:
// Print GC events to stdout for one minute.
const v8 = require('v8');
v8.setFlagsFromString('--trace_gc');
-setTimeout(function() { v8.setFlagsFromString('--notrace_gc'); }, 60e3);
+setTimeout(() => { v8.setFlagsFromString('--notrace_gc'); }, 60e3);
```
## Serialization API
diff --git a/doc/api/vm.md b/doc/api/vm.md
index d023d9c216903a..e8c4d1a6cbf2f2 100644
--- a/doc/api/vm.md
+++ b/doc/api/vm.md
@@ -167,10 +167,19 @@ const contextifiedSandbox = vm.createContext({ secret: 42 });
in stack traces produced by this `Module`.
* `columnOffset` {integer} Specifies the column number offset that is
displayed in stack traces produced by this `Module`.
- * `initalizeImportMeta` {Function} Called during evaluation of this `Module`
+ * `initializeImportMeta` {Function} Called during evaluation of this `Module`
to initialize the `import.meta`. This function has the signature `(meta,
module)`, where `meta` is the `import.meta` object in the `Module`, and
`module` is this `vm.SourceTextModule` object.
+ * `importModuleDynamically` {Function} Called during evaluation of this
+ module when `import()` is called. This function has the signature
+ `(specifier, module)` where `specifier` is the specifier passed to
+ `import()` and `module` is this `vm.SourceTextModule`. If this option is
+ not specified, calls to `import()` will reject with
+ [`ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING`][]. This method can return a
+ [Module Namespace Object][], but returning a `vm.SourceTextModule` is
+ recommended in order to take advantage of error tracking, and to avoid
+ issues with namespaces that contain `then` function exports.
Creates a new ES `Module` object.
@@ -436,6 +445,15 @@ changes:
The `cachedDataProduced` value will be set to either `true` or `false`
depending on whether code cache data is produced successfully.
This option is deprecated in favor of `script.createCachedData()`.
+ * `importModuleDynamically` {Function} Called during evaluation of this
+ module when `import()` is called. This function has the signature
+ `(specifier, module)` where `specifier` is the specifier passed to
+ `import()` and `module` is this `vm.SourceTextModule`. If this option is
+ not specified, calls to `import()` will reject with
+ [`ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING`][]. This method can return a
+ [Module Namespace Object][], but returning a `vm.SourceTextModule` is
+ recommended in order to take advantage of error tracking, and to avoid
+ issues with namespaces that contain `then` function exports.
Creating a new `vm.Script` object compiles `code` but does not run it. The
compiled `vm.Script` can be run later multiple times. The `code` is not bound to
@@ -977,6 +995,7 @@ This issue occurs because all contexts share the same microtask and nextTick
queues.
[`Error`]: errors.html#errors_class_error
+[`ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING`]: errors.html#ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING
[`URL`]: url.html#url_class_url
[`eval()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval
[`script.runInContext()`]: #vm_script_runincontext_contextifiedsandbox_options
@@ -985,6 +1004,7 @@ queues.
[`vm.createContext()`]: #vm_vm_createcontext_sandbox_options
[`vm.runInContext()`]: #vm_vm_runincontext_code_contextifiedsandbox_options
[`vm.runInThisContext()`]: #vm_vm_runinthiscontext_code_options
+[Module Namespace Object]: https://tc39.github.io/ecma262/#sec-module-namespace-exotic-objects
[ECMAScript Module Loader]: esm.html#esm_ecmascript_modules
[Evaluate() concrete method]: https://tc39.github.io/ecma262/#sec-moduleevaluation
[GetModuleNamespace]: https://tc39.github.io/ecma262/#sec-getmodulenamespace
diff --git a/doc/api/worker_threads.md b/doc/api/worker_threads.md
index 86b66fec90f9b4..ed4574ef441dd5 100644
--- a/doc/api/worker_threads.md
+++ b/doc/api/worker_threads.md
@@ -125,7 +125,7 @@ structured data, memory regions and other `MessagePort`s between different
[`Worker`][]s.
With the exception of `MessagePort`s being [`EventEmitter`][]s rather
-than `EventTarget`s, this implementation matches [browser `MessagePort`][]s.
+than [`EventTarget`][]s, this implementation matches [browser `MessagePort`][]s.
### Event: 'close'
+* Extends: {EventEmitter}
+
The `Worker` class represents an independent JavaScript execution thread.
Most Node.js APIs are available inside of it.
@@ -305,10 +307,10 @@ if (isMainThread) {
* `filename` {string} The path to the Worker’s main script. Must be
either an absolute path or a relative path (i.e. relative to the
current working directory) starting with `./` or `../`.
- If `options.eval` is true, this is a string containing JavaScript code rather
- than a path.
+ If `options.eval` is `true`, this is a string containing JavaScript code
+ rather than a path.
* `options` {Object}
- * `eval` {boolean} If true, interpret the first argument to the constructor
+ * `eval` {boolean} If `true`, interpret the first argument to the constructor
as a script that is executed once the worker is online.
* `workerData` {any} Any JavaScript value that will be cloned and made
available as [`require('worker_threads').workerData`][]. The cloning will
@@ -461,6 +463,7 @@ active handle in the event system. If the worker is already `unref()`ed calling
[`Buffer`]: buffer.html
[`EventEmitter`]: events.html
+[`EventTarget`]: https://developer.mozilla.org/en-US/docs/Web/API/EventTarget
[`MessagePort`]: #worker_threads_class_messageport
[`SharedArrayBuffer`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer
[`Uint8Array`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array
diff --git a/doc/changelogs/CHANGELOG_V10.md b/doc/changelogs/CHANGELOG_V10.md
index 7f54626bd06c1a..43dafabeb5b30c 100644
--- a/doc/changelogs/CHANGELOG_V10.md
+++ b/doc/changelogs/CHANGELOG_V10.md
@@ -10,6 +10,7 @@