0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
Commit Graph

26005 Commits

Author SHA1 Message Date
Anna Henningsen
28db96f31c
zlib: report premature ends earlier
Report end-of-stream when decompressing when we detect it,
and do not wait until the writable side of a zlib stream
is closed as well.

Refs: https://github.com/nodejs/node/issues/26332

PR-URL: https://github.com/nodejs/node/pull/26363
Refs: https://github.com/nodejs/node/issues/26332
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
2019-03-04 00:13:40 +01:00
Anna Henningsen
a0778a97e1
repl: use object writer for thrown errors
This makes us use the defaults that were set for the REPL, i.e.
aligns with the printing of expression completion values, and in
particular enables color support.

PR-URL: https://github.com/nodejs/node/pull/26361
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2019-03-04 00:12:07 +01:00
Ruben Bridgewater
6c38fcff1d
test: only inspect on failure
The inspection was done in all cases so far and that's not necessary.
Therefore this changed this behavior to only inspect the input on
failure cases.

PR-URL: https://github.com/nodejs/node/pull/26360
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2019-03-03 23:33:46 +01:00
Ruben Bridgewater
f871c80a6d
tty: improve color detection
1) Using `process.env.TERM = 'dumb'` should never return any colors.
2) `process.env.TERM = 'terminator'` supports 24 bit colors.
3) Add support for `process.env.TERM = 'rxvt-unicode-24bit'`
4) `Hyper` does not support true colors anymore. It should fall back
   to the xterm settings in regular cases.
5) `process.env.COLORTERM = 'truecolor'` should return 24 bit colors.

PR-URL: https://github.com/nodejs/node/pull/26264
Refs: https://github.com/nodejs/node/pull/26261
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2019-03-03 23:31:44 +01:00
Ruben Bridgewater
7f2d2cdc0c
test: always activate colors if necessary
PR-URL: https://github.com/nodejs/node/pull/26264
Refs: https://github.com/nodejs/node/pull/26261
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2019-03-03 23:31:43 +01:00
Rich Trott
d773311c33 doc: edit deprecation identifier info in Collaborator Guide
Edit the deprecation identifier material in the Collaborator Guide for
simplicity and clarity.

PR-URL: https://github.com/nodejs/node/pull/26372
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
2019-03-03 14:07:14 -08:00
Guy Bedford
ccaebdef66 esm: process proxy Symbol.toString fix
PR-URL: https://github.com/nodejs/node/pull/25963
Reviewed-By: John-David Dalton <john.david.dalton@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2019-03-03 18:20:45 +02:00
Juan José Arboleda
1d97374f69 src: remove already elevated Isolate namespce
PR-URL: https://github.com/nodejs/node/pull/26294
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2019-03-03 12:23:22 +05:30
gengjiawen
d16cfa4d7d src: remove unused macro in env.cc
PR-URL: https://github.com/nodejs/node/pull/26273
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2019-03-03 12:17:59 +05:30
Rich Trott
60a148ad2e tools: update extend to 3.0.2
Update `extend` to 3.0.2 as 3.0.1 is susceptible to a low-severity
security issue.

Refs: https://snyk.io/vuln/npm:extend:20180424

PR-URL: https://github.com/nodejs/node/pull/26392
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Masashi Hirano <shisama07@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2019-03-02 18:58:09 -08:00
Rich Trott
b97cd9b932 tools: remove unneeded .gitignore entries
Remove entries from `.gitignore` that are already covered by the generic
`.*` entry on line 2 of the .gitignore file.

PR-URL: https://github.com/nodejs/node/pull/26370
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2019-03-02 18:56:43 -08:00
cjihrig
f9cd5e3094
doc,lib,test: rename node-report to report
This commit completes the renaming of node-report to report
in order to better differentiate core's reporting from the
node-report npm module.

PR-URL: https://github.com/nodejs/node/pull/26371
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2019-03-02 21:17:33 -05:00
cjihrig
fe292fac55
test: rename node-report suite to report
This commit renames the "node-report" test suite to "report"
in order to begin differentiating core's diagnostic reporting
from the original node-report module on npm

