platform/upstream/nodejs.git
9 years agowin,openssl: disable some warnings
Bert Belder [Thu, 8 Jan 2015 12:43:22 +0000 (13:43 +0100)]
win,openssl: disable some warnings

This patch disables two (categories of) warnings:

  * deprecation of GetVersionExA
  * possible loss of data in implicit conversion of scalar types

These warnings don't seem to point out serious problems, and avoiding
them in openssl is somebody else's business.

PR-URL: https://github.com/iojs/io.js/pull/261
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
9 years agotest: move broadcast/multicast test to internet/
Ben Noordhuis [Thu, 8 Jan 2015 10:46:21 +0000 (11:46 +0100)]
test: move broadcast/multicast test to internet/

Move parallel/test-dgram-broadcast-multi-process to test/internet.

The test does not play nice with firewalls that restrict broadcast
or multicast traffic, nor can it be rewritten to use only loopback
traffic without running into platform-specific limitations, see also
commits 52e600a and 236533c (TODO: update second one before landing.)

PR-URL: https://github.com/iojs/io.js/pull/259
Reviewed-By: Rod Vagg <rod@vagg.org>
9 years agoRevert "test: don't assume broadcast traffic is unfiltered"
Ben Noordhuis [Thu, 8 Jan 2015 10:42:34 +0000 (11:42 +0100)]
Revert "test: don't assume broadcast traffic is unfiltered"

This reverts commit 52e600a9c8655f578fae55d85e778b58d731201a.

Reverted for:

* making the test fail with ENETUNREACH on OS X 10.8, and

* making the test fail with EHOSTDOWN on OS X 10.9 and 10.10 when there
  is no network connectivity, and

* leaving behind orphan processes that make subsequent tests fail with
  EADDRINUSE errors

PR-URL: https://github.com/iojs/io.js/pull/259
Reviewed-By: Rod Vagg <rod@vagg.org>
9 years agowin: disable stl exception usage
Bert Belder [Thu, 8 Jan 2015 10:23:59 +0000 (11:23 +0100)]
win: disable stl exception usage

Tell the stl that exception handling is unavailable. This avoids warnings
like:

  C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\
  xlocale(337): warning C4530: C++ exception handler used, but unwind
  semantics are not enabled. Specify /EHsc

PR-URL: https://github.com/iojs/io.js/pull/258
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
9 years agowin: disable exception handling for all builds
Bert Belder [Thu, 8 Jan 2015 10:19:16 +0000 (11:19 +0100)]
win: disable exception handling for all builds

Previously exception handling was disabled in release builds, but
enabled in debug builds. That makes no sense.

PR-URL: https://github.com/iojs/io.js/pull/258
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
9 years agoutil: show symbol properties
Vladimir Kurchatkin [Wed, 7 Jan 2015 21:54:25 +0000 (00:54 +0300)]
util: show symbol properties

Properties with symbol names are shown if option `showHidden` of `util.inspect`
or `console.dir` is `true`.

PR-URL: https://github.com/iojs/io.js/pull/247
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Rod Vagg <rod@vagg.org>
9 years agosrc,deps: replace LoadLibrary by LoadLibraryW
Cheng Zhao [Wed, 31 Dec 2014 20:38:08 +0000 (12:38 -0800)]
src,deps: replace LoadLibrary by LoadLibraryW

On Windows, when compiling with `UNICODE` defined, `LoadLibrary` becomes
`LoadLibraryW`. When an ASCII string is passed to that function it
crashes.

PR-URL: https://github.com/iojs/io.js/pull/226
Reviewed-By: Bert Belder <bertbelder@gmail.com>
9 years agosrc: pass Isolate to node::Utf8Value constructor
Trevor Norris [Wed, 7 Jan 2015 22:13:35 +0000 (14:13 -0800)]
src: pass Isolate to node::Utf8Value constructor

Initial attempt to remove all uses of Isolate::GetCurrent(). Still
exists a few locations, but this works out a heavy usage.

PR-URL: https://github.com/iojs/io.js/pull/244
Reviewed-by: Ben Noordhuis <info@bnoordhuis.nl>
9 years agosrc: pass Isolate to additional locations
Trevor Norris [Wed, 7 Jan 2015 21:29:58 +0000 (13:29 -0800)]
src: pass Isolate to additional locations

Due to a recent V8 upgrade, more methods require Isolate as an argument.

PR-URL: https://github.com/iojs/io.js/pull/244
Reviewed-by: Ben Noordhuis <info@bnoordhuis.nl>
9 years agotest: fix parallel/test-repl with new v8
Ben Noordhuis [Wed, 7 Jan 2015 18:16:21 +0000 (19:16 +0100)]
test: fix parallel/test-repl with new v8

Per the ES6 spec, V8 3.31 no longer throws a SyntaxError for scoped
function declarations.

PR-URL: https://github.com/iojs/io.js/pull/243
Reviewed-By: Domenic Denicola <domenic@domenicdenicola.com>
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
9 years agotest: fix parallel/test-repl-harmony with new v8
Ben Noordhuis [Wed, 7 Jan 2015 18:07:18 +0000 (19:07 +0100)]
test: fix parallel/test-repl-harmony with new v8

Assignment to a const var in strict mode is a lazy TypeError now.
Update the test accordingly.

PR-URL: https://github.com/iojs/io.js/pull/243
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
9 years agobuild: fix up build after v8 upgrade
Ben Noordhuis [Wed, 7 Jan 2015 18:05:33 +0000 (19:05 +0100)]
build: fix up build after v8 upgrade

* Define and disable new flag `v8_use_external_startup_data`.

* Disable v8_postmortem_support, it's broken again.  Fedor (@indutny)
  has volunteered to fix it up in the near future.

PR-URL: https://github.com/iojs/io.js/pull/243
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
9 years agodeps: upgrade v8 to 3.31.74.1
Ben Noordhuis [Wed, 7 Jan 2015 17:38:38 +0000 (18:38 +0100)]
deps: upgrade v8 to 3.31.74.1

PR-URL: https://github.com/iojs/io.js/pull/243
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
9 years agodoc: update AUTHORS, .mailmap, add authors tool
Rod Vagg [Fri, 2 Jan 2015 05:16:21 +0000 (16:16 +1100)]
doc: update AUTHORS, .mailmap, add authors tool

PR-URL: https://github.com/iojs/io.js/pull/232
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
9 years agotest: don't assume broadcast traffic is unfiltered
Ben Noordhuis [Mon, 29 Dec 2014 16:35:51 +0000 (17:35 +0100)]
test: don't assume broadcast traffic is unfiltered

