0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-29 23:16:30 +01:00
Commit Graph

373 Commits

Author SHA1 Message Date
Yihong Wang
f878f9414e
build: refine static and shared lib build
Refine the static and shared lib build process in order
to integrate static and shared lib verfication into CI.
When building both static and shared lib, we still build
node executable now and it uses the shared and static lib.

Signed-off-by: Yihong Wang <yh.wang@ibm.com>

Fixes: https://github.com/nodejs/node/issues/14158
PR-URL: https://github.com/nodejs/node/pull/17604
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
2018-01-17 11:34:28 +08:00
Gus Caplan
921fb84687 module: refactor loader
PR-URL: https://github.com/nodejs/node/pull/16874
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Bradley Farias <bradley.meck@gmail.com>
2018-01-15 12:42:29 -06:00
Anna Henningsen
9301b8a9c6
tls: make deprecated tls.createSecurePair() use public API
Make the deprecated `tls.createSecurePair()` method use other public
APIs only (`TLSSocket` in particular).

Since `tls.createSecurePair()` has been runtime-deprecated only
since Node 8, it probably isn’t quite time to remove it yet,
but this patch removes almost all of the code complexity that
is retained by it.

The API, as it is documented, is retained. However, it is very likely
that some users have come to rely on parts of undocumented API
of the `SecurePair` class, especially since some of the existing
tests checked for those. Therefore, this should definitely be
considered a breaking change.

PR-URL: https://github.com/nodejs/node/pull/17882
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
2018-01-14 14:49:41 +01:00
Matteo Collina
61b4d60c5d stream: added experimental support for for-await
Adds support for Symbol.asyncIterator into the Readable class.
The stream is destroyed when the loop terminates with break or throw.

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

PR-URL: https://github.com/nodejs/node/pull/17755
Fixes: https://github.com/nodejs/node/issues/15709
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2018-01-11 12:34:41 +01:00
Qingyan Li
23c9597b92 build: fix cctest target with --enable-static
Currently the cctest target build will fail if configured with --enable-static

$ ./configure --enable-static
$ make

There're some function multiple definition errors such as:
  out/Release/obj.target/node/src/node_crypto.o: In function `node::crypto::RandomBytesWork(uv_work_s*)':
  node_crypto.cc:(.text+0x60): multiple definition of `node::crypto::RandomBytesWork(uv_work_s*)'
  out/Release/obj.target/node/src/node_crypto.o:node_crypto.cc:(.text+0x60): first defined here

It's caused by repetition objects in libraries and libnode.a.
This CL makes those libraries guarded by 'node_target_type!="static_library"'.

PR-URL: https://github.com/nodejs/node/pull/17992
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2018-01-09 15:54:31 -08:00
Michaël Zasso
416c0ec952 repl: show lexically scoped vars in tab completion
Use the V8 inspector protocol, if available, to query the list of
lexically scoped variables (defined with `let`, `const` or `class`).

PR-URL: https://github.com/nodejs/node/pull/16591
Fixes: https://github.com/nodejs/node/issues/983
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2017-12-21 14:47:29 +01:00
Jeremiah Senkpiel
24dd92e77f net: use actual Timeout instance on Sockets
This makes `net.Sockets` use actual Timeout objects in a `[kTimeout]`
symbol property, rather than making the socket itself a timer and
appending properties to it directly.

This should make the code generally easier to understand, and might
also prevent some deopts from properties being changes on the socket
itself.

Also moves the Timeout constructor into an internal module.

PR-URL: https://github.com/nodejs/node/pull/17704
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
2017-12-20 18:28:11 -05:00
James M Snell
2ca227f642 fs: refactor FSReqWrap and After
Separate FSReqWrap definition into a new node_file.h.

Add Reject and Resolve methods to encapsulate the callbacks and
make the constructor, destructor protected instead of private
in preparation to make FSReqWrap subclassable for the Promises
implementation.

Rework and simplify the After function slightly in preparation
for a refactor.

Introduce the node::fs namespace instead of using an anonymous
namespace for fs methods.

PR-URL: https://github.com/nodejs/node/pull/17689
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2017-12-18 11:11:13 -08:00
Matheus Marchini
c1689dc32c
build: define HAVE_OPENSSL macro for cctest
cctest build target wasn't defining the HAVE_OPENSSL macro when
node_use_openssl was true, causing inconsistencies on most
`node::Environment` member's addresses. For example, if someone
wanted to access the context of an environment by using
`node::Environment::context()`, the object returned by the
function was pointing to an invalid address.