PR-URL: https://github.com/nodejs/node/pull/26371
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2019-03-02 21:17:19 -05:00
cjihrig
060af324ae
test: improve validation of report output
This commit improves the validation of generated diagnostic
reports.

PR-URL: https://github.com/nodejs/node/pull/26289
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2019-03-02 18:06:48 -05:00
Matteo Collina
b1ef279d57 events: add once method to use promises with EventEmitter
This change adds a EventEmitter.once() method that wraps ee.once in a
promise.

Co-authored-by: David Mark Clements <david.mark.clements@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/26078
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
2019-03-02 19:17:45 +01:00
Sebastiaan Deckers
2a5edafabd
doc: maxReservedRemoteStreams value constraints
PR-URL: https://github.com/nodejs/node/pull/26309
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2019-03-02 14:12:35 +01:00
Beni von Cheni
8f87080fcd
doc: correct typos in various docs
PR-URL: https://github.com/nodejs/node/pull/26312
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Beth Griggs <Bethany.Griggs@uk.ibm.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2019-03-02 14:10:30 +01:00
Rich Trott
536e062c2c
tools: update babel-eslint to 10.0.1
Update babel-eslint to 10.0.1.

PR-URL: https://github.com/nodejs/node/pull/26347
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Shingo Inoue <leko.noor@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2019-03-02 14:05:15 +01:00
Ben Noordhuis
99797cc9cd
build: make 'floating patch' message informational
Downgrade the 'Using floating patch' message that is emitted
when a local patch is applied to the bundled ICU from a warning
to a notice. There isn't anything the user can or should do so
warning isn't appropriate. Instead of angry yellow use soothing green.

Fixes: https://github.com/nodejs/node/issues/26346

PR-URL: https://github.com/nodejs/node/pull/26349
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
2019-03-02 14:01:47 +01:00
Anna Henningsen
f65b4afaea
worker: provide process.execArgv
Provide `process.execArgv`. If an `execArgv` option is passed to the
`Worker` constructor, that option is used as its value; if not,
the parent’s `process.execArgv` is inherited (since that also goes
for the actual options in that case).

PR-URL: https://github.com/nodejs/node/pull/26267
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2019-03-02 13:16:35 +01:00
Tobias Nießen
b8018f407b
crypto: move DEP0113 to End-of-Life
PR-URL: https://github.com/nodejs/node/pull/26249
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2019-03-02 10:58:12 +01:00
Rich Trott
f11e8b959d tools: update eslint-plugin-markdown to 1.0.0
For eslint-plugin-markdown, we had been using an RC but can now use the
most recent stable release of 1.0.0, as it has the bugfix that caused us
to start using the RC in the first place.

There are a few other updates in this commit too because it was
performed by running `update-eslint.sh`. This did not update ESLint
itself but did update some dependencies.

PR-URL: https://github.com/nodejs/node/pull/26345
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2019-03-01 22:55:28 -08:00
Rich Trott
e0c39218d9 tools: use latest rather than next for markdown linting plugin
eslint-plugin-markdown is being installed @next to get a bugfix for
https://github.com/eslint/eslint-plugin-markdown/issues/69 but that
bugfix is in 1.0.0. Go back to installing @latest rather than @next.

PR-URL: https://github.com/nodejs/node/pull/26345
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2019-03-01 22:55:09 -08:00
Luigi Pinca
144f876c68 doc: sort http.request() options alphabetically
PR-URL: https://github.com/nodejs/node/pull/26152
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2019-03-02 07:50:52 +01:00
Luigi Pinca
f42bf397bd doc: add documentation for the defaultPort option
PR-URL: https://github.com/nodejs/node/pull/26152
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2019-03-02 07:50:44 +01:00
gengjiawen
453ed05343
src: remove unused macro in node_http2.h
PR-URL: https://github.com/nodejs/node/pull/26204
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
2019-03-02 00:13:12 +01:00
gengjiawen
f1d846b3b7
src: remove redundant cast in PipeWrap::Fchmod
PR-URL: https://github.com/nodejs/node/pull/26242
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2019-03-02 00:12:16 +01:00
Thomas
e9ed6b988f
console: prevent constructing console methods
Ref: https://github.com/nodejs/node/issues/25987