parallel/test-dgram-broadcast-multi-process assumes non-local broadcast
traffic is unfiltered, an assumption that fails with, for example, the
default Fedora firewall rules.  Use a loopback interface instead.

Fixes: https://github.com/iojs/io.js/issues/219
PR-URL: https://github.com/iojs/io.js/pull/220
Reviewed-By: Fedor Indutny <fedor@indutny.com>
9 years agodeps: update libuv to 1.2.0
Ben Noordhuis [Mon, 5 Jan 2015 19:44:25 +0000 (20:44 +0100)]
deps: update libuv to 1.2.0

PR-URL: https://github.com/iojs/io.js/pull/237
Reviewed-By: Bert Belder <bertbelder@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
9 years agoMerge remote-tracking branch 'joyent/v0.12' into v1.x
Ben Noordhuis [Mon, 5 Jan 2015 15:43:58 +0000 (16:43 +0100)]
Merge remote-tracking branch 'joyent/v0.12' into v1.x

I was originally going to do this after the v0.11.15 release, but as
that release is three weeks overdue now, I decided not to wait any
longer; we don't want the delta to get too big.

Conflicts:
lib/net.js
test/simple/simple.status

PR-URL: https://github.com/iojs/io.js/pull/236
Reviewed-By: Bert Belder <bertbelder@gmail.com>
Reviewed-By: Fedor Indutny <fedor@indutny.com>
9 years agosmalloc: fix bad assert for zero length data
Trevor Norris [Mon, 5 Jan 2015 10:20:31 +0000 (02:20 -0800)]
smalloc: fix bad assert for zero length data

If the data length passed to smalloc.alloc() the array_length will be
zero, causing an overflow check to fail. This prevents that from
happening.

Signed-off-by: Trevor Norris <trev.norris@gmail.com>
9 years agonet: make connect() input validation synchronous
cjihrig [Sat, 3 Jan 2015 23:26:26 +0000 (18:26 -0500)]
net: make connect() input validation synchronous

Socket.prototype.connect() sometimes throws on bad inputs
after an asynchronous operation. This commit makes the input
validation synchronous. This commit also removes some hard
coded IP addresses.

PR-URL: https://github.com/joyent/node/pull/8180
Fixes: https://github.com/joyent/node/issues/8140
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Reviewed-By: Timothy J Fontaine <tjfontaine@gmail.com>
9 years agodocs: update to authors file
Steven R. Loomis [Sat, 3 Jan 2015 01:16:47 +0000 (17:16 -0800)]
docs: update to authors file

PR-URL: https://github.com/joyent/node/pull/8964
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
9 years agodoc: added TC meeting minutes 2014-12-30
Rod Vagg [Fri, 2 Jan 2015 03:14:51 +0000 (14:14 +1100)]
doc: added TC meeting minutes 2014-12-30

closes #211

PR-URL: https://github.com/iojs/io.js/pull/229
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
9 years agobuild: i18n: add icu config options
Steven R. Loomis [Thu, 13 Nov 2014 01:13:14 +0000 (17:13 -0800)]
build: i18n: add icu config options

Make "--with-intl=none" the default and add "intl-none" option to
vcbuild.bat.

If icu data is missing print a warning unless either --download=all or
--download=icu is set. If set then automatically download, verify (MD5)
and unpack the ICU data if not already available.

There's a "list" of URLs being used, but right now only the first is
picked up. The logic works something like this:

* If there is no directory deps/icu,
  * If no zip file (currently icu4c-54_1-src.zip),
    * Download zip file (icu-project.org -> sf.net)
  * Verify the MD5 sum of the zipfile
    * If bad, print error and exit
  * Unpack the zipfile into deps/icu
* If deps/icu now exists, use it, else fail with help text

Add the configuration option "--with-icu-source=..."

Usage:
  * --with-icu-source=/path/to/my/other/icu
  * --with-icu-source=/path/to/icu54.zip
  * --with-icu-source=/path/to/icu54.tgz
  * --with-icu-source=http://example.com/icu54.tar.bz2

Add the configuration option "--with-icu-locals=...".  Allows choosing
which locales are used in the "small-icu" case.

Example:
    configure --with-intl=small-icu --with-icu-locales=tlh,grc,nl

(Also note that as of this writing, neither Klingon nor Ancient Greek
are in upstream CLDR data. Serving suggestion only.)

Don't use hard coded ../../out paths on windows. This was suggested by
@misterdjules as it causes test failures.  With this fix, "out" is no
longer created on windows and the following can run properly:

    python tools/test.py simple

Reduce space by about 1MB with ICU 54 (over without this patch). Also
trims a few other source files, but only conditional on the exact ICU
version used. This is to future-proof - a file that is unneeded now may
be needed in future ICUs.

Also:
  * Update distclean to remove icu related files
  * Refactor some code into tools/configure.d/nodedownload.py
  * Update docs
  * Add test

