summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2018-01-11path: fix path.normalize for relative pathsWeijia Wang
After slicing, the `lastSegmentLength` should be calculated again, instead of assigning value `j`. PR-URL: https://github.com/nodejs/node/pull/17974 Fixes: https://github.com/nodejs/node/issues/17928 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
2018-01-11fs: extract out validateUint32 and validateLen functionsJon Moss
PR-URL: https://github.com/nodejs/node/pull/17682 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2018-01-11fs: extract out validatePath functionJon Moss
PR-URL: https://github.com/nodejs/node/pull/17682 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2018-01-11fs: extract out validateOffsetLengthWrite functionJon Moss
PR-URL: https://github.com/nodejs/node/pull/17682 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2018-01-11fs: extract out validateBuffer functionJon Moss
PR-URL: https://github.com/nodejs/node/pull/17682 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2018-01-11fs: extract out validateOffsetLengthRead functionJon Moss
PR-URL: https://github.com/nodejs/node/pull/17682 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2018-01-11fs: extract out validateFd functionJon Moss
PR-URL: https://github.com/nodejs/node/pull/17682 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2018-01-10stream: always defer 'readable' with nextTickMatteo Collina
Emit 'readable' always in the next tick, resulting in a single call to _read() per microtick. This removes the need for the user to implement buffering if they wanted to call this.push() multiple times in an asynchronous fashion, as this.push() triggers this._read() call. PR-URL: https://github.com/nodejs/node/pull/17979 Fixes: https://github.com/nodejs/node/issues/3203 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2018-01-09n-api: throw RangeError in napi_create_dataview() with invalid rangeJinho Bang
The API is required that `byte_length + byte_offset` is less than or equal to the size in bytes of the array passed in. If not, a RangeError exception is raised[1]. [1] https://nodejs.org/api/n-api.html#n_api_napi_create_dataview PR-URL: https://github.com/nodejs/node/pull/17869 Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2018-01-09lib: handle `throw undefined` in assert.throws()Ben Noordhuis
And make `assert.doesNotThrow()` handle it as well. PR-URL: https://github.com/nodejs/node/pull/18029 Fixes: https://github.com/nodejs/node/issues/18027 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Khaidi Chu <i@2333.moe> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2018-01-09http2: use aliased buffer for perf stats, add statsJames M Snell
Add an aliased buffer for session and stream statistics, add a few more metrics PR-URL: https://github.com/nodejs/node/pull/18020 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
2018-01-09lib: enable dot-notation eslint ruleAnatoli Papirovski
PR-URL: https://github.com/nodejs/node/pull/18007 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Jon Moss <me@jonathanmoss.me>
2018-01-09async_hooks: update defaultTriggerAsyncIdScope for perfAnatoli Papirovski
The existing version of defaultTriggerAsyncIdScope creates an Array for the callback's arguments which is highly inefficient. Instead, use rest syntax and allow V8 to do that work for us. This yields roughly 2x performance for this particular function. PR-URL: https://github.com/nodejs/node/pull/18004 Reviewed-By: Andreas Madsen <amwebdk@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2018-01-08fs: guarantee order of callbacks in ws.closeMatteo Collina
Refactor WriteStream.prototype.close and WriteStream.prototype._destroy to always call the callback passed to close in order. Protects from calling .close() without a callback. Fixes: https://github.com/nodejs/node/issues/17951 See: https://github.com/nodejs/node/pull/15407 PR-URL: https://github.com/nodejs/node/pull/18002 Fixes: https://github.com/nodejs/node/issues/17951 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
2018-01-07lib: remove queue implementation from JSStreamWrapAnna Henningsen
The streams implementation generally ensures that only one write() call is active at a time. `JSStreamWrap` instances still kept queue of write reqeuests in spite of that; refactor it away. Also, fold `isAlive()` into a constant function on the native side. PR-URL: https://github.com/nodejs/node/pull/17918 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Minwoo Jung <minwoo@nodesource.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2018-01-05http2: implement maxSessionMemoryJames M Snell
The maxSessionMemory is a cap for the amount of memory an Http2Session is permitted to consume. If exceeded, new `Http2Stream` sessions will be rejected with an `ENHANCE_YOUR_CALM` error and existing `Http2Stream` instances that are still receiving headers will be terminated with an `ENHANCE_YOUR_CALM` error. PR-URL: https://github.com/nodejs/node/pull/17967 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2018-01-05buffer: check byteLength in readUInt(B|L)ERich Trott
PR-URL: https://github.com/nodejs/node/pull/11146 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2018-01-05buffer: check byteLength in readInt(B|L)ESebastian Van Sande
The 'byteLength' argument should be required and of type 'number'. It should have a value between 1 and 6. PR-URL: https://github.com/nodejs/node/pull/11146 Fixes: https://github.com/nodejs/node/issues/10515 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2018-01-05cluster: support windowsHide option for workersTodd Wong
Fixes: https://github.com/nodejs/node/issues/17370 PR-URL: https://github.com/nodejs/node/pull/17412 Fixes: https://github.com/nodejs/node/issues/17370 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com>
2018-01-04http: remove duplicate exportEvan Lucas
5425e0dcbee1ed8f6687203eafb7c3cf214f3393 switched to using the module.exports pattern vs just exports, but left a duplicate export around for OutgoingMessage. PR-URL: https://github.com/nodejs/node/pull/17982 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
2018-01-04repl: refactor code for readabilityRuben Bridgewater
PR-URL: https://github.com/nodejs/node/pull/17919 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Weijia Wang <starkwang@126.com> Reviewed-By: Khaidi Chu <i@2333.moe> Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: Lance Ball <lball@redhat.com>
2018-01-04repl: upper case comments first charRuben Bridgewater
PR-URL: https://github.com/nodejs/node/pull/17919 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Weijia Wang <starkwang@126.com> Reviewed-By: Khaidi Chu <i@2333.moe> Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: Lance Ball <lball@redhat.com>
2018-01-03http2: add initial support for originSetJames M Snell
Add new properties to `Http2Session` to identify alpnProtocol, and indicator about whether the session is TLS or not, and initial support for origin set (preparinng for `ORIGIN` frame support and the client-side `Pool` implementation. The `originSet` is the set of origins for which an `Http2Session` may be considered authoritative. Per the `ORIGIN` frame spec, the originSet is only valid on TLS connections, so this is only exposed when using a `TLSSocket`. PR-URL: https://github.com/nodejs/node/pull/17935 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Sebastiaan Deckers <sebdeckers83@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
2018-01-03tls: set servername on client side tooJames M Snell
PR-URL: https://github.com/nodejs/node/pull/17935 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Sebastiaan Deckers <sebdeckers83@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
2018-01-03readline: update references to archived repositoryTobias Nießen
PR-URL: https://github.com/nodejs/node/pull/17924 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2018-01-03http2: add altsvc supportJames M Snell
Add support for sending and receiving ALTSVC frames. PR-URL: https://github.com/nodejs/node/pull/17917 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2018-01-02http2: perf_hooks integrationJames M Snell
Collect and report basic timing information about `Http2Session` and `Http2Stream` instances. PR-URL: https://github.com/nodejs/node/pull/17906 Refs: https://github.com/nodejs/node/issues/17746 Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2018-01-02timers: refactor setImmediate error handlingAnatoli Papirovski
If an error is encountered during the processing of Immediates, schedule the remaining queue to finish after all error handling code runs (if the process is still alive to do so). The new changes make the Immediates error handling behaviour entirely deterministic and predictable, as the full queue will be flushed on each Immediates cycle, regardless of whether an error is encountered or not. Currently this processing is scheduled for nextTick which can yield unpredictable results as the nextTick might happen as early as close callbacks phase or as late as after the next event loop turns Immediates all fully processed. The latter can result in two full cycles of Immediates processing during one even loop turn. The current implementation also doesn't differentiate between Immediates scheduled for the current queue run or the next one, so Immediates that were scheduled for the next turn of the event loop, will process alongside the ones that were scheduled for the current turn. PR-URL: https://github.com/nodejs/node/pull/17879 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
2018-01-02http2: remove duplicate words in commentsTobias Nießen
PR-URL: https://github.com/nodejs/node/pull/17939 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: James M Snell <jasnell@gmail.com>
2017-12-30src: use AliasedBuffer for TickInfoAnatoli Papirovski
PR-URL: https://github.com/nodejs/node/pull/17881 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Khaidi Chu <i@2333.moe> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2017-12-30timers: remove domain enter and exitAnatoli Papirovski
With domains implemented over AsyncHooks, it's no longer necessary to explicitly enter and exit the domain. PR-URL: https://github.com/nodejs/node/pull/17880 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Andreas Madsen <amwebdk@gmail.com>
2017-12-29errors: remove ERR_OUTOFMEMORYTobias Nießen
PR-URL: https://github.com/nodejs/node/pull/17877 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2017-12-29util: improve error message of _errnoExceptionWeijia Wang
The usage of ERR_INVALID_ARG_TYPE in _errnoException is a little inappropriate. This change is to improve it. PR-URL: https://github.com/nodejs/node/pull/17626 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2017-12-29http: convert utcDate to use setTimeoutJeremiah Senkpiel
A sort-of follow-up to https://github.com/nodejs/node/pull/17704, this removes the last internal use of enroll(). PR-URL: https://github.com/nodejs/node/pull/17800 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: Minwoo Jung <minwoo@nodesource.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
2017-12-29assert: fix strict regressionRuben Bridgewater
Using `assert()` or `assert.ok()` resulted in a error since a refactoring. Refs: https://github.com/nodejs/node/pull/17582 PR-URL: https://github.com/nodejs/node/pull/17903 Refs: https://github.com/nodejs/node/pull/17582 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2017-12-28repl: fix coloring of `process.versions`Ben Noordhuis
Remove the custom formatter that was added in commit 4fb27d4 ("intl: Add more versions from ICU"). It's not necessary anymore (and may not have been necessary at all) and prevents proper coloring in the REPL. PR-URL: https://github.com/nodejs/node/pull/17861 Fixes: https://github.com/nodejs/node/issues/17086 Reviewed-By: Nikolai Vavilov <vvnicholas@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Khaidi Chu <i@2333.moe> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2017-12-28http2: implement ref() and unref() on client sessionsKelvin Jin
PR-URL: https://github.com/nodejs/node/pull/17620 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
2017-12-28readline: refactor filter() callbackRich Trott
Use construct that always returns a boolean for `filter()` callback. PR-URL: https://github.com/nodejs/node/pull/17858 Reviewed-By: Weijia Wang <starkwang@126.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Khaidi Chu <i@2333.moe> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2017-12-28process: do not directly schedule _tickCallback in _fatalExceptionAnatoli Papirovski
When a process encounters a _fatalException that is caught, it should schedule execution of nextTicks but not in an arbitrary place of the next Immediates queue. Instead, add a no-op function to the queue that will ensure processImmediate runs, which will then ensure that nextTicks are processed at the end. PR-URL: https://github.com/nodejs/node/pull/17841 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
2017-12-28lib: migrate _http_outgoing.js's remaining errorsAnton Paras
A couple of lib/_http_outgoing.js's errors were still in the "old style": `throw new Error(<some message here>)`. This commit migrates those 2 old style errors to the "new style": internal/errors.js's error-system. In the future, changes to these errors' messages won't break semver-major status. With the old style, changes to these errors' messages broke semver-major status. It was inconvenient. Refs: https://github.com/nodejs/node/issues/17709 PR-URL: https://github.com/nodejs/node/pull/17837 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2017-12-28fs: throw fs.close errors in JSJoyee Cheung
* Collect the error context in both JS and C++, then throw the error in JS * Test that the errors thrown from fs.close and fs.closeSync includes the correct error code, error number and syscall properties PR-URL: https://github.com/nodejs/node/pull/17338 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2017-12-28fs: simplify the error context collection in C++Joyee Cheung
- Simplify the SyncCall template function, only collect error number and syscall in the C++ layer and collect the rest of context in JS for flexibility. - Remove the stringFromPath JS helper now that the unprefixed path is directly put into the context before the binding is invoked with the prefixed path. - Validate more properties in fs.access tests. PR-URL: https://github.com/nodejs/node/pull/17338 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2017-12-27async_hooks: use typed array stack as fast pathAnna Henningsen
- Communicate the current async stack length through a typed array field rather than a native binding method - Add a new fixed-size `async_ids_fast_stack` typed array that contains the async ID stack up to a fixed limit. This increases performance noticeably, since most of the time the async ID stack will not be more than a handful of levels deep. - Make the JS `pushAsyncIds()` and `popAsyncIds()` functions do the same thing as the native ones if the fast path is applicable. Benchmarks: $ ./node benchmark/compare.js --new ./node --old ./node-master --runs 10 --filter next-tick process | Rscript benchmark/compare.R [00:03:25|% 100| 6/6 files | 20/20 runs | 1/1 configs]: Done improvement confidence p.value process/next-tick-breadth-args.js millions=4 19.72 % *** 3.013913e-06 process/next-tick-breadth.js millions=4 27.33 % *** 5.847983e-11 process/next-tick-depth-args.js millions=12 40.08 % *** 1.237127e-13 process/next-tick-depth.js millions=12 77.27 % *** 1.413290e-11 process/next-tick-exec-args.js millions=5 13.58 % *** 1.245180e-07 process/next-tick-exec.js millions=5 16.80 % *** 2.961386e-07 PR-URL: https://github.com/nodejs/node/pull/17780 Reviewed-By: James M Snell <jasnell@gmail.com>
2017-12-27buffer: optimize readDouble and readFloat methodsBen Noordhuis
Compute the floating point number in JavaScript to avoid having to call out to the C++ runtime. The improvements are not insubstantial: improvement confidence p.value value="big" endian="BE" type="Double" noAssert="false" 292.86 % *** 1.688367e-08 value="big" endian="BE" type="Double" noAssert="true" 353.19 % *** 6.079414e-10 value="big" endian="BE" type="Float" noAssert="false" 406.21 % *** 1.730122e-07 value="big" endian="BE" type="Float" noAssert="true" 450.81 % *** 6.909242e-07 value="big" endian="LE" type="Double" noAssert="false" 268.39 % *** 8.625486e-09 value="big" endian="LE" type="Double" noAssert="true" 310.66 % *** 2.798332e-15 value="big" endian="LE" type="Float" noAssert="false" 382.99 % *** 3.412057e-07 value="big" endian="LE" type="Float" noAssert="true" 394.60 % *** 1.406742e-07 value="inf" endian="BE" type="Double" noAssert="false" 312.91 % *** 7.407943e-12 value="inf" endian="BE" type="Double" noAssert="true" 392.47 % *** 3.821179e-08 value="inf" endian="BE" type="Float" noAssert="false" 466.01 % *** 8.953363e-08 value="inf" endian="BE" type="Float" noAssert="true" 460.76 % *** 5.381256e-09 value="inf" endian="LE" type="Double" noAssert="false" 279.50 % *** 2.390682e-09 value="inf" endian="LE" type="Double" noAssert="true" 335.30 % *** 3.587173e-09 value="inf" endian="LE" type="Float" noAssert="false" 439.77 % *** 1.057133e-07 value="inf" endian="LE" type="Float" noAssert="true" 426.72 % *** 4.353408e-09 value="nan" endian="BE" type="Double" noAssert="false" 271.18 % *** 2.281526e-05 value="nan" endian="BE" type="Double" noAssert="true" 312.63 % *** 1.974975e-07 value="nan" endian="BE" type="Float" noAssert="false" 429.17 % *** 2.416228e-07 value="nan" endian="BE" type="Float" noAssert="true" 461.39 % *** 1.956714e-08 value="nan" endian="LE" type="Double" noAssert="false" 267.03 % *** 9.938479e-12 value="nan" endian="LE" type="Double" noAssert="true" 276.93 % *** 7.842481e-08 value="nan" endian="LE" type="Float" noAssert="false" 415.97 % *** 8.082710e-07 value="nan" endian="LE" type="Float" noAssert="true" 433.68 % *** 1.030200e-07 value="small" endian="BE" type="Double" noAssert="false" 273.20 % *** 9.071652e-11 value="small" endian="BE" type="Double" noAssert="true" 326.25 % *** 3.120167e-08 value="small" endian="BE" type="Float" noAssert="false" 845.61 % *** 8.044170e-08 value="small" endian="BE" type="Float" noAssert="true" 868.61 % *** 2.944539e-08 value="small" endian="LE" type="Double" noAssert="false" 251.29 % *** 5.613930e-09 value="small" endian="LE" type="Double" noAssert="true" 286.82 % *** 8.149603e-10 value="small" endian="LE" type="Float" noAssert="false" 824.87 % *** 1.199729e-08 value="small" endian="LE" type="Float" noAssert="true" 834.35 % *** 4.799620e-08 value="zero" endian="BE" type="Double" noAssert="false" 216.70 % *** 3.872293e-12 value="zero" endian="BE" type="Double" noAssert="true" 239.31 % *** 6.439601e-09 value="zero" endian="BE" type="Float" noAssert="false" 353.75 % *** 3.639974e-07 value="zero" endian="BE" type="Float" noAssert="true" 388.86 % *** 7.074318e-10 value="zero" endian="LE" type="Double" noAssert="false" 179.34 % *** 5.230763e-06 value="zero" endian="LE" type="Double" noAssert="true" 199.66 % *** 2.177589e-11 value="zero" endian="LE" type="Float" noAssert="false" 299.55 % *** 9.961978e-08 value="zero" endian="LE" type="Float" noAssert="true" 333.30 % *** 2.470764e-08 PR-URL: https://github.com/nodejs/node/pull/17775 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
2017-12-27tls: fix SNICallback without .server optionAnna Henningsen
`options.server` only needs to be set when its contents are actually being inspected. PR-URL: https://github.com/nodejs/node/pull/17835 Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2017-12-27http: add rawPacket in err of `clientError` eventXadillaX
The `rawPacket` is the current buffer that just parsed. Adding this buffer to the error object of `clientError` event is to make it possible that developers can log the broken packet. PR-URL: https://github.com/nodejs/node/pull/17672 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
2017-12-27fs: validate path in fs.exists{Sync}Joyee Cheung
PR-URL: https://github.com/nodejs/node/pull/17852 Refs: https://github.com/nodejs/node/pull/17667 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2017-12-27fs: validate path in fs.readFileJoyee Cheung
PR-URL: https://github.com/nodejs/node/pull/17852 Refs: https://github.com/nodejs/node/pull/17667 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2017-12-26timers: make setImmediate() immune to tamperingBen Noordhuis
Make setImmediate() immune to `process` global tampering by removing the dependency on the `process._immediateCallback` property. PR-URL: https://github.com/nodejs/node/pull/17736 Fixes: https://github.com/nodejs/node/issues/17681 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2017-12-26console: make .assert standard compliantRuben Bridgewater
The standard does not throw and has no stack trace. See https://console.spec.whatwg.org/#assert PR-URL: https://github.com/nodejs/node/pull/17706 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>