PR-URL: https://github.com/nodejs/node/pull/26096
Refs: https://github.com/nodejs/node/issues/25987
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com>
2019-03-02 00:07:53 +01:00
Richard Lau
fc4c0de92f
report: add fallback for uv_getnameinfo() failures
Attempt to report the host and port in the case that uv_getnameinfo()
fails.

PR-URL: https://github.com/nodejs/node/pull/26140
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2019-03-02 00:02:05 +01:00
Anna Henningsen
d64e4deb73
src: simplify native immediate by using v8::Global
Unlike `node::Persistent`, `v8::Global` has move semantics and
can be used directly in STL containers.

PR-URL: https://github.com/nodejs/node/pull/26254
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2019-03-01 22:46:24 +01:00
Anna Henningsen
018e95ad13
dns: refactor QueryWrap lifetime management
- Prefer RAII-style management over manual resource management.
- Prefer `env->SetImmediate()` over a separate `uv_async_t`.
- Perform `ares_destroy()` before possibly tearing down c-ares state.
- Verify that the number of active queries is non-negative.
- Let pending callbacks know when their underlying `QueryWrap` object
  has been destroyed.

The last item has been a real bug, in that when Workers shut down
during currently running DNS queries, they may run into use-after-free
situations because:

1. Shutting the `Worker` down leads to the cleanup code deleting
   the `QueryWrap` objects first; then
2. deleting the `ChannelWrap` object (as it has been created before
   the `QueryWrap`s), whose destructor runs `ares_destroy()`, which
   in turn invokes all pending query callbacks with `ARES_ECANCELLED`,
3. which lead to use-after-free, as the callback tried to access the
   deleted `QueryWrap` object.

The added test verifies that this is no longer an issue.

PR-URL: https://github.com/nodejs/node/pull/26253
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2019-03-01 22:18:26 +01:00
Anna Henningsen
adbe3b837e
test: verify heap buffer allocations occur
Check that small typed arrays, including `Buffer`s (unless allocated
by `Buffer.allocUnsafe()`), are indeed heap-allocated.

PR-URL: https://github.com/nodejs/node/pull/26301
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2019-03-01 21:58:08 +01:00
Anna Henningsen
6a0f4636d9
buffer: avoid materializing ArrayBuffer for creation
Do not create an `ArrayBuffer` if the engine’s settings avoid it
and we don’t need it.

PR-URL: https://github.com/nodejs/node/pull/26301
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2019-03-01 21:58:06 +01:00
Anna Henningsen
31975bbc88
src: allow not materializing ArrayBuffers from C++
Where appropriate, use a helper that wraps around
`ArrayBufferView::Buffer()` or `ArrayBufferView::CopyContents()`
rather than `Buffer::Data()`, as that may help to avoid materializing
the underlying `ArrayBuffer` when reading small typed arrays from C++.
This allows keeping the performance benefits of the faster creation of
heap-allocated small typed arrays in many cases.

PR-URL: https://github.com/nodejs/node/pull/26301
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2019-03-01 21:57:54 +01:00
Anna Henningsen
b42dcb0eeb
build: remove v8_typed_array_max_size_in_heap option
This was added in 16f86d6c57, based on
the assumption that otherwise, the memory behind `ArrayBuffer`
instances could be moved around on the heap while native code
holds references to it.

This does not match what V8 actually does (and also did at the time):

- The option/build variable was about always only about TypedArrays,
  not ArrayBuffers. Calls like `new ArrayBuffer(4)` call into C++
  regardless of the option value, but calls like `new Uint8Array(4)`
  would not call into C++ under V8 defaults.
- When first accessing a heap-allocated TypedArray’s `ArrayBuffer`,
  whether that is through the JS `.buffer` getter or the C++
  `ArrayBufferView::Buffer()` function, a copy of the contents is
  created using the ArrayBuffer allocator and stored as the
  (permanent, unmovable) backing store.