PR-URL: https://github.com/nodejs/node/pull/17461
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2017-12-09 15:32:17 -05:00
Ben Noordhuis
05948d8e4e lib: remove use of Debug.MakeMirror()
This paves the way for removing `vm.runInDebugContext()`.  Inspection
of Map and Set iterators is now done through V8 instrinsics.

Fixes: https://github.com/nodejs/node/issues/11875
PR-URL: https://github.com/nodejs/node/pull/13295
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Robert Jefe Lindstaedt <robert.lindstaedt@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
2017-11-24 00:13:44 +01:00
Ben Noordhuis
088bba31a3 Revert "src, tools: add debug symbols for node internals"
This reverts commit 446c1ecfda.

Reverted for breaking `make test-v8`.  The "find all relevant system
headers" logic in `tools/gen-postmortem-metadata.py` needs more work.

Also reverts commit e46c3f743d.
("tools: fix typo in gen-postmortem-metadata.py".)

PR-URL: https://github.com/nodejs/node/pull/17272
Refs: https://github.com/nodejs/node/pull/14901
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Matheus Marchini <matheusdot@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2017-11-23 16:09:59 +01:00
Matheus Marchini
446c1ecfda src, tools: add debug symbols for node internals
Before these changes, only V8 added debug symbols to Node's binary,
limiting the possibilities for debugger's developers to add some
features that rely on investigating Node's internal structures.

These changes are a first steps towards empowering debug tools to
navigate Node's internals strucutres. One example of what can be
achieved with this is shown at nodejs/llnode#122 (a command which prints
information about handles and requests on the queue for a core dump
file). Node debug symbols are prefixed with node_dbg_.

Ref: https://github.com/nodejs/llnode/pull/122

PR-URL: https://github.com/nodejs/node/pull/14901
Refs: https://github.com/nodejs/post-mortem/issues/46
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-11-21 10:20:20 -08:00
James M Snell
69e6c5a212
http2: major update to internals
This update does several significant things:

1. It eliminates the base Nghttp2* classes and folds those
   in to node::http2::Http2Session and node::http2::Http2Stream
2. It makes node::http2::Http2Stream a StreamBase instance and
   sends that out to JS-land to act as the [kHandle] for the
   JavaScript Http2Stream class.
3. It shifts some of the callbacks from C++ off of the JavaScript
   Http2Session class to the Http2Stream class.
4. It refactors the data provider structure for FD and Stream
   based sending to help encapsulate those functions easier
5. It streamlines some of the functions at the C++ layer to
   eliminate now unnecessary redirections
6. It cleans up node_http2.cc for better readability and
   maintainability
7. It refactors some of the debug output
8. Because Http2Stream instances are now StreamBases, they are
   now also trackable using async-hooks
9. The Stream::OnRead algorithm has been simplified with a
   couple bugs fixed.
10. I've eliminated node_http2_core.h and node_http2_core-inl.h
11. Detect invalid handshake a report protocol error to session
12. Refactor out of memory error, improve other errors
13. Add Http2Session.prototype.ping

PR-URL: https://github.com/nodejs/node/pull/17105
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Sebastiaan Deckers <sebdeckers83@gmail.com>
2017-11-21 12:47:54 +01:00
Ed Schouten
336af9ac1f
build: Allow linking against an external copy of nghttp2.
The version of nghttp2 in deps/ does not build on CloudABI, even though
the official version does. Though this is an issue on its own that needs
to be resolved, it is currently a bit hard to work around this. There is
no switch to link against an external version of nghttp2, even though we
do provide this option for other libraries.

This change adds configure flags, similar to the ones we have for
OpenSSL, zlib, http_parser, libuv, etc. and makes the dependency on
deps/nghttp2 optional.

PR-URL: https://github.com/nodejs/node/pull/16788
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Refael Ackermann <refack@gmail.com>
2017-11-20 14:25:33 -05:00
Andreas Madsen
07a4fa3dbe
async_hooks: deprecate undocumented API
PR-URL: https://github.com/nodejs/node/pull/16972
Refs: https://github.com/nodejs/node/issues/14328
Refs: https://github.com/nodejs/node/issues/15572
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2017-11-20 12:03:06 +01:00
Daniel Bevenius
b58a1cd70a src: rename req-wrap -> req_wrap
This commit renames req-wrap to req_wrap consitency with other
c++ source files.