PR-URL: https://github.com/joyent/node/pull/8719
Fixes: https://github.com/joyent/node/issues/7676#issuecomment-64704230
[trev.norris@gmail.com small change to test's whitespace and logic]
Signed-off-by: Trevor Norris <trev.norris@gmail.com>
9 years agodoc: added TC meeting minutes 2014-12-17
Rod Vagg [Wed, 17 Dec 2014 20:48:49 +0000 (06:48 +1000)]
doc: added TC meeting minutes 2014-12-17

Closes #163

PR-URL: https://github.com/iojs/io.js/pull/178
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Bert Belder <bertbelder@gmail.com>
9 years agodoc: util: document --trace-deprecation
Ben Noordhuis [Sun, 21 Dec 2014 01:06:19 +0000 (02:06 +0100)]
doc: util: document --trace-deprecation

Document the --trace-deprecation flag and the `process` properties that
affect util.deprecate().

Fixes: https://github.com/iojs/io.js/issues/190
PR-URL: https://github.com/iojs/io.js/pull/191
Reviewed-By: Jonathan Ong <me@jongleberry.com>
9 years agolib: introduce process module
Aleksey Smolenchuk [Tue, 30 Dec 2014 22:25:52 +0000 (14:25 -0800)]
lib: introduce process module

This makes require('process') always return a reference to the global
process object.

PR-URL: https://github.com/iojs/io.js/pull/206
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
9 years agourl: improve parsing speed
CGavrila [Tue, 28 Oct 2014 12:08:37 +0000 (12:08 +0000)]
url: improve parsing speed

The url.parse() function now checks whether an escapable character is in
the URL before trying to escape it.

PR-URL: https://github.com/joyent/node/pull/8638
[trev.norris@gmail.com: Switch to use continue instead of if]
Signed-off-by: Trevor Norris <trev.norris@gmail.com>
9 years agodoc: add tls server.close() callback docs
Sam Roberts [Tue, 30 Dec 2014 06:10:36 +0000 (22:10 -0800)]
doc: add tls server.close() callback docs

Also, tests to confirm its existence.

PR-URL: https://github.com/iojs/io.js/pull/217
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
9 years agodgram: close() should accept a callback
Sam Roberts [Tue, 30 Dec 2014 05:30:03 +0000 (21:30 -0800)]
dgram: close() should accept a callback

Like net, http, and https server.close, and socket.end(), etc.

PR-URL: https://github.com/iojs/io.js/pull/217
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
9 years agodgram: make 'close' event async
Sam Roberts [Tue, 30 Dec 2014 05:20:54 +0000 (21:20 -0800)]
dgram: make 'close' event async

Emit the close event asynchronously, after the close, as it is with the
net/http close events.

PR-URL: https://github.com/iojs/io.js/pull/217
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
9 years agodoc: be specific about the unit of `maxBuffer`
Tim Ruffles [Fri, 26 Dec 2014 10:41:30 +0000 (10:41 +0000)]
doc: be specific about the unit of `maxBuffer`

The maxBuffer option was not self-documenting, so document the unit and
its effect.

PR-URL: https://github.com/iojs/io.js/pull/209
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
9 years agodgram: changes Socket.close() to return itself
Brendan Ashworth [Mon, 29 Dec 2014 20:12:30 +0000 (12:12 -0800)]
dgram: changes Socket.close() to return itself

This commit adds a return statement to the dgram.Socket.close()
function that returns itself after it finishes. This follows along
the functionality of the more popular and, dare I say, father-library
`lib/net.js`.

PR-URL: https://github.com/iojs/io.js/pull/214
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
9 years agodgram: change Socket.bind() to return itself
Brendan Ashworth [Mon, 29 Dec 2014 20:03:24 +0000 (12:03 -0800)]
dgram: change Socket.bind() to return itself

This commit changes `lib/dgram.js` Sockets to, when
they are bound to a port / IP, return themselves. This
is done in order to allow chaining of methods and be
in accordance with the `lib/net.js` library.

PR-URL: https://github.com/iojs/io.js/pull/214
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
9 years agoconfigure: remove compiler detection
Nikolai Vavilov [Tue, 23 Dec 2014 19:15:46 +0000 (20:15 +0100)]
configure: remove compiler detection

The GCC version is no longer relevant since only 4.8 and newer are
supported. It's probably safe to assume clang on mac since V8 does
so too.

PR-URL: https://github.com/iojs/io.js/pull/205
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
9 years agosrc: remove cpplint error using NOLINT directive
Rudi Cilibrasi [Tue, 23 Dec 2014 16:08:06 +0000 (08:08 -0800)]
src: remove cpplint error using NOLINT directive

PR-URL: https://github.com/iojs/io.js/pull/202
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
9 years agodoc: document time() and timeEnd() relationship
Mark Stosberg [Mon, 22 Dec 2014 20:40:27 +0000 (15:40 -0500)]
doc: document time() and timeEnd() relationship

`console.time()` and `console.timeEnd()` are very closely related. It's
useful to reference them both from each other.

Previously, console.time() did not mention that it needed to be paired
with a call to console.timeEnd() to be useful, and timeEnd() also failed
to mention that console.time() needed to be called first.

References in both directions have been added.

PR-URL: https://github.com/iojs/io.js/pull/198
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
9 years agodoc: fix v8 doc headings so 'make doc' passes
Mark Stosberg [Tue, 23 Dec 2014 16:07:31 +0000 (11:07 -0500)]
doc: fix v8 doc headings so 'make doc' passes

Previously the code that builds the Table of Contents threw
an exception because of jump from an H1 heading directly to an H3
heading.

By changing the H3 heading to an H2, 'make doc' works again. This is
also consistent with other docs like console.markdown which use
H2 for method call documentation.

PR-URL: https://github.com/iojs/io.js/pull/203
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
9 years agoassert: fix deepEqual regression
teppeis [Sun, 21 Dec 2014 15:56:33 +0000 (00:56 +0900)]
assert: fix deepEqual regression

Change of Object.keys in ES6 breaks assert.deepEqual about primitive
values.

V8: https://code.google.com/p/v8/issues/detail?id=3443

Previously deepEqual depends on Object.key that throws an error for
a primitive value, but now Object.key does not throw.

PR-URL: https://github.com/iojs/io.js/pull/193
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
9 years agoconfigure: remove workarounds for GCC < 4.8
Nikolai Vavilov [Sat, 20 Dec 2014 14:39:10 +0000 (16:39 +0200)]
configure: remove workarounds for GCC < 4.8

They can't compile io.js anyway.

PR-URL: https://github.com/iojs/io.js/pull/187
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
9 years agolib: micro-optimize url.resolve()
Ben Noordhuis [Fri, 19 Dec 2014 22:46:37 +0000 (23:46 +0100)]
lib: micro-optimize url.resolve()

Replace the call to Array#splice() with a faster open-coded version
that creates less garbage.

Add a new benchmark to prove it.  With the change applied, it scores
about 5% higher and that is nothing to sneeze at.

PR-URL: https://github.com/iojs/io.js/pull/184
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
9 years agobenchmark: rename url.parse() benchmark
Ben Noordhuis [Fri, 19 Dec 2014 22:44:19 +0000 (23:44 +0100)]
benchmark: rename url.parse() benchmark

Rename the url.parse() benchmark from url.js to url-parse.js.
A follow-up commit is going to add another one for url.resolve().

PR-URL: https://github.com/iojs/io.js/pull/184
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
9 years agolib: micro-optimize EventEmitter#removeListener()
Ben Noordhuis [Fri, 19 Dec 2014 23:04:35 +0000 (00:04 +0100)]
lib: micro-optimize EventEmitter#removeListener()

Replace the call to Array#splice() with a faster open-coded version
that creates less garbage.

Add a new benchmark to prove it.  With the change applied, it scores
a whopping 40% higher.

PR-URL: https://github.com/iojs/io.js/pull/185
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
9 years agobenchmark: fix printing of large numbers
Ben Noordhuis [Fri, 19 Dec 2014 23:03:10 +0000 (00:03 +0100)]
benchmark: fix printing of large numbers

Don't use Number#toPrecision(), it switches to scientific notation for
numbers with more digits than the precision; use Number#toFixed().

PR-URL: https://github.com/iojs/io.js/pull/185
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
9 years agobenchmark: pre-optimize url.parse() before start
Ben Noordhuis [Tue, 9 Dec 2014 22:26:24 +0000 (23:26 +0100)]
benchmark: pre-optimize url.parse() before start

Force V8 to optimize url.parse() before starting the actual benchmark.
Tries to minimize variance between successive runs caused by the
optimizer kicking in at different points.

It does not seem to have much impact, CPU times are roughly the same
before and afterwards; url.parse() quickly plateaus at a local optimum
where most time is spent in V8 builtins, notably Runtime_StringSplit()
and Object::GetElementWithReceiver() calls originating from
deps/v8/src/uri.js, with no recurring optimize/deoptimize cycles that
I could spot.

Still, I don't see any downsides to pre-optimizing the function being
benchmarked so in it goes.

PR-URL: https://github.com/iojs/io.js/pull/132
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
Reviewed-By: Fedor Indutny <fedor@indutny.com>
9 years agodoc: add details for http res/req end callback
Jackson Tian [Wed, 10 Dec 2014 03:20:11 +0000 (11:20 +0800)]
doc: add details for http res/req end callback

Add documentation for the callback parameter of http.ClientRequest's and
http.ServerResponse's end methods.

Signed-off-by: Julien Gilli <julien.gilli@joyent.com>
9 years agodebugger: improve clearBreakpoint error and docs
Julian Duque [Tue, 16 Dec 2014 16:27:31 +0000 (11:27 -0500)]
debugger: improve clearBreakpoint error and docs

Currently clearBreakpoint error is confusing, it says "Script not found"
when there is no breakpoint, also documentation doesn't include
signature for clearBreakpoint.

PR-URL: https://github.com/iojs/io.js/pull/175
Reviewed-By: Miroslav Bajtoš <miroslav@strongloop.com>
9 years agofs: deprecate exists() and existsSync()
cjihrig [Mon, 15 Dec 2014 18:58:37 +0000 (13:58 -0500)]
fs: deprecate exists() and existsSync()

These methods don't follow standard conventions, and shouldn't
be used anyway.

Fixes: https://github.com/iojs/io.js/issues/103
PR-URL: https://github.com/iojs/io.js/pull/166
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
9 years agodoc: document callback of http res/req end method
Jackson Tian [Thu, 18 Dec 2014 07:52:42 +0000 (15:52 +0800)]
doc: document callback of http res/req end method

Add documentation for the callback parameter of http.ClientRequest's and
http.ServerResponse's end methods.

PR-URL: https://github.com/iojs/io.js/pull/181
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Brendan Ashworth <squirrelslikeacorns@gmail.com>
9 years agolib,src: remove post-gc event infrastructure
Ben Noordhuis [Tue, 16 Dec 2014 12:21:41 +0000 (13:21 +0100)]
lib,src: remove post-gc event infrastructure

Remove the 'gc' event from the v8 module and remove the supporting
infrastructure from src/.  It gets the axe because:

1. There are currently no users.  It was originally conceived as
   an upstreamed subset of StrongLoop's strong-agent GC metrics,
   but the strong-agent code base has evolved considerably since
   that time and has no use anymore for what is in core.

2. The implementation is not quite sound.  It calls into JS land
   from inside the GC epilog and that is unsafe.  We could fix
   that by delaying the callback until a safe time but because
   there are no users anyway, removing it is all around easier.

PR-URL: https://github.com/iojs/io.js/pull/174
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
9 years agostream: switch _writableState.buffer to queue
Chris Dickinson [Thu, 4 Dec 2014 20:00:23 +0000 (12:00 -0800)]
stream: switch _writableState.buffer to queue

In cases where many small writes are made to a stream
lacking _writev, the array data structure backing the
WriteReq buffer would greatly increase GC pressure.

Specifically, in the fs.WriteStream case, the
clearBuffer routine would only clear a single WriteReq
from the buffer before exiting, but would cause the
entire backing array to be GC'd. Switching to [].shift
lessened pressure, but still the bulk of the time was
spent in memcpy.

This replaces that structure with a linked list-backed
queue so that adding and removing from the queue is O(1).
In the _writev case, collecting the buffer requires an
O(N) loop over the buffer, but that was already being
performed to collect callbacks, so slowdown should be
neglible.

PR-URL: https://github.com/joyent/node/pull/8826
Reviewed-by: Timothy J Fontaine <tjfontaine@gmail.com>
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
9 years agolib: fix guard expression in timer.unref()
Ben Noordhuis [Mon, 15 Dec 2014 16:25:31 +0000 (17:25 +0100)]
lib: fix guard expression in timer.unref()

Fixes the following assertion on slow systems, like our ARM buildbot:

    $ out/Debug/node test/simple/test-timers-unref.js
    node: ../src/async-wrap-inl.h:101: v8::Handle<v8::Value>
    node::AsyncWrap::MakeCallback(uint32_t, int,
    v8::Handle<v8::Value>*): Assertion `cb_v->IsFunction()' failed.
    Aborted

The reason it only manifests on slow systems is that the test starts
a 1 ms interval timer, then defers timer.unref.bind({}) to the next
tick.  On fast systems, the test completes in under a millisecond,
before the callback is called.

This commit makes timer.unref() check that the receiver actually has
a timeout callback property.

Fixes #13.

PR-URL: https://github.com/iojs/io.js/pull/165
Reviewed-By: Rod Vagg <rod@vagg.org>
9 years agosrc: fix windows build error
Ben Noordhuis [Tue, 11 Nov 2014 11:06:55 +0000 (12:06 +0100)]
src: fix windows build error

Fix a Windows-only build error that was introduced in
commit 1183ba4 ("zlib: support concatenated gzip files").

Rename the NO_ERROR and FAILED enumerations, they conflict
with macros of the same name in <winerror.h>.

PR-URL: https://github.com/joyent/node/pull/8893
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-by: Timothy J Fontaine <tjfontaine@gmail.com>
9 years agodebugger: fix unhandled error in setBreakpoint
Miroslav Bajtoš [Mon, 4 Nov 2013 14:59:25 +0000 (15:59 +0100)]
debugger: fix unhandled error in setBreakpoint

Fix Interface.setBreakpoint() to correctly handle an attempt to set a
breakpoint in the current script when there is no current script.
This usually happens when the debugged process is not paused.

Fixes: https://github.com/joyent/node/issues/6453
PR-URL: https://github.com/joyent/node/pull/6460
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
9 years agotest: run tests in parallel, common improvements
Fedor Indutny [Wed, 17 Dec 2014 13:34:21 +0000 (20:34 +0700)]
test: run tests in parallel, common improvements

* Allow running tests in mixed parallel/sequential modes
* Add -J flag for running tests on all available CPUs
* Support TEST_THREAD_ID in test/common.js and use it for tmpDir and PORT
* make: use -J flag

Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
PR-URL: https://github.com/iojs/io.js/pull/172
Fix: iojs/io.js#139

9 years agotest: split test in parallel/sequential
Fedor Indutny [Wed, 17 Dec 2014 13:30:04 +0000 (20:30 +0700)]
test: split test in parallel/sequential

Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
PR-URL: https://github.com/iojs/io.js/pull/172
Fix: iojs/io.js#139

9 years agozlib: support concatenated gzip files
Luis Reis [Tue, 9 Sep 2014 16:30:15 +0000 (17:30 +0100)]
zlib: support concatenated gzip files

Reviewed-By: Fedor Indutny <fedor@indutny.com>
PR-URL: https://github.com/joyent/node/pull/6442

9 years agodoc: clarify create{Read,Write}Stream fd option
Ben Burns [Sat, 26 Jul 2014 14:04:46 +0000 (02:04 +1200)]
doc: clarify create{Read,Write}Stream fd option

Clarify the fd option: it is preferred to the path parameter, omits
the "open" event if given, and is available on WriteStreams as well.

PR-URL: https://github.com/joyent/node/issues/7707
Fixes: https://github.com/joyent/node/issues/7707
Fixes: https://github.com/joyent/node/issues/7708
Fixes: https://github.com/joyent/node/issues/4367
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
9 years agofs: add access() and accessSync()
cjihrig [Mon, 15 Dec 2014 15:44:46 +0000 (10:44 -0500)]
fs: add access() and accessSync()

fs.exists() and fs.existsSync() do not follow the typical
error first callback convention. access() and accessSync()
are added as alternatives in this commit.

Fixes: https://github.com/joyent/node/pull/8714
PR-URL: https://github.com/iojs/io.js/pull/114
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Domenic Denicola <domenic@domenicdenicola.com>
9 years agodoc: change write() after end() streams example
Alejandro Oviedo [Fri, 12 Dec 2014 16:03:13 +0000 (13:03 -0300)]
doc: change write() after end() streams example

Currently there's an example using http.ServerResponse stream, which
has a known bug and will not throw an error while writing after end().
Changed to a writable stream from fs which behaves as expected.

Fixes https://github.com/joyent/node/issues/8814.

PR-URL: https://github.com/iojs/io.js/pull/155
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Brendan Ashworth <squirrelslikeacorns@gmail.com>
9 years agolib: reintroduce v8 module
Ben Noordhuis [Tue, 9 Dec 2014 21:57:48 +0000 (22:57 +0100)]
lib: reintroduce v8 module

I introduced this module over a year ago in a pull request as the v8
module but it was quickly subsumed by the tracing module.

The tracing module was recently removed again and that is why this
commit introduces the v8 module again, including the new features it
picked up commits d23ac0e and f8076c4.

PR-URL: https://github.com/iojs/io.js/pull/131
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
Reviewed-By: Christian Tellnes <christian@tellnes.no>
Reviewed-By: Thorsten Lorenz <thlorenz@gmx.de>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
9 years agosrc: move BE/LE buffer conversion to StringSlice()
Ben Noordhuis [Wed, 10 Dec 2014 16:45:50 +0000 (17:45 +0100)]
src: move BE/LE buffer conversion to StringSlice()

Move the big endian to little endian conversion logic for UCS2 input
from src/string_bytes.cc to src/node_buffer.cc; StringSlice() is the
only function that actually needs it and with this commit, a second
copy is avoided on big endian architectures.

9 years agosrc: redo unaligned access workaround
Ben Noordhuis [Wed, 10 Dec 2014 16:33:56 +0000 (17:33 +0100)]
src: redo unaligned access workaround

Introduce two-byte overloads of node::Encode() and StringBytes::Encode()
that ensure that the input is suitably aligned.

Revisits commit 535fec8 from yesterday.

9 years agosrc: fix addon loader regression
Ben Noordhuis [Thu, 11 Dec 2014 14:29:52 +0000 (15:29 +0100)]
src: fix addon loader regression

Fix a regression that was introduced in commit a38b9178 by removing the
bad check.  Also rearrange the addon loading logic to ensure that the
list of pending addons remains in a consistent state when the shared
object fails to load; in particular, when an addon self-registers first,
then hits a dynamic linker error in a later constructor.

Fixes the following asserting when loading a .node shared object:

    node: ../src/node.cc:1944: void node::node_module_register(void*):
    Assertion `(modpending) != (nullptr)' failed.

Fixes strongloop/strongops#233.

PR-URL: https://github.com/iojs/io.js/pull/154
Reviewed-By: Ryan Graham <ryan@strongloop.com>
9 years agobuild: remove support for VS 2010 and 2012
Nikolai Vavilov [Fri, 12 Dec 2014 17:28:20 +0000 (19:28 +0200)]
build: remove support for VS 2010 and 2012

They can't compile io.js anyway.

PR-URL: https://github.com/iojs/io.js/pull/156
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Bert Belder <bertbelder@gmail.com>
9 years agodomain: add soft deprecation notice
Chris Dickinson [Wed, 10 Dec 2014 22:03:27 +0000 (14:03 -0800)]
domain: add soft deprecation notice

Per the TC meeting on 2014-12-10, domains will be "soft deprecated"
until a suitable replacement API is available; at which time they
will be fully deprecated. Full deprecation will include references
to replacement API and the application of util.deprecate to the domain
api.

PR-URL: https://github.com/iojs/io.js/pull/141
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
9 years agotest: add test for spawnSync() env option
cjihrig [Tue, 9 Dec 2014 18:47:49 +0000 (13:47 -0500)]
test: add test for spawnSync() env option

PR-URL: https://github.com/joyent/node/pull/8845
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
9 years agolib,src: fix spawnSync ignoring its 'env' option
Juanjo [Tue, 14 Oct 2014 10:07:19 +0000 (12:07 +0200)]
lib,src: fix spawnSync ignoring its 'env' option

PR-URL: https://github.com/joyent/node/pull/8546
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
9 years agodocs: clarify that 'io.js' is the correct name
Mathias Bynens [Thu, 11 Dec 2014 20:50:35 +0000 (21:50 +0100)]
docs: clarify that 'io.js' is the correct name

Refs #118.

PR-URL: https://github.com/iojs/io.js/pull/151
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Rod Vagg <rod@vagg.org>
9 years agodoc: added node-forward TC meeting 2014-10-15
Rod Vagg [Thu, 11 Dec 2014 09:54:42 +0000 (20:54 +1100)]
doc: added node-forward TC meeting 2014-10-15

PR-URL: https://github.com/iojs/io.js/pull/148
Reviewed-By: Mikeal Rogers <mikeal.rogers@gmail.com>
9 years agodomain: forward args to .run(fn)
micnic [Sat, 29 Nov 2014 12:50:29 +0000 (14:50 +0200)]
domain: forward args to .run(fn)

Adds the feature to define arguments for the function called in
domain.run(), this is supposed to be useful when a function is called from
another context and some values from the current context are needed as
arguments, it's similar to the callback from setTimeout or setInterval.

PR-URL: https://github.com/iojs/io.js/pull/15
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
9 years agodoc: added TC meeting minutes for 2014-12-10
Rod Vagg [Thu, 11 Dec 2014 07:07:40 +0000 (18:07 +1100)]
doc: added TC meeting minutes for 2014-12-10

closes #112

PR-URL: https://github.com/iojs/io.js/pull/144/
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Mikeal Rogers <mikeal.rogers@gmail.com>
9 years agomodule: fix regression in require ../
Evan Lucas [Thu, 11 Dec 2014 07:37:03 +0000 (01:37 -0600)]
module: fix regression in require ../

Fixes regression in require system that prevented loading relative
packages via main property in package.json where the file is not
index.{ext}. The regression was introduced in commit 36777d2.

PR-URL: https://github.com/iojs/io.js/pull/145
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
9 years agobuild: fix dtrace-enabled build on os x
Ben Noordhuis [Thu, 11 Dec 2014 17:04:31 +0000 (18:04 +0100)]
build: fix dtrace-enabled build on os x

Commit 691d55f introduces a regression on OS X when dtrace is enabled
(the default.)  This commit rectifies that by removing the erroneous
platform check.

Fixes the following build error:

    CXX(target) /Users/bnoordhuis/src/iojs/out/Release/obj.target/node/src/node_dtrace.o
    ../src/node_dtrace.cc:27:10: fatal error: 'node_provider.h' file not found

PR-URL: https://github.com/iojs/io.js/pull/150
Reviewed-By: Miroslav Bajtoš <miro.bajtos@gmail.com>
9 years agodoc: add TC notes from october 29th
Mikeal Rogers [Wed, 29 Oct 2014 22:17:56 +0000 (15:17 -0700)]
doc: add TC notes from october 29th

PR-URL: https://github.com/node-forward/node/pull/41
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
@rvagg: cherry-picked 2c7847b and e7dec60 from master to v0.12

9 years agodoc: meeting notes from oct 9th TC meeting
Mikeal Rogers [Thu, 9 Oct 2014 23:16:49 +0000 (16:16 -0700)]
doc: meeting notes from oct 9th TC meeting

Fixes https://github.com/node-forward/node/issues/4

PR-URL: https://github.com/node-forward/node/pull/9
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
@rvagg: cherry-picked 3cb5f3d from master to v0.12

9 years agodocs: reword project messaging
Kevin O'Hara [Wed, 3 Dec 2014 03:17:17 +0000 (22:17 -0500)]
docs: reword project messaging

Rewords project messaging in README to make the overall project
messaging a bit clearer. More discussion to be found in iojs/io.js#24.

PR-URL: https://github.com/iojs/io.js/pull/36
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Rod Vagg <rod@vagg.org>
9 years agobuild: configure return exit status from gyp
Steven R. Loomis [Wed, 10 Dec 2014 17:04:33 +0000 (09:04 -0800)]
build: configure return exit status from gyp

Previously, 'configure' would not return an exit status
if gyp blows up. This can be tested via:

    date >> node.gyp ; ./configure && echo A-OK

You will get "A-OK" even though gyp had failed.

PR-URL: https://github.com/joyent/node/pull/8856
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
9 years agocrypto: separate altname extensions with ", "
Fedor Indutny [Mon, 8 Dec 2014 13:45:12 +0000 (16:45 +0300)]
crypto: separate altname extensions with ", "

In newly introduced `SafeX509ExtPrint` I forgot to insert separators
between extensions, which lead to the "DNS:...DNS:..." thing for npm.

Fix: iojs/io.js#105
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
PR-URL: https://github.com/iojs/io.js/pull/113.patch

9 years agotest: mark more tests as flaky
Alexis Campailla [Wed, 10 Dec 2014 11:58:32 +0000 (12:58 +0100)]
test: mark more tests as flaky

Marking these two tests as flaky, since they have been failing
intermittenly in recent builds:
test-debug-signal-cluster
test-cluster-basic

9 years agocrypto: disable SSLv3 if shared OpenSSL lacks it
brian m. carlson [Sat, 6 Dec 2014 18:52:25 +0000 (18:52 +0000)]
crypto: disable SSLv3 if shared OpenSSL lacks it

Some distributions disable SSLv3 due to POODLE.  In such a case, disable
the specific SSLv3 methods and throw an exception, much like the code
already does for SSLv2.  The SSLv23* code is retained because this is
OpenSSL's terminology for "no version in particular".

Reviewed-By: Fedor Indutny <fedor@indutny.com>
PR-URL: https://github.com/iojs/io.js/pull/101

9 years agodeps: update libuv to 1.0.2
Saúl Ibarra Corretgé [Tue, 9 Dec 2014 20:01:35 +0000 (21:01 +0100)]
deps: update libuv to 1.0.2

PR-URL: https://github.com/joyent/node/pull/8847
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
9 years agobenchmark: add url benchmarks
Ben Noordhuis [Sat, 6 Dec 2014 19:38:58 +0000 (20:38 +0100)]
benchmark: add url benchmarks

Based on the ad-hoc benchmark from joyent/node#8638 plus an additional
benchmark for user:pass auth URLs.

PR-URL: https://github.com/iojs/io.js/pull/102
Reviewed-by: Chris Dickinson <christopher.s.dickinson@gmail.com>
9 years agolib: optimize require() path walking
Ben Noordhuis [Tue, 9 Dec 2014 17:57:43 +0000 (18:57 +0100)]
lib: optimize require() path walking

Remove a speed bump from commit 36777d2 by reusing the result of the
previous stat() system call.  It's a code path that gets called many
thousands of times at startup in most applications so shaving off an
extra system call can have an appreciable impact on startup times.

PR-URL: https://github.com/iojs/io.js/pull/130
Reviewed-by: Chris Dickinson <christopher.s.dickinson@gmail.com>
9 years agobuild: do not generate support for libuv's probes
Julien Gilli [Wed, 3 Dec 2014 06:55:53 +0000 (22:55 -0800)]
build: do not generate support for libuv's probes

Dtrace probes were removed from libuv recently, but their usage by node
was not completely removed, causing build breaks on SmartOS.

Even though the build is working on other platforms, these probes are
not fired by libuv anymore, so there's no point in using them on these
platforms too.

Reviewed-by: Trevor Norris <trev.norris@gmail.com>
9 years agosrc: fix unaligned access in ucs2 string encoder
Ben Noordhuis [Tue, 9 Dec 2014 14:41:35 +0000 (15:41 +0100)]
src: fix unaligned access in ucs2 string encoder

Seen with g++ 4.9.2 on x86_64 Linux: a SIGSEGV is generated when the
input to v8::String::NewFromTwoByte() is not suitably aligned.

g++ 4.9.2 emits SSE instructions for copy loops.  That requires aligned
input but that was something StringBytes::Encode() did not enforce until
now.  Make a properly aligned copy before handing off the input to V8.

We could, as an optimization, check that the pointer is aligned on a
two-byte boundary but that is technically still UB; pointers-to-char
are allowed to alias other pointers but the reverse is not true:
a pointer-to-uint16_t that aliases a pointer-to-char is in violation
of the pointer aliasing rules.

See https://code.google.com/p/v8/issues/detail?id=3694

Fixes segfaulting test simple/test-stream2-writable.

PR-URL: https://github.com/iojs/io.js/pull/127
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
9 years agotest: fix test-fs-symlink-dir-junction-relative
Bert Belder [Tue, 9 Dec 2014 20:15:32 +0000 (21:15 +0100)]
test: fix test-fs-symlink-dir-junction-relative

  * The test no longer relies on being invoked from a particular
    working directory to function properly.
  * fs.symlink() and fs.symlinkSync() are both tested.
  * The test now cleans up after itself.

This commit fixes https://github.com/iojs/io.js/issues/126

PR-URL: https://github.com/iojs/io.js/pull/129
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
9 years agotest: add test for spawnSync() env option
cjihrig [Tue, 9 Dec 2014 18:47:49 +0000 (13:47 -0500)]
test: add test for spawnSync() env option

PR-URL: https://github.com/joyent/node/pull/8845
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
9 years agolib,src: fix spawnSync ignoring its 'env' option
Juanjo [Tue, 14 Oct 2014 10:07:19 +0000 (12:07 +0200)]
lib,src: fix spawnSync ignoring its 'env' option

PR-URL: https://github.com/joyent/node/pull/8546
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
9 years agobuild: fix build with systemtap providers enabled
Evan Torrie [Tue, 9 Dec 2014 19:02:39 +0000 (11:02 -0800)]
build: fix build with systemtap providers enabled

The "dtrace" script version include in systemtap-sdt-devel-2.6-3
(part of Fedora 21) no longer ignores unknown command line
arguments, but will instead error out and refuse to run.
This patch adds a separate condition to node's gyp input so
that on Linux it will run dtrace without the -xnolibs
argument that trips it up on systemtap-std-devel-2.6-3.

PR-URL: https://github.com/joyent/node/pull/8846
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
9 years agoMerge 'node/v0.12'
Bert Belder [Tue, 9 Dec 2014 17:06:35 +0000 (18:06 +0100)]
Merge 'node/v0.12'

This merge is effectively a no-op because io.js has already
cherry-picked all the patches from node it needs.

The merge commit serves to establish a new merge base for future merges.

9 years agosrc: remove the tracing module entirely
Bert Belder [Tue, 9 Dec 2014 15:03:24 +0000 (16:03 +0100)]
src: remove the tracing module entirely

PR-URL: https://github.com/iojs/io.js/pull/124
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
9 years agodoc: mention callback for http res/req write & end
Jackson Tian [Tue, 2 Dec 2014 03:14:57 +0000 (11:14 +0800)]
doc: mention callback for http res/req write & end

Add documentation for the callback parameter of http.ClientRequest's and
http.ServerResponse's write and end methods.

9 years agoasync-wrap: add event hooks
Trevor Norris [Tue, 9 Dec 2014 04:10:44 +0000 (05:10 +0100)]
async-wrap: add event hooks

Call a user-defined callback at specific points in the lifetime of an
asynchronous event. Which are on instantiation, just before/after the
callback has been run.

**If any of these callbacks throws an exception, there is no forgiveness
or recovery. A message will be displayed and a core file dumped.**

Currently these only tie into AsyncWrap, meaning no call to a hook
callback will be made for timers or process.nextTick() events. Though
those will be added in a future commit.

Here are a few notes on how to make the hooks work:

- The "this" of all event hook callbacks is the request object.

- The zero field (kCallInitHook) of the flags object passed to
  setupHooks() must be set != 0 before the init callback will be called.

- kCallInitHook only affects the calling of the init callback. If the
  request object has been run through the create callback it will always
  run the before/after callbacks. Regardless of kCallInitHook.

- In the init callback the property "_asyncQueue" must be attached to
  the request object. e.g.

  function initHook() {
    this._asyncQueue = {};
  }

- DO NOT inspect the properties of the object in the init callback.
  Since the object is in the middle of being instantiated there are some
  cases when a getter is not complete, and doing so will cause Node to
  crash.

PR-URL: https://github.com/joyent/node/pull/8110
Signed-off-by: Trevor Norris <trev.norris@gmail.com>
Reviewed-by: Fedor Indutny <fedor@indutny.com>
Reviewed-by: Alexis Campailla <alexis@janeasystems.com>
Reviewed-by: Julien Gilli <julien.gilli@joyent.com>
9 years agoasync-wrap: explicitly pass parent
Trevor Norris [Tue, 9 Dec 2014 04:02:09 +0000 (05:02 +0100)]
async-wrap: explicitly pass parent

When instantiating a new AsyncWrap allow the parent AsyncWrap to be
passed. This is useful for cases like TCP incoming connections, so the
connection can be tied to the server receiving the connection.

Because the current architecture instantiates the *Wrap inside a
v8::FunctionCallback, the parent pointer is currently wrapped inside a
new v8::External every time and passed as an argument. This adds ~80ns
to instantiation time.

A future optimization would be to add the v8::External as the data field
when creating the v8::FunctionTemplate, change the pointer just before
making the call then NULL'ing it out afterwards. This adds enough code
complexity that it will not be attempted until the current approach
demonstrates it is a bottle neck.

PR-URL: https://github.com/joyent/node/pull/8110
Signed-off-by: Trevor Norris <trev.norris@gmail.com>
Reviewed-by: Fedor Indutny <fedor@indutny.com>
Reviewed-by: Alexis Campailla <alexis@janeasystems.com>
Reviewed-by: Julien Gilli <julien.gilli@joyent.com>
9 years agoasync-wrap: expose async-wrap as binding
Trevor Norris [Sat, 15 Nov 2014 00:15:06 +0000 (16:15 -0800)]
async-wrap: expose async-wrap as binding

Expose basic hooks for AsyncWrap via the async_wrap binding. Right now
only the PROVIDER types are exposed. This is a preliminary step before
more functionality is added.

PR-URL: https://github.com/joyent/node/pull/8110
Signed-off-by: Trevor Norris <trev.norris@gmail.com>
Reviewed-by: Fedor Indutny <fedor@indutny.com>
Reviewed-by: Alexis Campailla <alexis@janeasystems.com>
Reviewed-by: Julien Gilli <julien.gilli@joyent.com>
9 years agosrc: remove unnecessary template parameter
Trevor Norris [Fri, 14 Nov 2014 23:47:34 +0000 (15:47 -0800)]
src: remove unnecessary template parameter

The template class information is received via the type of the first
argument. So there is no need to use Wrap<T>(handle).

PR-URL: https://github.com/joyent/node/pull/8110
Signed-off-by: Trevor Norris <trev.norris@gmail.com>
Reviewed-by: Fedor Indutny <fedor@indutny.com>
Reviewed-by: Alexis Campailla <alexis@janeasystems.com>
Reviewed-by: Julien Gilli <julien.gilli@joyent.com>
9 years agosrc: all wraps now use actual FunctionTemplate
Trevor Norris [Tue, 9 Dec 2014 04:29:47 +0000 (05:29 +0100)]
src: all wraps now use actual FunctionTemplate

Instead of simply creating a new v8::Object to contain the connection
information, instantiate a new instance of a FunctionTemplate. This will
allow future improvements for debugging and performance probes.

Additionally, the "provider" argument in the ReqWrap constructor is no
longer optional.

PR-URL: https://github.com/joyent/node/pull/8110
Signed-off-by: Trevor Norris <trev.norris@gmail.com>
Reviewed-by: Fedor Indutny <fedor@indutny.com>
Reviewed-by: Alexis Campailla <alexis@janeasystems.com>
Reviewed-by: Julien Gilli <julien.gilli@joyent.com>
9 years agonode: fix throws before timer module is loaded
Trevor Norris [Thu, 13 Nov 2014 00:35:48 +0000 (16:35 -0800)]
node: fix throws before timer module is loaded

An edge case could occur when the setImmediate() in _fatalException()
would fire before the timers module had been loaded globally, causing
Node to crash.

PR-URL: https://github.com/joyent/node/pull/8110
Signed-off-by: Trevor Norris <trev.norris@gmail.com>
Reviewed-by: Fedor Indutny <fedor@indutny.com>
Reviewed-by: Alexis Campailla <alexis@janeasystems.com>
Reviewed-by: Julien Gilli <julien.gilli@joyent.com>
9 years agonode, async-wrap: remove MakeDomainCallback
Trevor Norris [Tue, 9 Dec 2014 04:24:59 +0000 (05:24 +0100)]
node, async-wrap: remove MakeDomainCallback

C++ won't deoptimize like JS if specific conditional branches are
sporadically met in the future. Combined with the amount of code
duplication removal and simplified maintenance complexity, it makes more
sense to merge MakeCallback and MakeDomainCallback.

Additionally, type casting in V8 before verifying what that type is will
cause V8 to abort in debug mode if that type isn't what was expected.
Fix this by first checking the v8::Value before casting.

PR-URL: https://github.com/joyent/node/pull/8110
Signed-off-by: Trevor Norris <trev.norris@gmail.com>
Reviewed-by: Fedor Indutny <fedor@indutny.com>
Reviewed-by: Alexis Campailla <alexis@janeasystems.com>
Reviewed-by: Julien Gilli <julien.gilli@joyent.com>
9 years agoasync-wrap: move MakeCallback to .cc
Trevor Norris [Tue, 9 Dec 2014 03:55:48 +0000 (04:55 +0100)]
async-wrap: move MakeCallback to .cc

MakeCallback is too large a function to be inlined. Likewise, only
having header files will not allow for any part of AsyncWrap to be
exposed cleanly via NODE_MODULE_CONTEXT_AWARE_BUILTIN().

PR-URL: https://github.com/joyent/node/pull/8110
Signed-off-by: Trevor Norris <trev.norris@gmail.com>
Reviewed-by: Fedor Indutny <fedor@indutny.com>
Reviewed-by: Alexis Campailla <alexis@janeasystems.com>
Reviewed-by: Julien Gilli <julien.gilli@joyent.com>
9 years agosrc: remove Async Listener
Trevor Norris [Tue, 9 Dec 2014 15:01:05 +0000 (16:01 +0100)]
src: remove Async Listener

Async Listener was the name of the user-facing JS API, and is being
completely removed. Instead low level hooks directly into the mechanism
that AL used will be introduced in a future commit.

PR-URL: https://github.com/joyent/node/pull/8110
Signed-off-by: Trevor Norris <trev.norris@gmail.com>
Reviewed-by: Fedor Indutny <fedor@indutny.com>
Reviewed-by: Alexis Campailla <alexis@janeasystems.com>
Reviewed-by: Julien Gilli <julien.gilli@joyent.com>