As a consequence, the memory returned by `ArrayBuffer::GetContents()`
is not moved around, because it is fixed once the `ArrayBuffer`
object itself first comes into explicit existence in any way.

Removing this build option significantly speeds up creation of typed
arrays from JS:

    $ ./node benchmark/compare.js --new ./node --old ./node-master --runs 10 --filter buffer-creation.js buffers | Rscript benchmark/compare.R
                                                                         confidence improvement accuracy (*)     (**)    (***)
     buffers/buffer-creation.js n=1024 len=10 type='buffer()'                  ***    593.66 %      ±28.64%  ±41.10%  ±60.36%
     buffers/buffer-creation.js n=1024 len=10 type='fast-alloc-fill'           ***    675.42 %      ±90.67% ±130.24% ±191.54%
     buffers/buffer-creation.js n=1024 len=10 type='fast-alloc'                ***    663.55 %      ±58.41%  ±83.87% ±123.29%
     buffers/buffer-creation.js n=1024 len=10 type='fast-allocUnsafe'                   3.10 %       ±9.63%  ±13.22%  ±18.07%
     buffers/buffer-creation.js n=1024 len=10 type='slow-allocUnsafe'                   4.67 %       ±5.55%   ±7.77%  ±10.97%
     buffers/buffer-creation.js n=1024 len=10 type='slow'                              -2.48 %       ±4.47%   ±6.12%   ±8.34%
     buffers/buffer-creation.js n=1024 len=1024 type='buffer()'                        -1.91 %       ±4.71%   ±6.45%   ±8.79%
     buffers/buffer-creation.js n=1024 len=1024 type='fast-alloc-fill'                 -1.34 %       ±7.53%  ±10.33%  ±14.10%
     buffers/buffer-creation.js n=1024 len=1024 type='fast-alloc'                       0.52 %       ±5.00%   ±6.87%   ±9.40%
     buffers/buffer-creation.js n=1024 len=1024 type='fast-allocUnsafe'                 0.39 %       ±5.65%   ±7.78%  ±10.67%
     buffers/buffer-creation.js n=1024 len=1024 type='slow-allocUnsafe'                -0.13 %       ±5.68%   ±7.83%  ±10.77%
     buffers/buffer-creation.js n=1024 len=1024 type='slow'                            -5.07 %       ±7.15%   ±9.80%  ±13.35%
     buffers/buffer-creation.js n=1024 len=2048 type='buffer()'                         0.57 %       ±2.70%   ±3.74%   ±5.16%
     buffers/buffer-creation.js n=1024 len=2048 type='fast-alloc-fill'                 -1.60 %       ±4.96%   ±6.79%   ±9.25%
     buffers/buffer-creation.js n=1024 len=2048 type='fast-alloc'                       1.29 %       ±3.79%   ±5.20%   ±7.09%
     buffers/buffer-creation.js n=1024 len=2048 type='fast-allocUnsafe'                 2.73 %       ±8.79%  ±12.05%  ±16.41%
     buffers/buffer-creation.js n=1024 len=2048 type='slow-allocUnsafe'                -0.99 %       ±6.27%   ±8.65%  ±11.91%
     buffers/buffer-creation.js n=1024 len=2048 type='slow'                            -5.98 %       ±6.24%   ±8.71%  ±12.20%
     buffers/buffer-creation.js n=1024 len=4096 type='buffer()'                        -1.75 %       ±3.48%   ±4.78%   ±6.56%
     buffers/buffer-creation.js n=1024 len=4096 type='fast-alloc-fill'                 -3.18 %       ±3.97%   ±5.45%   ±7.45%
     buffers/buffer-creation.js n=1024 len=4096 type='fast-alloc'                       2.05 %       ±4.05%   ±5.58%   ±7.65%
     buffers/buffer-creation.js n=1024 len=4096 type='fast-allocUnsafe'                 1.44 %       ±5.51%   ±7.63%  ±10.57%
     buffers/buffer-creation.js n=1024 len=4096 type='slow-allocUnsafe'          *     -4.77 %       ±4.30%   ±5.90%   ±8.06%
     buffers/buffer-creation.js n=1024 len=4096 type='slow'                            -3.31 %       ±6.38%   ±8.86%  ±12.34%
     buffers/buffer-creation.js n=1024 len=8192 type='buffer()'                         0.06 %       ±2.70%   ±3.77%   ±5.31%
     buffers/buffer-creation.js n=1024 len=8192 type='fast-alloc-fill'                 -1.20 %       ±3.30%   ±4.53%   ±6.17%
     buffers/buffer-creation.js n=1024 len=8192 type='fast-alloc'                      -1.46 %       ±2.75%   ±3.84%   ±5.38%
     buffers/buffer-creation.js n=1024 len=8192 type='fast-allocUnsafe'                 1.27 %       ±4.69%   ±6.49%   ±8.98%
     buffers/buffer-creation.js n=1024 len=8192 type='slow-allocUnsafe'                -1.68 %       ±3.30%   ±4.62%   ±6.49%
     buffers/buffer-creation.js n=1024 len=8192 type='slow'                            -2.49 %       ±3.24%   ±4.44%   ±6.07%
     (Re-running the outlier with 30 runs instead of 10:)
     buffers/buffer-creation.js n=1024 len=4096 type='slow-allocUnsafe'                 2.06 %       ±2.39%   ±3.19%   ±4.15%

