summaryrefslogtreecommitdiff
path: root/src/node_internals.h
Commit message (Collapse)AuthorAgeFilesLines
* src,zlib: tighten up Z_*_WINDOWBITS macrosXadillaX2021-09-041-5/+0
| | | | | PR-URL: https://github.com/nodejs/node/pull/39115 Reviewed-By: Anna Henningsen <anna@addaleax.net>
* src: add --heapsnapshot-near-heap-limit optionJoyee Cheung2021-08-311-0/+4
| | | | | | | | | | | | | This patch adds a --heapsnapshot-near-heap-limit CLI option that takes heap snapshots when the V8 heap is approaching the heap size limit. It will try to write the snapshots to disk before the program crashes due to OOM. PR-URL: https://github.com/nodejs/node/pull/33010 Refs: https://github.com/nodejs/node/issues/27552 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
* src: expose v8::Isolate setup callbacksShelley Vohr2020-10-131-4/+0
| | | | | | | | PR-URL: https://github.com/nodejs/node/pull/35512 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Rich Trott <rtrott@gmail.com>
* src: allow N-API addon in `AddLinkedBinding()`Anna Henningsen2020-09-291-0/+2
| | | | | | | | | | | `AddLinkedBinding()` can be used to load old-style Node.js addons, but currently not N-API addons. There’s no good reason not to support N-API addons as well, so add that. PR-URL: https://github.com/nodejs/node/pull/35301 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: Zeyu Yang <himself65@outlook.com>
* lib,src: remove cpu profiler idle notifierBen Noordhuis2020-06-301-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | I added it in commit 57231d5286 ("src: notify V8 profiler when we're idle") from October 2013 as a stop-gap measure to measure CPU time rather than wall clock time, otherwise processes that spend a lot of time sleeping in system calls give a false impression of being very busy. That fix is not without drawbacks because the idle flag is set before libuv makes I/O callbacks and cleared again after. I/O callbacks can result into calls into JS code and executing JS code is as non-idle as you can get. In commit 96ffcb9a21 ("src: reduce cpu profiler overhead") from January 2015, I made Node.js block off the SIGPROF signal that V8's CPU profiler uses before Node.js goes to sleep. The goal of that commit is to reduce the overhead from EINTR system call wakeups but it also has the pleasant side effect of fixing what the idle notifier tried to fix. This commit removes the idle notifier and turns the JS process object methods into no-ops. Fixes: https://github.com/nodejs/node/issues/19009 Refs: https://github.com/nodejs/node/pull/33138 PR-URL: https://github.com/nodejs/node/pull/34010 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
* src: turn AllocatedBuffer into thin wrapper around v8::BackingStoreJames M Snell2020-06-301-3/+2
| | | | | | | | | | Alternative to https://github.com/nodejs/node/pull/33381 that reimplements that change on top of moving AllocatedBuffer out of env.h PR-URL: https://github.com/nodejs/node/pull/33291 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: David Carlier <devnexen@gmail.com>
* src: refactor Reallocate since it introduced in upstream v8Jiawen Geng2020-05-161-1/+1
| | | | | | | | | PR-URL: https://github.com/nodejs/node/pull/33402 Reviewed-By: Zeyu Yang <himself65@outlook.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
* src: remove unnecessary Isolate::GetCurrent() callsAnna Henningsen2020-05-111-2/+2
| | | | | | | | | | | These calls are unnecessary in Release mode but would still have been included, so move them to the `DebugSealHandleScope` constructor. PR-URL: https://github.com/nodejs/node/pull/33298 Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
* src: use basename(argv0) for --trace-uncaught suggestionAnna Henningsen2020-04-171-0/+4
| | | | | | | | Refs: https://github.com/nodejs/node/pull/32797#discussion_r407222290 PR-URL: https://github.com/nodejs/node/pull/32798 Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com>
* src: provide a variant of LoadEnvironment taking a callbackAnna Henningsen2020-03-211-2/+3
| | | | | | | | | This allows embedders to flexibly control how they start JS code rather than using `third_party_main`. PR-URL: https://github.com/nodejs/node/pull/30467 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
* src: align worker and main thread code with embedder APIAnna Henningsen2020-03-211-0/+1
| | | | | | | | | | This addresses some long-standing TODOs by Joyee and me about making the embedder API more powerful and us less reliant on internal APIs for creating the main thread and Workers. PR-URL: https://github.com/nodejs/node/pull/30467 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
* src: pass resource object along with InternalMakeCallbackAnna Henningsen2020-03-041-0/+1
| | | | | | | | | | | | | | | This was an oversight in 9fdb6e6aaf45b2364bac89a. Fixing this is necessary to make `executionAsyncResource()` work as expected. Refs: https://github.com/nodejs/node/pull/30959 Fixes: https://github.com/nodejs/node/issues/32060 PR-URL: https://github.com/nodejs/node/pull/32063 Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* vm: lazily initialize primordials for vm contextsJoyee Cheung2020-02-191-0/+1
| | | | | | | | | | | | Lazily initialize primordials when cross-context support for builtins is needed to fix the performance regression in context creation. PR-URL: https://github.com/nodejs/node/pull/31738 Fixes: https://github.com/nodejs/node/issues/29842 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: David Carlier <devnexen@gmail.com>
* async_hooks: add executionAsyncResourceMatteo Collina2020-02-111-4/+2
| | | | | | | | | | | | Remove the need for the destroy hook in the basic APM case. Co-authored-by: Stephen Belanger <admin@stephenbelanger.com> PR-URL: https://github.com/nodejs/node/pull/30959 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* src: remove fixed-size GetHumanReadableProcessNameBen Noordhuis2020-02-071-1/+0
| | | | | | | | | | | | | | | | | | | Remove the version of GetHumanReadableProcessName() that operates on a fixed-size buffer. The only remaining caller is Assert() which might get called in contexts where dynamically allocating memory isn't possible but as Assert() calls printf(), which also allocates memory when necessary, this commit is unlikely to make matters much worse. PR-URL: https://github.com/nodejs/node/pull/31633 Fixes: https://github.com/nodejs/node/issues/31631 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
* src: fix OOB reads in process.title getterBen Noordhuis2020-02-071-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | The getter passed a stack-allocated, fixed-size buffer to uv_get_process_title() but neglected to check the return value. When the total length of the command line arguments exceeds the size of the buffer, libuv returns UV_ENOBUFS and doesn't modify the contents of the buffer. The getter then proceeded to return whatever garbage was on the stack at the time of the call, quite possibly reading beyond the end of the buffer. Add a GetProcessTitle() helper that reads the process title into a dynamically allocated buffer that is resized when necessary. Fixes: https://github.com/nodejs/node/issues/31631 PR-URL: https://github.com/nodejs/node/pull/31633 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
* worker: add ability to take heap snapshot from parent threadAnna Henningsen2020-02-031-0/+10
| | | | | | | | | | PR-URL: https://github.com/nodejs/node/pull/31569 Reviewed-By: Denys Otrishko <shishugi@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
* src: remove duplicate field env in CryptoJob classConorDavenport2020-02-021-0/+2
| | | | | | | | | | | | | | Removed field env from cryptojob class, replaced with function env() inherited from ThreadPoolWork PR-URL: https://github.com/nodejs/node/pull/31554 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
* process: report ArrayBuffer memory in `memoryUsage()`Anna Henningsen2020-01-301-8/+12
| | | | | | | | | | | | | Report memory allocations performed by the `ArrayBuffer::Allocator`. PR-URL: https://github.com/nodejs/node/pull/31550 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
* src: expose ArrayBuffer version of Buffer::New()Anna Henningsen2019-11-191-1/+1
| | | | | | | | | | | | This can be useful to create `Buffer` instances for already-existing `ArrayBuffer`s, e.g. ones created manually from a backing store with a free callback (of which our variant in the public API has some limitations). PR-URL: https://github.com/nodejs/node/pull/30476 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* src: make WaitForInspectorDisconnect an exit hookAnna Henningsen2019-11-061-1/+4
| | | | | | | | | | | | | | Run inspector cleanup code on Environment teardown. This is part of a series of changes to make embedding easier, by requiring fewer internal methods to build a fully functioning Node.js instance. PR-URL: https://github.com/nodejs/node/pull/30229 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Shelley Vohr <codebytere@gmail.com>
* src: make EndStartedProfilers an exit hookAnna Henningsen2019-11-061-1/+0
| | | | | | | | | | | | | | Run `EndStartedProfilers` on Environment teardown. This is part of a series of changes to make embedding easier, by requiring fewer internal methods to build a fully functioning Node.js instance. PR-URL: https://github.com/nodejs/node/pull/30229 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Shelley Vohr <codebytere@gmail.com>
* src: track no of active JS signal handlersAnna Henningsen2019-11-061-0/+2
| | | | | | | | | | This makes it possible to tell whether a signal is being tracked in JS. PR-URL: https://github.com/nodejs/node/pull/30229 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Shelley Vohr <codebytere@gmail.com>
* src: remove AsyncScope and AsyncCallbackScopeAnna Henningsen2019-11-061-4/+10
| | | | | | | | | | Reduce the number of different scopes we use for async callbacks. PR-URL: https://github.com/nodejs/node/pull/30236 Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* src: use callback scope for main scriptAnna Henningsen2019-11-061-3/+8
| | | | | | | | | | | This allows removing custom code for setting the current async ids and running nextTicks. PR-URL: https://github.com/nodejs/node/pull/30236 Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* encoding: make TextDecoder handle BOM correctlyAnna Henningsen2019-11-051-1/+5
| | | | | | | | | | | Do not accept the BOM if it comes from a different encoding, and only discard the BOM after it has actually been read (including when it is spread over multiple chunks in streaming mode). Fixes: https://github.com/nodejs/node/issues/25315 PR-URL: https://github.com/nodejs/node/pull/30132 Reviewed-By: Gus Caplan <me@gus.host>
* src: expose granular SetIsolateUpForNodeShelley Vohr2019-11-011-2/+2
| | | | | | | | | | | | | | | This PR exposes a new embedder-focused API: SetIsolateUpForNode. It maintains previous behavior for the single-param version of SetIsolateUpForNode and changes no defaults, but was designed to be flexible by allowing for embedders to conditionally override all callbacks and flags set by the previous two-param version of SetIsolateUpForNode. PR-URL: https://github.com/nodejs/node/pull/30150 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com>
* src: re-delete Atomics.wakeGus Caplan2019-09-181-0/+2
| | | | | | | | | 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>
* src: restore stdio on program exitBen Noordhuis2019-06-121-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | Record the state of the stdio file descriptors on start-up and restore them to that state on exit. This should prevent issues where node.js sometimes leaves stdio in raw or non-blocking mode. This is a reworked version of commit c2c9c0c3d3 from May 2018 that was reverted in commit 14dc17df38 from June 2018. The revert was a little light on details but I infer that the problem was caused by a missing call to `uv_tty_reset_mode()`. Apropos the NOLINT comments: cpplint doesn't understand do/while statements, it thinks they're while statements without a body. Fixes: https://github.com/nodejs/node/issues/14752 Fixes: https://github.com/nodejs/node/issues/21020 Original-PR-URL: https://github.com/nodejs/node/pull/20592 PR-URL: https://github.com/nodejs/node/pull/24260 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Refael Ackermann (רפאל פלחי) <refack@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
* src: split `RunBootstrapping()`Joyee Cheung2019-06-031-1/+0
| | | | | | | | | Split `RunBootstrapping()` into `BootstrapInternalLoaders()` and `BootstrapNode()` from so the two can be snapshotted incrementally. PR-URL: https://github.com/nodejs/node/pull/27539 Reviewed-By: Anna Henningsen <anna@addaleax.net>
* src: move DiagnosticFilename inlines into a -inl.hSam Roberts2019-05-261-9/+7
| | | | | | | | | | | | DiagnosticFilename's constructor default values use inlines from env-inl.h, causing the many users of node_internals.h to include env-inl.h, even if they never use DiagnosticFilename. PR-URL: https://github.com/nodejs/node/pull/27839 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
* src: remove env-inl.h from header filesSam Roberts2019-05-231-1/+1
| | | | | | | | | | | Inline headers should only be included into the .cc files that use them. PR-URL: https://github.com/nodejs/node/pull/27755 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
* src: move ThreadPoolWork inlines into a -inl.hSam Roberts2019-05-231-21/+0
| | | | | | | | | | | | | | The presence of the inline definitions in node_internals.h can cause all files that include node_internals.h to depend on util-inl.h, even if they never use ThreadPoolWork. Whether this happens depends on the toolchain, gcc will strip unused definitions, clang won't. PR-URL: https://github.com/nodejs/node/pull/27755 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
* src: enable V8's WASM trap handlersGus Caplan2019-05-161-4/+1
| | | | | | | | | | | | | | | | This uses SIGSEGV handlers to catch WASM out of bound (OOB) memory accesses instead of inserting OOB checks inline, resulting in a 25%-30% speed increase. Note that installing a custom SIGSEGV handler will break this, resulting in potentially scary behaviour. Refs: https://github.com/nodejs/node/issues/14927 PR-URL: https://github.com/nodejs/node/pull/27246 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
* src: remove util-inl.h from header filesSam Roberts2019-05-131-1/+1
| | | | | | | | | | | | Its intended that *-inl.h header files are only included into the src files that call the inline methods. Explicitly include it into the files that need it. PR-URL: https://github.com/nodejs/node/pull/27631 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
* src: refactor profile initializationJoyee Cheung2019-05-021-2/+1
| | | | | | | | | | | - Process and store --cpu-prof-dir and --cpu-prof-name during Environment creation - Start profilers in one `profiler::StartProfilers()` PR-URL: https://github.com/nodejs/node/pull/27475 Refs: https://github.com/nodejs/node/issues/27421 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
* src: prefer v8::Global over node::PersistentAnna Henningsen2019-04-301-1/+0
| | | | | | | | | | | | | | | | | | `v8::Global` is essentially a nicer variant of `node::Persistent` that, in addition to reset-on-destroy, also implements move semantics. This commit makes the necessary replacements, removes `node::Persistent` and (now-)unnecessary inclusions of the `node_persistent.h` header, and makes some of the functions that take Persistents as arguments more generic so that they work with all `v8::PersistentBase` flavours. PR-URL: https://github.com/nodejs/node/pull/27287 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
* src: allow creating NodeMainInstance that does not own the isolateJoyee Cheung2019-04-231-0/+3
| | | | | | | | | | | | Allows instantiating a NodeMainInstance with an isolate whose initialization and disposal are controlled by the caller. PR-URL: https://github.com/nodejs/node/pull/27321 Refs: https://github.com/nodejs/node/issues/17058 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
* src: split per-process initialization and teardown routinesJoyee Cheung2019-04-201-0/+9
| | | | | | | | | This patch makes it possible to instantiate NodeMainInstance in a separate target and use it to e.g. create snapshot. PR-URL: https://github.com/nodejs/node/pull/27276 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
* inspector: implement --cpu-prof[-path]Joyee Cheung2019-04-191-0/+1
| | | | | | | | | | | | | | This patch introduces a CLI flag --cpu-prof that starts the V8 CPU profiler on start up, and ends the profiler then writes the CPU profile before the Node.js instance (on the main thread or the worker thread) exits. By default the profile is written to `${cwd}/CPU.${yyyymmdd}.${hhmmss}.${pid}.${tid}.${seq}.cpuprofile`. The patch also introduces a --cpu-prof-path flag for the user to specify the path the profile will be written to. Refs: https://github.com/nodejs/node/issues/26878 PR-URL: https://github.com/nodejs/node/pull/27147 Reviewed-By: Anna Henningsen <anna@addaleax.net>
* src: use RAII to manage the main isolate dataJoyee Cheung2019-04-171-1/+3
| | | | | | | | | | | | | This patch encapsulates the main isolate management into a NodeMainInstance class that manages the resources with RAII and controls the Isolate::CreateParams (which is necessary for deserializing snapshots with external references) PR-URL: https://github.com/nodejs/node/pull/27220 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
* src: always use diagnostic file sequence numbercjihrig2019-04-101-8/+5
| | | | | | | | | | | | | This commit attaches a sequence number to all filenames that are automatically generated by DiagnosticFilename. This prevents accidental overwriting of existing files. PR-URL: https://github.com/nodejs/node/pull/27142 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
* src: port coverage serialization to C++Joyee Cheung2019-04-061-0/+11
| | | | | | | | | | | This patch moves the serialization of coverage profiles into C++. With this we no longer need to patch `process.reallyExit` and hook into the exit events, but instead hook into relevant places in C++ which are safe from user manipulation. This also makes the code easier to reuse for other types of profiles. PR-URL: https://github.com/nodejs/node/pull/26874 Reviewed-By: Ben Coe <bencoe@gmail.com>
* process: run RunBootstrapping in CreateEnvironmentJoyee Cheung2019-04-031-1/+6
| | | | | | | | | | Also creates `CreateMainEnvironment` to encapsulate the code creating the main environment from the provided Isolate data and arguments. PR-URL: https://github.com/nodejs/node/pull/26788 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Refael Ackermann <refack@gmail.com>
* src: allow per-Environment set of env varsAnna Henningsen2019-03-301-1/+1
| | | | | | | | | | | | | | | Abstract the `process.env` backing mechanism in C++ to allow different kinds of backing stores for `process.env` for different Environments. PR-URL: https://github.com/nodejs/node/pull/26544 Fixes: https://github.com/nodejs/node/issues/24947 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
* inspector: display error when ToggleAsyncHook failsJoyee Cheung2019-03-301-0/+5
| | | | | | | | | | This patch refactors `AppendExceptionLine` and `PrintSyncTrace` to reuse the error formatting logic and use them to print uncaught error in ``ToggleAsyncHook` PR-URL: https://github.com/nodejs/node/pull/26859 Refs: https://github.com/nodejs/node/issues/26798 Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
* src: move AsyncCallbackScope out of EnvironmentJoyee Cheung2019-03-271-1/+1
| | | | | | | PR-URL: https://github.com/nodejs/node/pull/26824 Refs: https://github.com/nodejs/node/issues/26776 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
* src: remove `AddPromiseHook()`Anna Henningsen2019-03-211-1/+17
| | | | | | | | | | | | | | | | | Remove this, as the underlying `Isolate::SetPromiseHook()` may be removed as well in its current form in the future, and `async_hooks` also serves this use case. Refs: https://docs.google.com/document/d/1g8OrG5lMIUhRn1zbkutgY83MiTSMx-0NHDs8Bf-nXxM/ Refs: https://github.com/nodejs/node/pull/26529 PR-URL: https://github.com/nodejs/node/pull/26574 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
* src,lib: make DOMException available in all ContextsAnna Henningsen2019-03-151-0/+2
| | | | | | | | This allows using `DOMException` from Node.js code for any `vm.Context`. PR-URL: https://github.com/nodejs/node/pull/26497 Reviewed-By: James M Snell <jasnell@gmail.com>
* v8: integrate node-heapdump into coreJames M Snell2019-03-131-0/+35
| | | | | | | | | | | | | | | | | Adds `v8.writeHeapSnapshot(filename)` with impl adapted from the `node-heapdump` module. Also, adds a v8.getHeapSnapshot() alternative that returns a Readable Stream PR-URL: https://github.com/nodejs/node/pull/26501 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>