PR-URL: https://github.com/nodejs/node/pull/17022
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
2017-11-17 12:49:20 +01:00
Daniel Bevenius
a515e593f3 src: rename base-object -> base_object
This commit renames base-object to base_object for consitency with other
c++ source files.

PR-URL: https://github.com/nodejs/node/pull/17022
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
2017-11-17 12:49:10 +01:00
Daniel Bevenius
78447666ea src: rename async-wrap -> async_wrap
This commit renames async-wrap to async_wrap for consitency with other
c++ source files.

PR-URL: https://github.com/nodejs/node/pull/17022
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
2017-11-17 12:49:00 +01:00
Daniel Bevenius
c661dad086 build: fix cctest target --with-dtrace
Currently the cctest target will fail on linux when configured
--with-dtrace:

/node-v9.2.0/out/Release/obj.target/node/src/node_dtrace.o:
In function `node::DTRACE_NET_SERVER_CONNECTION(
    v8::FunctionCallbackInfo<v8::Value> const&)':
node_dtrace.cc:(.text+0x103): undefined reference to
`node_net__server__connection_semaphore'
/node-v9.2.0/out/Release/obj.target/node/src/node_dtrace.o:
In function `node::DTRACE_NET_STREAM_END(
    v8::FunctionCallbackInfo<v8::Value> const&)':
...

This is because node_dtrace_provider.o is not linked by the cctest
target.

This commit tries to fix and simplify the conditions in cctest target
so that node_dtrace.o is included for all operating systems that support
dtrace, include node_dtrace_ustack.o for all operating systems except
mac and linux, and include node_dtrace_provider.o for all operating
systems except mac.

PR-URL: https://github.com/nodejs/node/pull/17039
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2017-11-17 07:20:24 +01:00
Timothy Gu
eeab7bc068
repl: support top-level await
Much of the AST visitor code was ported from Chrome DevTools code
written by Aleksey Kozyatinskiy <kozyatinskiy@chromium.org>.

PR-URL: https://github.com/nodejs/node/pull/15566
Fixes: https://github.com/nodejs/node/issues/13209
Refs: e8111c396f
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2017-11-16 15:42:46 -08:00
Timothy Gu
e38570fe56
deps: import acorn@5.2.1
Imported from the tarball published on npm
(https://registry.npmjs.org/acorn/-/acorn-5.2.1.tgz).

PR-URL: https://github.com/nodejs/node/pull/15566
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2017-11-16 15:40:42 -08:00
Andreas Madsen
d217b2850e
async_hooks: add trace events to async_hooks
This will allow trace event to record timing information for all
asynchronous operations that are observed by async_hooks.

PR-URL: https://github.com/nodejs/node/pull/15538
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2017-11-16 11:46:54 +01:00
Daniel Bevenius
b021403b2a test: --enable-static linked executable
The motivation for this commit is to enable projects embedding Node.js
and building with --enable-static to be able to run the test suite and
linter.

Currently when building with --enable-static no node executable
will be created which means that the tests (apart from the cctest) and
linter cannot be run.

This is currently a work in progress and works on MacOS but I need to
run the CI, and manually on different environments to verify that it
works as expected.

PR-URL: https://github.com/nodejs/node/pull/14986
Refs: https://github.com/nodejs/node/issues/14158
Refs: https://github.com/nodejs/node/pull/14892
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
2017-11-16 09:22:13 +01:00
Yihong Wang
8680bb9f1a
src: explicitly register built-in modules
Previously, built-in modules are registered before main() via
__attribute__((constructor)) mechanism in GCC and similiar
mechanism in MSVC. This causes some issues when node is built as
static library. Calling module registration function for built-in
modules in node::Init() helps to avoid the issues.

Signed-off-by: Yihong Wang <yh.wang@ibm.com>
PR-URL: https://github.com/nodejs/node/pull/16565
Refs: https://github.com/nodejs/node/pull/14986#issuecomment-332758206
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2017-11-13 23:17:34 +00:00
Daniel Bevenius
f5809d8e35 build: fix cctest compilation
Currently the cctest target compiles sources files even though they are
compiled for the node target. This is my fault as when I worked on the
task of getting the cctest to use the object files from the node target
I missed a few sources that were being included from node.gypi. This
also effects the build time as these sources are compiled twice.

This commit moves the conditions in question into the node target in
node.gyp. With this commit there should be no object files in
out/Release/obj.target/cctest/src/ (the path will vary depending on the
operating system being used).

PR-URL:https://github.com/nodejs/node/pull/16887
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2017-11-13 08:34:58 +01:00
Yihong Wang
b340c2d4dd
build: remove cctest extension
cctest has `so.59` extension when building node shared library in linux.
The appending is defined in node.gypi and the cctest target in node.gyp
includes node.gypi. Moving the appending from node.gypi to node target
in node.gyp fixes the issue.

Signed-off-by: Yihong Wang <yh.wang@ibm.com>

PR-URL: https://github.com/nodejs/node/pull/16680
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
2017-11-10 16:47:40 -05:00
Daniel Bevenius
cad1d1ff45 src: add openssl-system-ca-path configure option
The motivation for this commit is that we need to specify system CA
certificates when building node. While we are aware of the environment
variable NODE_EXTRA_CA_CERTS this is not a great solution as we build
an RPM and we also don't want users to be able to unset them.

The suggestion is to add a configure time property like this:

--openssl-system-ca-path=OPENSSL_SYSTEM_CA_PATH
             Use the specified path to system CA (PEM format) in
             addition to the OpenSSL supplied CA store or compiled-
             in Mozilla CA copy.

Usage example:
$ ./configure --openssl-system-ca-path=/etc/pki/tls/certs/ca-bundle.crt

This would add the specified CA certificates in addition to the ones
already being used.

PR-URL: https://github.com/nodejs/node/pull/16790
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2017-11-10 05:47:20 +01:00
Daniel Bevenius
18df171307 build: add missing comma in sources list
This commit adds a missing comma in the sources list. This effects at
least window which produces the following warning where trace_event.h
and src/util.h are concatenated:

Warning: Missing input files:
src\tracing\trace_event.hsrc\util.h

PR-URL: https://github.com/nodejs/node/pull/16613
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
2017-11-01 09:25:05 +01:00
Rich Trott
36732084db util,assert: expose util.isDeepStrictEqual()
Provide `util.isDeepStrictEqual()` that works like
`assert.deepStrictEqual()` but returns a boolean rather than throwing an
error.

Several userland modules have needed this functionality and implemented
it independently. This functionality already exists in Node.js core, so
this exposes it for use by modules. Modules that have needed this
functionality include `lodash`, `concordance` (used by `ava`), and
`qunit`.

PR-URL: https://github.com/nodejs/node/pull/16084
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2017-10-25 22:30:37 -07:00
Jon Moss
a82401e689
build: do not include deleted directory
`deps/uv/src/ares` hasn't existed since
libuv/libuv@41b1265af8 (mid 2012).

PR-URL: https://github.com/nodejs/node/pull/16384
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2017-10-24 22:30:31 -04:00
Anna Henningsen
542e94cdce
lib: move _stream_wrap into internals
This makes a subsequent possible deprecation easier.

PR-URL: https://github.com/nodejs/node/pull/16158
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2017-10-19 18:06:27 +02:00
guybedford
d21a11dc23 module: resolve and instantiate loader pipeline hooks
This enables a --loader flag for Node, which can provide custom
"resolve" and "dynamicInstantiate" methods for custom ES module
loading.

In the process, module providers have been converted from classes
into functions and the module APIs have been made to pass URL strings
over objects.

PR-URL: https://github.com/nodejs/node/pull/15445
Reviewed-By: Bradley Farias <bradley.meck@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
2017-10-11 08:47:23 -05:00
Daniel Bevenius
0c9b267b1d src: rename perfctr_macros.py->noperfctr_macros.py
This commit renames perfctr_macros.py to be consistent with the other
macro python scripts nolttng_macros.py, and notrace_macros.py.

PR-URL: https://github.com/nodejs/node/pull/16100
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-10-11 07:42:02 +02:00
Timothy Gu
7907534a8d
lib: faster type checks for some types
PR-URL: https://github.com/nodejs/node/pull/15663
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Benedikt Meurer <benedikt.meurer@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-10-01 23:58:59 -03:00
Ben Noordhuis
3c777bb37f
deps: define BUILDING_NGHTTP2 during nghttp2 build
Define BUILDING_NGHTTP2 in order that NGHTTP2_EXTERN is properly defined
when building the nghttp2 static library.

Move NGHTTP2_STATICLIB out of node.gyp because it is a property of the
nghttp2 static library, not the node executable.

PR-URL: https://github.com/nodejs/node/pull/15487
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-09-24 12:17:03 -03:00
jBarz
c5eb5bfc2e
build: enable runtime linking
Enable runtime linking of shared objects. This will
allow loading of symbols using the RTLD_GLOBAL flag.

PR-URL: https://github.com/nodejs/node/pull/15286
Fixes: https://github.com/nodejs/node/issues/15243
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-09-20 09:12:14 -03:00
James M Snell
c75f87cc4c crypto: refactor the crypto module
* Split single monolithic file into multiple
* Make Certificate methods static
* Allow randomFill(Sync) to use any ArrayBufferView
* Use internal/errors throughout
* Improve arg validation in Hash/Hmac
* Doc updates

PR-URL: https://github.com/nodejs/node/pull/15231
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
2017-09-18 08:10:59 -07:00
XadillaX
468110b327
tls: deprecate parseCertString & move to internal
`tls.parseCertString()` exposed by accident. Now move this function to
`internal/tls` and mark the original one as deprecated.

PR-URL: https://github.com/nodejs/node/pull/14249
Refs: https://github.com/nodejs/node/issues/14193
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
2017-09-13 16:54:35 -03:00
Mike Kaufman
35a526c1d4
http2,async-wrap: introduce AliasedBuffer class
This change introduces an AliasedBuffer class and updates asytnc-wrap
and http2 to use this class.

A common technique to optimize performance is to create a native buffer
and then map that native buffer to user space via JS array.  The runtime
can efficiently write to the native buffer without having to route
though JS, and the values being written are accessible from user space.

While efficient, this technique allows modifications to user
space memory w/out going through JS type system APIs, effectively
bypassing any monitoring the JS VM has in place to track program state
modifications.  The result is that monitors have an incorrect view
of prorgram state.

The AliasedBuffer class provides a future placeholder where this
technique can be used, but writes can still be observed.  To achieve
this, the node-chakra-core fork will add in appropriate tracking logic
in the AliasedBuffer's SetValue() method. Going forward, this class can
evolve to support more sophisticated mechanisms if necessary.

PR-URL: https://github.com/nodejs/node/pull/15077
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2017-09-13 17:44:24 +02:00
Bradley Farias
c8a389e19f module: Allow runMain to be ESM
This follows the EPS an allows the node CLI to have ESM as an entry point.
`node ./example.mjs`. A newer V8 is needed for `import()` so that is not
included. `import.meta` is still in specification stage so that also is not
included.

PR-URL: https://github.com/nodejs/node/pull/14369
Author: Bradley Farias <bradley.meck@gmail.com>
Author: Guy Bedford <guybedford@gmail.com>
Author: Jan Krems <jan.krems@groupon.com>
Author: Timothy Gu <timothygu99@gmail.com>
Author: Michaël Zasso <targos@protonmail.com>
Author: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2017-09-07 15:18:32 -05:00
Alexey Orlenko
689a643198 build: fix indentation in node.gyp
One line in node.gyp was indented using a mix of a tab and spaces,
convert it to all spaces.

PR-URL: https://github.com/nodejs/node/pull/15051
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-08-28 22:15:13 -07:00
James M Snell
67269fd7f3 perf_hooks: implementation of the perf timing API
An initial implementation of the Performance Timing API for Node.js.
This is the same Performance Timing API implemented by modern browsers
with a number of Node.js specific properties. The User Timing mark()
and measure() APIs are implemented, garbage collection timing, and
node startup milestone timing.

```js
const { performance } = require('perf_hooks');