The performance gains effect are undone once native code accesses
the underlying ArrayBuffer, but then again that a) does not happen for
all TypedArrays, and b) it should also make sense to look into using
`ArrayBufferView::CopyContents()` in some places, which is made
specifically to avoid such a performance impact and allows us to
use the benefits of heap-allocated typed arrays.

Refs: 16f86d6c57
Refs: https://github.com/nodejs/node/pull/2893
Refs: 74178a5682 (commitcomment-13250880)
Refs: http://logs.libuv.org/node-dev/2015-09-15

PR-URL: https://github.com/nodejs/node/pull/26301
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2019-03-01 21:57:28 +01:00
Anna Henningsen
b0b370c9b5
src: remove dead inspector code
This was overlooked in c58324534c.

Refs: https://github.com/nodejs/node/pull/26137

PR-URL: https://github.com/nodejs/node/pull/26295
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2019-03-01 21:47:19 +01:00
Anna Henningsen
0fc40c8049
worker: make MessagePort uv_async_t inline field
It’s not obvious why this was a heap allocation in the first place,
but it’s unneccessary. Most other `HandleWrap`s also store the
libuv handle directly.

PR-URL: https://github.com/nodejs/node/pull/26271
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
2019-03-01 21:44:05 +01:00
Anna Henningsen
4dd7c4b2e4
worker: remove MessagePort::AddToIncomingQueue
PR-URL: https://github.com/nodejs/node/pull/26271
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
2019-03-01 21:44:04 +01:00
Anna Henningsen
7f8010b87f
src: remove unused Converter object
PR-URL: https://github.com/nodejs/node/pull/26243
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2019-03-01 21:40:44 +01:00
cjihrig
4afd503465
doc,test,repl: fix deprecation code
PR-URL: https://github.com/nodejs/node/pull/26368
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2019-03-01 13:11:02 -05:00
Avi ד
fedc31bb3c
readline: improve Unicode handling
Prevents moving left or right from placing the cursor in between code
units comprising a code point.

PR-URL: https://github.com/nodejs/node/pull/25723
Fixes: https://github.com/nodejs/node/issues/25693
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2019-03-01 15:59:58 +01:00
Ruben Bridgewater
0fd5b458be
path: refactor code for clarity
This moves a condition inside of a for loop which can only be
triggered at the very end of the for loop outside of the loop. That
way the for loop itself is much simpler and easier to understand and
the code itself is less indented which should increase the
readability.

It also refactors some `var` to `let` and `const`.

