-
Notifications
You must be signed in to change notification settings - Fork 29.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
errors,console: refactor to use ES2020 syntax #42088
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is good!
The only problem is this makes backporting a bit harder since Node.js v12 is still supported and it doesn't support ??
.
Let's see what other collaborators think
Node.js 12 is going End-of-Life in a few months so I wouldn't worry about it too much. |
Was there any performance penalty using |
const { version } = require('process')
const max = 1000000000
let test = {}
function ifStatement () {
if (!test.a) {
test.a = 'TEST'
}
}
function es2020Operator () {
test.a ??= 'TEST'
}
console.log(version)
console.time('ifStatement')
for (let i = 0; i < max; i++) {
ifStatement()
}
console.timeEnd('ifStatement')
console.time('es2020Operator')
for (let i = 0; i < max; i++) {
es2020Operator()
}
console.timeEnd('es2020Operator') output: v16.13.1
ifStatement: 485.139ms
es2020Operator: 474.884ms Emmm, just a bit faster than |
Hi there, while I'm reading source codes of nodejs, I have seen this pr is not merged. Is this can be merged? Node v12 will End-Of-Life in 4.30 edit: I'm sorry that I forgot to use rebase instead of merge :( |
85a0cea
to
f578723
Compare
Promises are never destroyed manually therefore it's not needed to attach an object to track if destroy hook was called already. PR-URL: nodejs#42402 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
This commit adds a new 'test' module that exposes an API for creating JavaScript tests. As the tests execute, TAP output is written to standard output. This commit only supports executing individual test files, and does not implement command line functionality for a full test runner. PR-URL: nodejs#42325 Refs: nodejs#40954 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
This commit makes it possible to add new core modules that can only be require()'ed and imported when the 'node:' scheme is used. The 'test' module is the first such module. These 'node:'-only modules are not included in the list returned by module.builtinModules. PR-URL: nodejs#42325 Refs: nodejs#40954 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Notable changes: doc: * add @ShogunPanda to collaborators (Shogun) nodejs#42362 * deprecate string coercion in `fs.write`, `fs.writeFileSync` (Livia Medeiros) nodejs#42149 http: * (SEMVER-MINOR) trace http client by perf_hooks (theanarkh) nodejs#42345 deps: * upgrade npm to 8.5.5 (npm team) nodejs#42382 * update undici to 4.15.1 (Michaël Zasso) nodejs#42246 PR-URL: nodejs#42425
PR-URL: nodejs#42165 Fixes: nodejs#42286 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Signed-off-by: Michael Dawson <mdawson@devrus.com> PR-URL: nodejs#42284 Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: nodejs#42416 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Mestery <mestery@protonmail.com> Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Cherry-pick 12c8b4d Original commit message: This commit is a suggestion for adding a rule for NULL usages in the code base. This will currently report a number of errors which could be ignored using // NOLINT (readability/null_usage) PR-URL: nodejs#17373 Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Refs: nodejs@12c8b4d Cherry-pick fc81e80 Original commit message: Update cpplint.py to check for inline headers when the corresponding header is already included. PR-URL: nodejs#21521 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Refs: nodejs@fc81e80 Cherry-pick cbc3dd9 Original commit message: src, tools: add check for left leaning pointers This commit adds a rule to cpplint to check that pointers in the code base lean to the left and not right, and also fixes the violations reported. PR-URL: nodejs#21010 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com> Refs: nodejs@cbc3dd9 Cherry-pick 9029981 Original commit message: tools: fix cpplint.py header rules THIS COMMIT SHOULD GO WITH THE NEXT. IT WILL FIND NEW LINT. PR-URL: nodejs#26306 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Refs: nodejs@9029981 Cherry-pick 0a25ace Original commit message: tools: move cpplint configuration to .cpplint PR-URL: nodejs#27098 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Refs: nodejs@0a25ace Cherry-pick afa9a72 Original commit message: tools: refloat update link to google styleguide for cpplint This commit updates two old links to Google's C++ styleguide which currently result in a 404 when accessed. PR-URL: nodejs#30876 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Refs: nodejs@afa9a72 Cherry-pick e23bf8f Original commit message: tools,src: refloat forbid usage of v8::Persistent `v8::Persistent` comes with the surprising catch that it requires manual cleanup. `v8::Global` doesn’t, making it easier to use, and additionally provides move semantics. New code should always use `v8::Global`. PR-URL: nodejs#31018 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> PR-URL: nodejs#35569 Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> PR-URL: nodejs#35719 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> PR-URL: nodejs#35866 PR-URL: nodejs#36213 Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com> PR-URL: nodejs#36235 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> PR-URL: nodejs#36324 Reviewed-By: Beth Griggs <bgriggs@redhat.com> PR-URL: nodejs#38851 Reviewed-By: Khaidi Chu <i@2333.moe> PR-URL: nodejs#42416 Reviewed-By: Mestery <mestery@protonmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com>
https://bugs.chromium.org/p/v8/issues/detail?id=10704 is already fixed, but since AbortController currently throws ERR_INVALID_THIS we'll revert to class fields in a subsequent patch. For now just update the comments. PR-URL: nodejs#42361 Refs: nodejs@b1c3909 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Mestery <mestery@protonmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com>
`handler-outside-simulator.cc` uses inline assembly, which is not supported by MSVC. PR-URL: nodejs#40488 Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
We are not ready to migrate yet. Refs: nodejs/node-v8#214 PR-URL: nodejs#40907 Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
Refs: https://bugs.chromium.org/p/v8/issues/detail?id=12661 Refs: nodejs#42375 PR-URL: nodejs#42657 Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Michael Dawson <midawson@redhat.com>
Remove call to `memfd_create`. The function that references it is only used for V8 testing. PR-URL: nodejs#42657 Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Michael Dawson <midawson@redhat.com>
Create an unused deopt kind to replace `DeoptimizeKind::kSoft`, which was removed. This ensures that the layout of IsolateData doesn't change. Refs: v8/v8@1ff685d PR-URL: nodejs#42740 Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com>
PR-URL: nodejs#42740 Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com>
V8's test runner now requires Python 3. Use the Python binary we detected that is used elsewhere in the Makefile. PR-URL: nodejs#42740 Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com>
This reverts commit 35d72bf. PR-URL: nodejs#42740 Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com>
PR-URL: nodejs#42786 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Beth Griggs <bgriggs@redhat.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Akhil Marsonya <akhil.marsonya27@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Mestery <mestery@protonmail.com> Reviewed-By: Harshitha K P <harshitha014@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: nodejs#42803 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
PR-URL: nodejs#42783 Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Refs: nodejs#41431 Fixes: nodejs#42787 PR-URL: nodejs#42789 Reviewed-By: Beth Griggs <bgriggs@redhat.com> Reviewed-By: Mestery <mestery@protonmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it>
Add maintaining-webassembly.md with strategy based on discussion in Next-10 mini-summit: nodejs/next-10#127 Signed-off-by: Michael Dawson <mdawson@devrus.com> PR-URL: nodejs#42660 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Fixes: nodejs#42703 PR-URL: nodejs#42824 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
PR-URL: nodejs#42797 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Akhil Marsonya <akhil.marsonya27@gmail.com>
Refs: nodejs#41749 Fixes: nodejs#21130 PR-URL: nodejs#42701 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
export total_global_handles_size, used_global_handles_size, external_memory in getHeapStatistics PR-URL: nodejs#42784 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: nodejs#42815 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
The path of the Python executable might contain white spaces. Handle this when the `check-python` function is called. Fixes: nodejs#42801 PR-URL: nodejs#42810 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
fixes: nodejs#42792 PR-URL: nodejs#42807 Fixes: nodejs#42792 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Mestery <mestery@protonmail.com> Reviewed-By: Beth Griggs <bgriggs@redhat.com> Reviewed-By: Filip Skokan <panva.ip@gmail.com> Reviewed-By: Akhil Marsonya <akhil.marsonya27@gmail.com>
It is what V8's build config does by default. PR-URL: nodejs#42809 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Refs: nodejs#39941 Signed-off-by: Darshan Sen <raisinten@gmail.com> PR-URL: nodejs#42766 Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: nodejs#42820 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Refs: nodejs#41263 PR-URL: nodejs#42846 Fixes: nodejs#42741 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it>
PR-URL: nodejs#42848 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Mestery <mestery@protonmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com>
PR-URL: nodejs#42845 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Mestery <mestery@protonmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com>
As reported by coverity the null check is done after earlier code has already derefenced options.envp. Either we should null check earlier uses or this check is not necessary. Since options.envp is created with new which should throw an exception intead of returning null, it should be safe to assume the null check is not required. Signed-off-by: Michael Dawson <mdawson@devrus.com> PR-URL: nodejs#42819 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Darshan Sen <raisinten@gmail.com>
emm, I am sorry for that, there is something I do wrong, I will close this pr and open a new pr |
errors,console: refactor to use ES2020 syntax
Just simplified some codes while I'm reading the newest codes for nodejs. PTAL