performance.mark('A');
setTimeout(() => {
  performance.mark('B');
  performance.measure('A to B', 'A', 'B');
  const entry = performance.getEntriesByName('A to B', 'measure')[0];
  console.log(entry.duration);
}, 10000);
```

The implementation is at the native layer and makes use of uv_hrtime().
This should enable *eventual* integration with things like Tracing
and Inspection.

The implementation is extensible and should allow us to add new
performance entry types as we go (e.g. for measuring i/o perf,
etc).

Documentation and a test are provided.

PR-URL: https://github.com/nodejs/node/pull/14680
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2017-08-23 16:00:09 -07:00
Daniel Bevenius
58ca8c68c4 build: don't add libraries when --enable-static
Currently when building with --enabled-static the cctest target will
include libraries to be linked regardless. This commit adds a condition
to only add the libraries when dynamically linking.

This commit re-adds the previously reverted commit (be63c26e8c
"build: don't add libraries when --enable-static"). The reason that
commit failed was a mistake on my part where I moved the the list
into a variable (thinking that it was a simple change that would not
affect anything) and not re-running CI. But the list itself contains
variables used to enable differences in operating systems/compilers
where the object file locations vary.

PR-URL: https://github.com/nodejs/node/pull/14912
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Refael Ackermann <refack@gmail.com>
2017-08-21 10:02:35 +02:00
James M Snell
35f6e59dfc src: minor cleanup for node_revert
Make the revert related functions inline to eliminate the need
for node_revert.cc, prefix the constants and the def, other misc
cleanup

PR-URL: https://github.com/nodejs/node/pull/14864
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2017-08-18 15:02:12 -07:00
Anna Henningsen
491cc76871
src: use unordered_set instead of custom rb tree
Use a standard hash-based container instead of the custom included
red/black tree implementation. There is likely no noticeable
performance difference, and if there is one, it is very likely
to be an improvement.

PR-URL: https://github.com/nodejs/node/pull/14826
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2017-08-17 20:26:59 +02:00
Matt Loring
9e08695f85
src: Node implementation of v8::Platform
Node.js currently uses the V8 implementation of the DefaultPlatform
which schedules VM tasks on a V8 managed thread pool. Since the Node.js
event loop is not aware of these tasks, the Node.js process may exit
while there are outstanding VM tasks. This will become problematic once
asynchronous wasm compilation lands in V8.

This PR introduces a Node.js specific implementation of the v8::Platform
on top of libuv so that the event loop is aware of outstanding VM tasks.

PR-URL: https://github.com/nodejs/node/pull/14001
Fixes: https://github.com/nodejs/node/issues/3665
Fixes: https://github.com/nodejs/node/issues/8496
Fixes: https://github.com/nodejs/node/issues/12980
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2017-08-17 20:26:55 +02:00
Ben Noordhuis
aa011a111d Revert "build: don't add libraries when --enable-static"
Reverted for breaking the Windows build with the following error:

    LINK : fatal error LNK1181: cannot open input file
    'c:\workspace\node-compile-windows\label\win-vs2015\
    Release\obj\node\gen\node_javascript.o'

This reverts commit be63c26e8c.

PR-URL: https://github.com/nodejs/node/pull/14893
Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
2017-08-17 16:11:29 +02:00
Miroslav Bajtoš
a0895ed6c4
inspector: enable async stack traces
Implement a special async_hooks listener that forwards information
about async tasks to V8Inspector asyncTask* API, thus enabling
DevTools feature "async stack traces".

The feature is enabled only on 64bit platforms due to a technical
limitation of V8 Inspector: inspector uses a pointer as a task id,
while async_hooks use 64bit numbers as ids.

To avoid performance penalty of async_hooks when not debugging,
the new listener is enabled only when the process enters a debug mode:

 - When the process is started with `--inspect` or `--inspect-brk`,
   the listener is enabled immediately and async stack traces
   lead all the way to the first tick of the event loop.

 - When the debug mode is enabled via SIGUSR1 or `_debugProcess()`,
   the listener is enabled together with the debugger. As a result,
   only async operations started after the signal was received
   will be correctly observed and reported to V8 Inspector. For example,
   a `setInterval()` called in the first tick of the event will not be
   shown in the async stack trace when the callback is invoked. This
   behaviour is consistent with Chrome DevTools.

Last but not least, this commit fixes handling of InspectorAgent's
internal property `enabled_` to ensure it's set back to `false`
after the debugger is deactivated (typically via `process._debugEnd()`).

Fixes: https://github.com/nodejs/node/issues/11370
PR-URL: https://github.com/nodejs/node/pull/13870
Reviewed-by: Timothy Gu <timothygu99@gmail.com>
Reviewed-by: Anna Henningsen <anna@addaleax.net>
2017-08-17 20:52:39 +08:00
Daniel Bevenius
be63c26e8c build: don't add libraries when --enable-static
Currently when building with --enabled-static the cctest target will
include libraries to be linked regardless. This commit adds a condition
to only add the libraries when dynamically linking.

PR-URL: https://github.com/nodejs/node/pull/14837
Fixes: https://github.com/nodejs/node/issues/13500
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-08-17 07:15:17 +02:00
James M Snell
949aec5c32 http2: handful of http/2 src cleanups
* inline more stuff. remove a node_http2_core.cc
* clean up debug messages
* simplify options code, and cleanup

PR-URL: https://github.com/nodejs/node/pull/14825
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2017-08-16 07:27:32 -07:00