PR-URL: https://github.com/nodejs/node/pull/25278
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2019-03-01 14:55:33 +01:00
Ruben Bridgewater
7cbe29eb4d
path: refactor for less indentation
This moves the `if (len === 1)` case to the top of the function.
That way it is possible to reduce the indentation level due to
returning early in that case.

On top of that the following was done:

1) For clarity refactored for loops which were meant to count up a
   variable into a while loop.
2) Used template strings instead of string concat.
3) Consolidating nested if statements.
4) Using tenary expressions if applicable when assigning variables
   to reduce the code overhead.

PR-URL: https://github.com/nodejs/node/pull/25278
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2019-03-01 14:55:30 +01:00
Ruben Bridgewater
e68b0d6fb3
path: simplify code and remove obsolete checks
Either `end` is `-1` or `startPart` is not `0`. Therefore it's
possible to move the conditions in a way that we eliminate a few code
branches.

PR-URL: https://github.com/nodejs/node/pull/25278
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2019-03-01 14:55:26 +01:00
Ruben Bridgewater
e750e9583e
path: refactor logic for to reduce code branches
This refactoring makes sure some code branches will not be hit if
they do not have to be reached.

PR-URL: https://github.com/nodejs/node/pull/25278
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2019-03-01 14:55:22 +01:00
Ruben Bridgewater
f59fdd9d65
path: minor refactoring
1) Consolidate nested if statements if possible
     `if (foo) { if bar () { /* do stuff */ } }`)
   to reduce indentation depth.
2) Remove obsolete else cases to reduce indentation.

PR-URL: https://github.com/nodejs/node/pull/25278
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2019-03-01 14:55:19 +01:00
Ruben Bridgewater
a019d7bd0b
path: refactor more path code for simplicity
1) Consolidate format to a single function.
2) Move some code that can only be reached in some code branches
   that was formerly executed in all cases.
3) Explicitly check for the string length of zero instead of
   converting the string to a boolean.
4) Consolidate nested if statements if possible e.g.,
     if (foo) { if (bar) { /* do stuff */ } }
   to reduce indentation depth.
5) Simplify checks by removing extra length checks when comparing
   two strings.
6) Use object shorthand notation where possible.

PR-URL: https://github.com/nodejs/node/pull/25278
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2019-03-01 14:55:15 +01:00
Ruben Bridgewater
9d19b1f8cf
path: more small refactorings
1) Refactor for loops to while loops that were only meant to count
   up a variable.
2) Refactor some `var` statements to `let` / `const`.
3) Simplify return conditions.
4) Use template strings where possible instead of concat.
5) Use ternary expressions for variable assignments instead of
   if / else.
6) Use the object shorthand notation for the function declarations.
7) Consolidate if else case where possible.
8) Remove double line breaks.

PR-URL: https://github.com/nodejs/node/pull/25278
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2019-03-01 14:55:11 +01:00
Ruben Bridgewater
05a8dbc91b
path: minor refactoring
1) This uses some ternary expressions instead of if else to assign
   some variables.
2) Use template strings instead of concat.
3) Use the object shortand notation.
4) Some var to let / const.
5) Removed some double line breaks.
6) Less brackets around statements if not necessary.

PR-URL: https://github.com/nodejs/node/pull/25278
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2019-03-01 14:55:07 +01:00
Ruben Bridgewater
410eb97bce
module: fix stat cache
The current caching logic broke by [0] because it used destructuring
on the module arguments. Since the exported property is a primitive
counting it up or down would not have any effect anymore in the module
that required that property.

The original implementation would cache all stat calls caused during
bootstrap. Afterwards it would clear the cache and lazy require calls
during runtime would create a new cascading cache for the then
loaded modules and clear the cache again.
This behavior is now restored. This is difficult to test without
exposing a lot of information and therfore the existing tests have
been removed (as they could not detect the issue).

With the broken implementation it caused each module compilation to
reset the cache and therefore minimizing the effect drastically.

[0] https://github.com/nodejs/node/pull/19177

PR-URL: https://github.com/nodejs/node/pull/26266
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
2019-03-01 12:27:15 +01:00