Antoine du Hamel
eb8f7ee634
lib: revert primordials in a hot path
...
Evidence has shown that use of primordials have sometimes an impact of
performance. This commit reverts the changes who are most likely to be
responsible for performance regression in the HTTP response path.
PR-URL: https://github.com/nodejs/node/pull/38248
Backport-PR-URL: https://github.com/nodejs/node/pull/38972
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2021-06-11 09:30:23 +02:00
Anna Henningsen
c3bd0fdb73
http2: fix setting options before handle exists
...
Currently, when a JS Http2Session object is created, we have
to handle the situation in which the native object corresponding
to it does not yet exist. As part of that, we create a typed array
for storing options that are passed through the `AliasedStruct`
mechanism, and up until now, we copied that typed array over
the native one once the native one was available.
This was not good, because it was overwriting the defaults that
were set during construction of the native typed array with zeroes.
In order to fix this, create a wrapper for the JS-created typed array
that keeps track of which fields were changed, which enables us to
only overwrite fields that were intentionally changed on the JS side.
It is surprising that this behavior was not tested (which is,
guessing from the commit history around these features, my fault).
The subseqeuent commit introduces a test that would fail without
this change.
PR-URL: https://github.com/nodejs/node/pull/37875
Backport-PR-URL: https://github.com/nodejs/node/pull/38673
Fixes: https://github.com/nodejs/node/issues/37849
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2021-06-11 09:30:22 +02:00
Antoine du Hamel
7c4748b0dc
doc: use HEAD instead of master for links
...
PR-URL: https://github.com/nodejs/node/pull/38518
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Darshan Sen <raisinten@gmail.com >
2021-06-11 09:30:19 +02:00
Rich Trott
294b3e60a5
test,doc,lib: adjust object literal newlines for lint rule
...
Before enabling object-curly-newline for our ESLint rules, adjust files
to comply with it.
Refs: https://eslint.org/docs/rules/object-curly-newline
PR-URL: https://github.com/nodejs/node/pull/37040
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2021-06-11 09:30:18 +02:00
Robert Nagy
dbb0d2612c
stream: fix multiple Writable.destroy() calls
...
Calling Writable.destroy() multiple times in the same tick
could cause an assertion error.
Fixes: https://github.com/nodejs/node/issues/38189
PR-URL: https://github.com/nodejs/node/pull/38221
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Nitzan Uziely <linkgoron@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Backport-PR-URL: https://github.com/nodejs/node/pull/38473
2021-06-11 09:30:17 +02:00
Zach Bjornson
c4e7dca8f3
fs: fix error when writing buffers > INT32_MAX
...
This reverts c380ee6785 .
uv_fs_write returns an int, so it is not possible to ask
it to write more than INT32_MAX.
Instead, validate 'length' is an int32 in JS to avoid
the assertion failure.
PR-URL: https://github.com/nodejs/node/pull/38546
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Darshan Sen <raisinten@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2021-06-11 09:30:15 +02:00
Antoine du Hamel
cea8b4265c
lib: make IterableWeakMap safe to iterate
...
PR-URL: https://github.com/nodejs/node/pull/38523
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-06-11 09:30:14 +02:00
helloyou2012
a18b1ff80b
stream: the position of _read() is wrong
...
Fixes: https://github.com/nodejs/node/issues/33940
PR-URL: https://github.com/nodejs/node/pull/38292
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2021-06-11 09:30:12 +02:00
James M Snell
378e0e778b
src: fix validation of negative offset to avoid abort
...
Fixes: https://github.com/nodejs/node/issues/24640
Signed-off-by: James M Snell <jasnell@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/38421
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Nitzan Uziely <linkgoron@gmail.com >
Reviewed-By: Darshan Sen <raisinten@gmail.com >
2021-06-11 09:30:09 +02:00
Antoine du Hamel
bd0d9647ca
module: clarify CJS global-like variables not defined error message
...
Fixes: https://github.com/nodejs/node/issues/33741
PR-URL: https://github.com/nodejs/node/pull/37852
Reviewed-By: Guy Bedford <guybedford@gmail.com >
2021-06-11 09:30:03 +02:00
David Glasser
006c7b78da
src: indent long help text properly
...
The previous code passed an ignored argument to StringPrototypeTrimLeft,
and tried to trim a string that didn't start with whitespace. The trim
makes more sense after the indentation has been added. Now wrapped lines
actually show up with the rest of the help text.
Doing this made an uncharacteristic trailing newline in the
`--icu-data-dir` help text more obvious, so I removed that.
PR-URL: https://github.com/nodejs/node/pull/37911
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Darshan Sen <raisinten@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-06-11 09:30:02 +02:00
Antoine du Hamel
0fdb5d59f7
module: refactor NativeModule to avoid unsafe array iteration
...
PR-URL: https://github.com/nodejs/node/pull/37656
Reviewed-By: Darshan Sen <raisinten@gmail.com >
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com >
2021-06-11 09:30:02 +02:00
James M Snell
2168e954aa
doc: document the NO_COLOR and FORCE_COLOR env vars
...
Signed-off-by: James M Snell <jasnell@gmail.com >
Fixes: https://github.com/nodejs/node/issues/37404
PR-URL: https://github.com/nodejs/node/pull/37477
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2021-06-11 09:30:01 +02:00
Antoine du Hamel
cfff3b4462
assert: refactor to avoid unsafe array iteration
...
PR-URL: https://github.com/nodejs/node/pull/37344
Reviewed-By: Darshan Sen <raisinten@gmail.com >
2021-06-11 09:30:00 +02:00
Antoine du Hamel
af39df6d03
lib: add URI handling functions to primordials
...
PR-URL: https://github.com/nodejs/node/pull/37394
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-06-11 09:30:00 +02:00
Antoine du Hamel
698bffaa90
worker: refactor to avoid unsafe array iteration
...
PR-URL: https://github.com/nodejs/node/pull/37346
Reviewed-By: Darshan Sen <raisinten@gmail.com >
Reviewed-By: Harshitha K P <harshitha014@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-06-11 09:29:59 +02:00
bcoe
9417fd0bc8
errors: align source-map stacks with spec
...
Reformat stack traces when --enable-source-maps flag is set to format
more likely to fit https://github.com/tc39/proposal-error-stacks
PR-URL: https://github.com/nodejs/node/pull/37252
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Ian Sutherland <ian@iansutherland.ca >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Zeyu Yang <himself65@outlook.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2021-06-11 09:29:59 +02:00
ExE Boss
16691be80e
lib: fix WebIDL object and dictionary type conversion
...
PR-URL: https://github.com/nodejs/node/pull/37047
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2021-06-11 09:29:59 +02:00
Darshan Sen
1dc7fd238c
timers: fix unsafe array iteration
...
Fixes: https://github.com/nodejs/node/issues/37222
PR-URL: https://github.com/nodejs/node/pull/37223
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2021-06-11 09:29:59 +02:00
Antoine du Hamel
dd18def7db
async_hooks: refactor to avoid unsafe array iteration
...
PR-URL: https://github.com/nodejs/node/pull/37125
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com >
Reviewed-By: Darshan Sen <raisinten@gmail.com >
2021-06-11 09:29:58 +02:00
raisinten
47ed512312
lib: refactor to use optional chaining in internal/options.js
...
PR-URL: https://github.com/nodejs/node/pull/36939
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2021-06-11 09:29:58 +02:00
ZiJian Liu
726ef40fcb
perf_hooks: throw ERR_INVALID_ARG_VALUE if histogram.percentile param is NaN
...
Fixes: https://github.com/nodejs/node/issues/36936
PR-URL: https://github.com/nodejs/node/pull/36937
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2021-06-11 09:29:57 +02:00
Antoine du Hamel
77c7d979b6
module: simplify tryStatSync with throwIfNoEntry option
...
PR-URL: https://github.com/nodejs/node/pull/36971
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-06-11 09:29:57 +02:00
Antoine du Hamel
8912caba64
lib: expose primordials object
...
Expose the internal `primordials` object to help with Node.js core
development.
```console
$ node --expose-internals -r internal/test/binding lib/fs.js
(node:5299) internal/test/binding: These APIs are for internal testing
only. Do not use them.
(Use `node --trace-warnings ...` to show where the warning was created)
```
PR-URL: https://github.com/nodejs/node/pull/36872
Reviewed-By: Bradley Farias <bradley.meck@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-06-11 09:29:56 +02:00
Antoine du Hamel
46c019b988
lib: refactor source_map to use more primordials
...
PR-URL: https://github.com/nodejs/node/pull/36733
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-06-11 09:29:56 +02:00
Antoine du Hamel
cf9556d8f7
lib: refactor source_map to avoid unsafe array iteration
...
PR-URL: https://github.com/nodejs/node/pull/36734
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Pooja D P <Pooja.D.P@ibm.com >
2021-06-11 09:29:55 +02:00
Antoine du Hamel
3aee77d279
vm: refactor to avoid unsafe array iteration
...
PR-URL: https://github.com/nodejs/node/pull/36752
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-06-11 09:29:55 +02:00
ExE Boss
6eaf357f49
lib: simplify primordials.uncurryThis
...
PR-URL: https://github.com/nodejs/node/pull/36866
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Pooja D P <Pooja.D.P@ibm.com >
2021-06-11 09:29:55 +02:00
ZiJian Liu and Antoine du Hamel
18e5c0f3e2
events: refactor to use optional chaining
...
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/36763
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2021-06-11 09:29:55 +02:00
Antoine du Hamel
716076e389
tty: refactor to avoid unsafe array iteration
...
PR-URL: https://github.com/nodejs/node/pull/36771
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Pooja D P <Pooja.D.P@ibm.com >
2021-06-11 09:29:54 +02:00
Antoine du Hamel
9338759b01
lib: remove v8_prof_polyfill from eslint ignore list
...
PR-URL: https://github.com/nodejs/node/pull/36537
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2021-06-11 09:29:54 +02:00
Antoine du Hamel
dcd221ce69
errors: refactor to use more primordials
...
PR-URL: https://github.com/nodejs/node/pull/36651
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Yash Ladha <yash@yashladha.in >
2021-06-11 09:29:54 +02:00
Robert Nagy
ab130e929a
stream: only use legacy close listeners if not willEmitClose
...
Some streams that willEmitClose unecessarily fallback to legacy
events.
PR-URL: https://github.com/nodejs/node/pull/36649
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2021-06-11 09:29:53 +02:00
Brian White
c9861a344a
lib: remove unused code
...
PR-URL: https://github.com/nodejs/node/pull/36632
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2021-06-11 09:29:52 +02:00
raisinten
01a71dd393
lib: refactor to use more primordials in internal/encoding.js
...
PR-URL: https://github.com/nodejs/node/pull/36480
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Pooja D P <Pooja.D.P@ibm.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2021-06-11 09:29:52 +02:00
ZiJian Liu
e6c0877604
lib: refactor to use primordials in internal/priority_queue.js
...
PR-URL: https://github.com/nodejs/node/pull/36560
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Pooja D P <Pooja.D.P@ibm.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2021-06-11 09:29:52 +02:00
Antoine du Hamel
c8b22185f7
url: refactor to use more primordials
...
PR-URL: https://github.com/nodejs/node/pull/36316
Reviewed-By: Rich Trott <rtrott@gmail.com >
2021-06-11 09:29:52 +02:00
Antoine du Hamel
9ae2a27d44
buffer: make FastBuffer safe to construct
...
Using an explicit constructor is necessary to avoid relying on
`Array.prototype[Symbol.iterator]` and `%ArrayIteratorPrototype%.next`,
which can be mutated by users.
PR-URL: https://github.com/nodejs/node/pull/36587
Refs: https://github.com/nodejs/node/pull/36428
Refs: https://github.com/nodejs/node/pull/36532
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2021-06-11 09:29:51 +02:00
Antoine du Hamel
6e3a2ffb98
lib: add primordials.SafeStringIterator
...
PR-URL: https://github.com/nodejs/node/pull/36526
Reviewed-By: Rich Trott <rtrott@gmail.com >
2021-06-11 09:29:51 +02:00
Antoine du Hamel
bf0738bc07
lib: make safe primordials safe to construct
...
PR-URL: https://github.com/nodejs/node/pull/36428
Reviewed-By: Rich Trott <rtrott@gmail.com >
2021-06-11 09:29:51 +02:00
Antoine du Hamel
7ebc18f293
lib: make safe primordials safe to iterate
...
PR-URL: https://github.com/nodejs/node/pull/36391
Backport-PR-URL: https://github.com/nodejs/node/pull/38703
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-06-11 09:29:51 +02:00
Antoine du Hamel
4fdcbae583
events: refactor to use more primordials
...
PR-URL: https://github.com/nodejs/node/pull/36304
Reviewed-By: Rich Trott <rtrott@gmail.com >
2021-06-11 09:29:50 +02:00
raisinten and Antoine du Hamel
e12dbc8519
lib: refactor to use more primordials in internal/histogram.js
...
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/36455
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-06-11 09:29:49 +02:00
Rich Trott
e113035c9a
util: simplify constructor retrieval in inspect()
...
Instead of looping through a list of typed arrays, use
TypedArrayPrototypeGetSymbolToStringTag.
PR-URL: https://github.com/nodejs/node/pull/36466
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com >
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-06-11 09:29:48 +02:00
Antoine du Hamel
cd7cf0547a
dns: refactor to use more primordials
...
PR-URL: https://github.com/nodejs/node/pull/36314
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2021-06-11 09:29:47 +02:00
Michaël Zasso
226a86c3b5
tools: enable no-unused-expressions lint rule
...
Fixes: https://github.com/nodejs/node/issues/36246
PR-URL: https://github.com/nodejs/node/pull/36248
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-06-11 09:29:47 +02:00
Antoine du Hamel
52cbe89f7f
net: refactor to use more primordials
...
PR-URL: https://github.com/nodejs/node/pull/36303
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-06-11 09:29:47 +02:00
ExE Boss
5daeac64a4
lib: add uncurried accessor properties to primordials
...
Closes: https://github.com/nodejs/node/pull/32127
PR-URL: https://github.com/nodejs/node/pull/36329
Fixes: https://github.com/nodejs/node/issues/32127
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-06-11 09:29:46 +02:00
Antoine du Hamel
b5b8a996f3
readline: refactor to use more primordials
...
PR-URL: https://github.com/nodejs/node/pull/36296
Reviewed-By: Rich Trott <rtrott@gmail.com >
2021-06-11 09:29:46 +02:00
Antoine du Hamel
f5b2115b76
dgram: refactor to use more primordials
...
PR-URL: https://github.com/nodejs/node/pull/36286
Reviewed-By: Rich Trott <rtrott@gmail.com >
2021-06-11 09:29:46 +02:00