summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2019-10-13src: implement v8 host weakref hooksGus Caplan
PR-URL: https://github.com/nodejs/node/pull/29874 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2019-10-13src: render N-API weak callbacks as cleanup hooksGabriel Schulhof
Since worker threads are complete Node.js environments, including the ability to load native addons, and since those native addons can allocate resources to be freed when objects go out of scope, and since, upon worker thread exit, the engine does not invoke the weak callbacks responsible for freeing resources which still have references, this modification introduces tracking for weak references such that a list of outstanding weak references is maintained. This list is traversed during environment teardown. The callbacks for the remaining weak references are called. This change is also relevant for Node.js embedder scenarios, because in those cases the process also outlives the `node::Environment` and therefore weak callbacks should also be rendered as environment cleanup hooks to ensure proper cleanup after native addons. This changes introduces the means by which this can be accomplished. A benchmark is included which measures the time it takes to execute the weak reference callback for a given number of weak references. Re: https://github.com/tc39/proposal-weakrefs/issues/125#issuecomment-535832130 PR-URL: https://github.com/nodejs/node/pull/28428 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
2019-10-11src: fix largepages regressionGabriel Schulhof
During the addition of macOS support for large pages, a `memcpy` ended up under the wrong preprocessor directive. As a result, the newly allocated large pages were not initialized with a copy of the text section. Thanks to Suresh Srinivas <suresh.srinivas@intel.com>! PR-URL: https://github.com/nodejs/node/pull/29914 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com>
2019-10-11fs: buffer dir entries in opendir()Anna Henningsen
Read up to 32 directory entries in one batch when `dir.readSync()` or `dir.read()` are called. This increases performance significantly, although it introduces quite a bit of edge case complexity. confidence improvement accuracy (*) (**) (***) fs/bench-opendir.js mode='async' dir='lib' n=100 *** 155.93 % ±30.05% ±40.34% ±53.21% fs/bench-opendir.js mode='async' dir='test/parallel' n=100 *** 479.65 % ±56.81% ±76.47% ±101.32% fs/bench-opendir.js mode='sync' dir='lib' n=100 10.38 % ±14.39% ±19.16% ±24.96% fs/bench-opendir.js mode='sync' dir='test/parallel' n=100 *** 63.13 % ±12.84% ±17.18% ±22.58% PR-URL: https://github.com/nodejs/node/pull/29893 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2019-10-10esm: unflag --experimental-exportsGuy Bedford
PR-URL: https://github.com/nodejs/node/pull/29867 Reviewed-By: Jan Krems <jan.krems@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2019-10-10src: remove unused using declarations in worker.ccDaniel Bevenius
This commit removes unused using declarations in src/node_worker.cc. PR-URL: https://github.com/nodejs/node/pull/29883 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2019-10-10src: bring 425 status code name into accordance with RFC 8470Sergei Osipov
PR-URL: https://github.com/nodejs/node/pull/29880 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com>
2019-10-08worker: do not use two-arg NewIsolateShelley Vohr
PR-URL: https://github.com/nodejs/node/pull/29850 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2019-10-08Revert "esm: remove experimental status from JSON modules"Guy Bedford
This reverts commit ec8776da6fa77628e12718bb38cee687303d4137. PR-URL: https://github.com/nodejs/node/pull/29754 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Myles Borins <myles.borins@gmail.com>
2019-10-08fs: introduce `opendir()` and `fs.Dir`Jeremiah Senkpiel
This adds long-requested methods for asynchronously interacting and iterating through directory entries by using `uv_fs_opendir`, `uv_fs_readdir`, and `uv_fs_closedir`. `fs.opendir()` and friends return an `fs.Dir`, which contains methods for doing reads and cleanup. `fs.Dir` also has the async iterator symbol exposed. The `read()` method and friends only return `fs.Dirent`s for this API. Having a entry type or doing a `stat` call is deemed to be necessary in the majority of cases, so just returning dirents seems like the logical choice for a new api. Reading when there are no more entries returns `null` instead of a dirent. However the async iterator hides that (and does automatic cleanup). The code lives in separate files from the rest of fs, this is done partially to prevent over-pollution of those (already very large) files, but also in the case of js allows loading into `fsPromises`. Due to async_hooks, this introduces a new handle type of `DIRHANDLE`. This PR does not attempt to make complete optimization of this feature. Notable future improvements include: - Moving promise work into C++ land like FileHandle. - Possibly adding `readv()` to do multi-entry directory reads. - Aliasing `fs.readdir` to `fs.scandir` and doing a deprecation. Refs: https://github.com/nodejs/node-v0.x-archive/issues/388 Refs: https://github.com/nodejs/node/issues/583 Refs: https://github.com/libuv/libuv/pull/2057 PR-URL: https://github.com/nodejs/node/pull/29349 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: David Carlier <devnexen@gmail.com>
2019-10-07src: update NODE_MODULE_VERSION to 79Myles Borins
Major V8 updates are usually API/ABI incompatible with previous versions. This commit adapts NODE_MODULE_VERSION for V8 7.8. Refs: https://github.com/nodejs/CTC/blob/master/meetings/2016-09-28.md PR-URL: https://github.com/nodejs/node/pull/29694 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com>
2019-10-06module: use v8 synthetic modulesGuy Bedford
PR-URL: https://github.com/nodejs/node/pull/29846 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
2019-10-05dgram: use `uv_udp_try_send()`Anna Henningsen
This improves dgram performance by avoiding unnecessary async operations. One issue with this commit is that it seems hard to actually create conditions under which the fallback path to the async case is actually taken, for all supported OS, so an internal CLI option is used for testing that path. Another caveat is that the lack of an async operation means that there are slight timing differences (essentially `nextTick()` rather than `setImmediate()` for the send callback). PR-URL: https://github.com/nodejs/node/pull/29832 Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2019-10-05process: add source-map support to stack tracesbcoe
PR-URL: https://github.com/nodejs/node/pull/29564 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2019-10-05http2: set default maxConcurrentStreamsZYSzys
Set the default maxConcurrentStreams to NGHTTP2_DEFAULT_MAX_CONCURRENT_STREAMS. PR-URL: https://github.com/nodejs/node/pull/29833 Fixes: https://github.com/nodejs/node/issues/29763 Refs: https://github.com/nghttp2/nghttp2/commit/16c46114dc724278beaa6d59462f8396f35fa4a9 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
2019-10-04inspector: update faviconUrldokugo
PR-URL: https://github.com/nodejs/node/pull/29562 Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2019-10-03src: fix ESM path resolution on WindowsThomas
Windows has some reserved file names such as "con", "prn", "nul", etc. Such files can be accessed only if the path is prefixed with "\\.\" PR-URL: https://github.com/nodejs/node/pull/29574 Reviewed-By: Guy Bedford <guybedford@gmail.com>
2019-10-03crypto: remove arbitrary UTF16 restrictionAnna Henningsen
Since 71f633a32f1f5617, this is no longer necessary. Refs: https://github.com/nodejs/node/pull/22622 Fixes: https://github.com/nodejs/node/issues/29793 PR-URL: https://github.com/nodejs/node/pull/29795 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com>
2019-10-02vm: refactor SourceTextModuleGus Caplan
- Removes redundant `instantiate` method - Refactors `link` to match the spec linking steps more accurately - Removes URL validation from SourceTextModule specifiers - DRYs some dynamic import logic Closes: https://github.com/nodejs/node/issues/29030 Co-Authored-By: Michaël Zasso <targos@protonmail.com> PR-URL: https://github.com/nodejs/node/pull/29776 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
2019-09-30src: rename --loader to --experimental-loaderAlex Aubuchon
Renames the `--loader` cli argument to `--experimental-loader`. This is to clearly indicate the esm loader feature as experimental even after esm is no longer experimental. Also minorly alters the `--experimental-loader` docs to say that the passed loader can be an esm module. Refs: https://github.com/nodejs/modules/issues/351#issuecomment-535189524 PR-URL: https://github.com/nodejs/node/pull/29752 Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2019-09-27tls: add option for private keys for OpenSSL enginesAnton Gerasimov
Add `privateKeyIdentifier` and `privateKeyEngine` options to get private key from an OpenSSL engine in tls.createSecureContext(). PR-URL: https://github.com/nodejs/node/pull/28973 Reviewed-By: Rod Vagg <rod@vagg.org> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
2019-09-25src: fix asan build for gcc/clangDavid Carlier
Add missing header for LSAN. PR-URL: https://github.com/nodejs/node/pull/29383 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
2019-09-26src: fix compiler warning in inspector_profiler.ccDaniel Bevenius
Currently, the following compiler warnings is generated: ../src/inspector_profiler.cc:231:5: warning: ignoring return value of function declared with 'warn_unused_result' attribute [-Wunused-result] profile->Set(context, FIXED_ONE_BYTE_STRING(isolate, "source-map-cache") ^~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 warning generated. This commit adds a .ToChecked() call to avoid the warning. PR-URL: https://github.com/nodejs/node/pull/29660 Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Minwoo Jung <minwoo@nodesource.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2019-09-24src: add buildflag to force context-aware addonsShelley Vohr
PR-URL: https://github.com/nodejs/node/pull/29631 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2019-09-24worker: keep allocators for transferred SAB instances alive longerAnna Henningsen
Keep the `ArrayBuffer::Allocator` behind a `SharedArrayBuffer` instance alive for at least as long as the receiving Isolate lives, if the `SharedArrayBuffer` instance isn’t already destroyed through GC. This is to work around the fact that V8 7.9 started refactoring how backing stores for `SharedArrayBuffer` instances work, changing the timing of the call that releases the backing store to be during Isolate disposal. The flag added to the test is optional but helps verify that the backing store is actually free’d at the end of the test and does not leak memory. Fixes: https://github.com/nodejs/node-v8/issues/115 PR-URL: https://github.com/nodejs/node/pull/29637 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2019-09-24src: try showing stack traces when process._fatalException is not setJoyee Cheung
So that the stack trace of errors shown in internal code run during bootstrap (before process._fatalException is set) can be printed. PR-URL: https://github.com/nodejs/node/pull/29624 Refs: https://github.com/nodejs/node/pull/29593 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2019-09-24src: disconnect inspector before exiting out of fatal exceptionJoyee Cheung
So that coverage, .etc are properly written in case of a normal fatal exception. PR-URL: https://github.com/nodejs/node/pull/29611 Fixes: https://github.com/nodejs/node/issues/29570 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Ben Coe <bencoe@gmail.com>
2019-09-23tls: add option to override signature algorithmsAnton Gerasimov
Passes the list down to SSL_CTX_set1_sigalgs_list. Option to get the list of shared signature algorithms from a TLS socket added as well for testing. Signed-off-by: Anton Gerasimov <agerasimov@twilio.com> PR-URL: https://github.com/nodejs/node/pull/29598 Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Anna Henningsen <anna@addaleax.net>
2019-09-22src: perform check before running in runMicrotasks()Jeremy Apthorp
This is a continuation of https://github.com/nodejs/node/pull/29434, rewriting the last remaining call to RunMicrotasks. PR-URL: https://github.com/nodejs/node/pull/29581 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Shelley Vohr <codebytere@gmail.com> Reviewed-By: Minwoo Jung <minwoo@nodesource.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2019-09-22src: discard remaining foreground tasks on platform shutdownAnna Henningsen
While V8 itself should not have any remaining tasks on the queue during platform shutdown, our inspector implementation may do so. Thus, the checks verifying that no tasks are queued at that point make some of the inspector tasks flaky. Remove the checks and replace them by explicitly destroying all tasks that are left. Refs: https://github.com/nodejs/node/pull/25653 Refs: https://github.com/nodejs/node/pull/28870#issuecomment-531908090 PR-URL: https://github.com/nodejs/node/pull/29587 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com> Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
2019-09-22crypto: use BoringSSL-compatible flag getterShelley Vohr
PR-URL: https://github.com/nodejs/node/pull/29604 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2019-09-22process: initial SourceMap support via NODE_V8_COVERAGEBenjamin Coe
PR-URL: https://github.com/nodejs/node/pull/28960 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com>
2019-09-21src: fix closing weak `HandleWrap`s on GCAnna Henningsen
In 0af62aae07ccbb3783030367ffe4, this was overlooked, with it possibly leading to hard crashes. Refs: https://github.com/nodejs/node/pull/29317 PR-URL: https://github.com/nodejs/node/pull/29640 Reviewed-By: Ben Coe <bencoe@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
2019-09-20http: remove legacy parserAnna Henningsen
Remove the legacy `http_parser` implementation as a dependency and all code that uses it in favor of llhttp, given that the latter has been the default for all of Node 12 with no outstanding issues. PR-URL: https://github.com/nodejs/node/pull/29589 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Minwoo Jung <minwoo@nodesource.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2019-09-19module: error for CJS .js load within type: moduleGuy Bedford
PR-URL: https://github.com/nodejs/node/pull/29492 Reviewed-By: Jan Krems <jan.krems@gmail.com>
2019-09-18src: use libuv to get env varsAnna Henningsen
This allows us to remove OS-dependent code. confidence improvement accuracy (*) (**) (***) process/bench-env.js operation='delete' n=1000000 3.57 % ±10.86% ±14.46% ±18.85% process/bench-env.js operation='enumerate' n=1000000 *** -14.06 % ±7.46% ±9.94% ±12.96% process/bench-env.js operation='get' n=1000000 -7.97 % ±11.80% ±15.70% ±20.45% process/bench-env.js operation='query' n=1000000 -1.32 % ±8.38% ±11.17% ±14.58% process/bench-env.js operation='set' n=1000000 -0.98 % ±9.63% ±12.81% ±16.68% The drop in enumeration performance is likely due to the large number of extra allocations that libuv performs. However, enumerating process.env should generally not be a hot path in most applications. PR-URL: https://github.com/nodejs/node/pull/29188 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2019-09-18src: re-delete Atomics.wakeGus Caplan
PR-URL: https://github.com/nodejs/node/pull/29586 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com>
2019-09-17module: reintroduce package exports dot mainGuy Bedford
This reintroduces the dot main in exports as discussed in the previous Node.js modules meeting. The implementation includes both CommonJS and ES module resolution with the associated documentation and resolver specification changes. In addition to the dot main, "exports" as a string or direct fallback array is supported as well. Co-Authored-By: Geoffrey Booth <GeoffreyBooth@users.noreply.github.com> PR-URL: https://github.com/nodejs/node/pull/29494 Reviewed-By: Jan Krems <jan.krems@gmail.com> Reviewed-By: Myles Borins <myles.borins@gmail.com>
2019-09-16inspector: new API - Session.connectToMainThreadEugene Ostroukhov
This API is designed to enable worker threads use Inspector protocol on main thread (and other workers through NodeWorker domain). Note that worker can cause dead lock by suspending itself. I will work on a new API that will allow workers to be hidden from the inspector. Fixes: https://github.com/nodejs/node/issues/28828 PR-URL: https://github.com/nodejs/node/pull/28870 Reviewed-By: Aleksei Koziatinskii <ak239spb@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2019-09-16src: print exceptions from PromiseRejectCallbackAnna Henningsen
Previously, leaving the exception lying around would leave the JS engine in an invalid state, as it was not expecting exceptions to be thrown from the C++ `PromiseRejectCallback`, and lead to hard crashes under some conditions (e.g. with coverage enabled). PR-URL: https://github.com/nodejs/node/pull/29513 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2019-09-13util: add encodeInto to TextEncoderAnna Henningsen
Add function encodeInto to TextEncoder, and add MessageChannel to the encodeInto.any.js test. Fixes: https://github.com/nodejs/node/issues/28851 Fixes: https://github.com/nodejs/node/issues/26904 Refs: https://github.com/nodejs/node/pull/28862 Co-authored-by: AtticusYang <yyongtai@163.com> PR-URL: https://github.com/nodejs/node/pull/29524 Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2019-09-13crypto: fix OpenSSL return code handlingTobias Nießen
PR-URL: https://github.com/nodejs/node/pull/29489 Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Minwoo Jung <minwoo@nodesource.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2019-09-13crypto: add oaepLabel optionTobias Nießen
The label acts as the "L" input to the RSA-OAEP algorithm. PR-URL: https://github.com/nodejs/node/pull/29489 Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Minwoo Jung <minwoo@nodesource.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2019-09-12src: modified RealEnvStore methods to use libuv functionsDevendra Satram
Modified RealEnvStore::Get, Set, Query and Delete methods to use libuv methods environment variables operations instead of using os specific logic and switches. Fixes: https://github.com/nodejs/node/issues/27211 Refs: http://docs.libuv.org/en/v1.x/misc.html PR-URL: https://github.com/nodejs/node/pull/27310 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
2019-09-11src,lib: expose memory file mapping flagJoão Reis
Support for UV_FS_O_FILEMAP was added in libuv in version 1.31.0. This exposes the flag in fs.constants. Refs: https://github.com/libuv/libuv/pull/2295 PR-URL: https://github.com/nodejs/node/pull/29260 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Ron Korving <ron@ronkorving.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
2019-09-09worker: prevent event loop starvation through MessagePortsAnna Henningsen
Limit the number of messages processed without interruption on a given `MessagePort` to prevent event loop starvation, but still make sure that all messages are emitted that were already in the queue when emitting began. This aligns the behaviour better with the web. Refs: https://github.com/nodejs/node/pull/28030 PR-URL: https://github.com/nodejs/node/pull/29315 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2019-09-08n-api: delete callback bundle via referenceGabriel Schulhof
We should strive to use weak persistent references consistently throughout the code, since using `v8::Persistent` directly results in having to change many sites in the code when the way we use it changes. N-API uses `v8impl::Reference` internally when maintaining a weak persistent reference is necessary. So far, `v8impl::CallbackBundle` was using `v8::Persistent` directly in order to weakly reference the JS function backed by a N-API callback. The change introduced here reduces `v8impl::CallbackBundle` to a simple structure and uses a `v8impl::Reference` to weakly reference the N-API callback with which it is associated. The structure is freed by the `napi_finalize` callback of the `v8impl::Reference`. This brings N-API use of `v8::Persistent` completely under the `v8impl::Reference` umbrella, rendering our use of weak references consistent. PR-URL: https://github.com/nodejs/node/pull/29479 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Anna Henningsen <anna@addaleax.net>
2019-09-07src: make ELDHistogram a HandleWrapAnna Henningsen
This simplifies the implementation of ELDHistogram a bit, and more generally allows us to have weak JS references associated with `HandleWrap`s. PR-URL: https://github.com/nodejs/node/pull/29317 Reviewed-By: James M Snell <jasnell@gmail.com>
2019-09-07perf_hooks: remove GC callbacks on zero observers countKirill Fomichev
When all existed PerformanceObserver instances removed for type `gc` GC callbacks should be removed. PR-URL: https://github.com/nodejs/node/pull/29444 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
2019-09-06http2: send out pending data earlierAnna Henningsen
If there’s a lot of data waiting on a given stream, send it out early, if possible. This helps trigger the backpressure mechanism introduced in 8a4a1931b8b98 at a better time. PR-URL: https://github.com/nodejs/node/pull/29398 Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>