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

13764 Commits

Author SHA1 Message Date
Evan Lucas
4f619bde4c cluster: migrate from worker.suicide
Replace it with worker.exitedAfterDisconnect. Print deprecation
message when getting or setting until it is removed.

PR-URL: https://github.com/nodejs/node/pull/3743
Fixes: https://github.com/nodejs/node/issues/3721
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
2016-04-25 19:24:37 -05:00
Jeremiah Senkpiel
9bb5a5e2a1 handle_wrap: IsRefed -> Unrefed, no isAlive check
This fixes my perceived usability issues with 7d8882b. Which, at the
time of writing, has not landed in any release except v6 RCs. This
should not be considered a breaking change due to that.

It is useful if you have a handle, even if it has been closed, to be
able to inspect whether that handle was unrefed or not. As such, this
renames the method accordingly. If people need to check a handle's
aliveness, that is a separate API we should consider exposing.

Refs: https://github.com/nodejs/node/pull/5834
PR-URL: https://github.com/nodejs/node/pull/6204
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2016-04-25 18:17:40 -04:00
Alex Kocharin
eb4201f07a url: drop auth in url.resolve() if host changes
Fixes: https://github.com/nodejs/node/issues/1435
PR-URL: https://github.com/nodejs/node/pull/1480
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
2016-04-25 10:39:10 -07:00
Anna Henningsen
3ee68f794f repl: don’t complete expressions when eval fails
Instead of changing the way “simple” expressions are detected,
switch to ignoring errors when completing. This approach is more
generic than the previous one from 0b66b8f2d, but also changes
the way errors are thrown when completing.

This reverts the code changes from commit 0b66b8f2d2.
The test case is left intact.

Fixes: https://github.com/nodejs/node/issues/6325
PR-URL: https://github.com/nodejs/node/pull/6328
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-04-25 09:40:55 -07:00
Ali Ijaz Sheikh
e5f1e2c1df deps: upgrade to V8 5.0.71.35
Pick up the latest bug fix from the V8 5.0 branch.

Original commit message:
V8-Commit: https://github.com/v8/v8/commit/c1d51c7c
  Version 5.0.71.35 (cherry-pick)

  Merged 2837cb387

  disallow left-trim fast path when sampling heap profiler is active

  R=hablich@chromium.org, hpayer@chromium.org
  BUG=v8:4937

  Review URL: https://codereview.chromium.org/1918453002 .

PR-URL: https://github.com/nodejs/node/pull/6372
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
2016-04-25 09:29:26 -07:00
Alex Lamar
de1dc0ae2e module: preserve symlinks when requiring
Currently, required modules use the real location of the
package/file as their __filename and __dirname, instead
of the symlinked path if it exists. This behaviour is
undocumented (it even goes against documentation in
certain scenarios), creating hard-to-debug problems
for developers who wish to leverage filesystem abstractions
to lay out their application.

This patch resolves all required modules to their canonical
path while still preserving any symlinks within the path,
instead of resolving to their canonical realpath. The one
special case observed is when the main module is loaded
-- in this case, the realpath does need to be used
in order for the main module to load properly.

PR-URL: https://github.com/nodejs/node/pull/5950
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-04-25 09:24:52 -07:00
Jackson Tian
236b7e8dd1 doc: doc-only deprecation for util.log()
There are more powerful loggers in user land like `debug`, soft
deprecate it.

PR-URL: https://github.com/nodejs/node/pull/6161
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Evan Lucas <evanlucas@me.com>
2016-04-25 08:39:22 -07:00
Eugene Obrezkov
1c84579031 console: timeEnd() with no label emits warning
When timeEnd() provided with label that doesn't exists
it emits warning in the console, so developer get know about it.

PR-URL: https://github.com/nodejs/node/pull/5901
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
2016-04-25 08:28:23 -07:00
dcposch@dcpos.ch
6c1e5ad3ab buffer: add Buffer.prototype.lastIndexOf()
* Remove unnecessary templating from SearchString

  SearchString used to have separate PatternChar and SubjectChar template type
  arguments, apparently to support things like searching for an 8-bit string
  inside a 16-bit string or vice versa. However, SearchString is only used from
  node_buffer.cc, where PatternChar and SubjectChar are always the same. Since
  this is extra complexity that's unused and untested (simplifying to a single
  Char template argument still compiles and didn't break any unit tests), I
  removed it.

* Use Boyer-Hoore[-Horspool] for both indexOf and lastIndexOf

  Add test cases for lastIndexOf. Test the fallback from BMH to
  Boyer-Moore, which looks like it was totally untested before.

* Extra bounds checks in node_buffer.cc

* Extra asserts in string_search.h

* Buffer.lastIndexOf: clean up, enforce consistency w/ String.lastIndexOf

* Polyfill memrchr(3) for non-GNU systems

PR-URL: https://github.com/nodejs/node/pull/4846
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2016-04-25 08:24:28 -07:00
Brian White
d5922bd7a9
querystring: fix comments
PR-URL: https://github.com/nodejs/node/pull/6365
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
2016-04-25 09:56:52 -04:00
Sakthipriyan Vairamani
2c480bdae6 src: fix check-imports.py linter errors
This patch fixes all the linter errors.

PR-URL: https://github.com/nodejs/node/pull/6105
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-04-25 19:24:27 +05:30
Sakthipriyan Vairamani
6781d917f4 tools: rewrite check-install.sh in python
As it is, check-install.sh does not show more helpful error messages,
and supporting various shells could be a problem. This patch rewrites
the same in Python.

This patch also enables check-imports.py in the linting process

PR-URL: https://github.com/nodejs/node/pull/6105
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-04-25 19:22:50 +05:30
Michael Dawson
75e073f2b2 test: increase the platform timeout for AIX
There have been failures on AIX due to the slower
default loopback performance. So far I've resisted
updating the global timeout but seeing another
new failure in a newly added test I now think the
right thing is to just extend the platform
timeout for AIX. This commit does that.

PR-URL: https://github.com/nodejs/node/pull/6342
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2016-04-25 09:09:52 -04:00
Johan Bergström
f1294f5bfd
gyp: inherit parent for *.host
Gyp defaults to gcc/g++ if CC.host/CXX.host is unset. This is not
suitable for environments that only uses the clang toolchain.

Since we already assume that the user will provide clang/clang++
through CC/CXX, lean against it (then drop to gcc/g++).

Also apply the same logic for link/ar for consistency although
it doesn't affect us.

PR-URL: https://github.com/nodejs/node/pull/6173
Fixes: https://github.com/nodejs/node/issues/6152
Reviewed-By: João Reis <reis@janeasystems.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-04-24 11:01:21 +10:00
Alexander Gromnitsky
983a809456 doc: fix broken references
PR-URL: https://github.com/nodejs/node/pull/6350
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Minwoo Jung <jmwsoft@gmail.com>
2016-04-22 19:08:48 -07:00
Ben Noordhuis
7940ecfa00 v8: warn in Template::Set() on improper use
The next major release will make it a fatal error to use non-primitive
values in function templates and object templates.

Print a warning that includes the C and JS stack trace to tell people to
upgrade their add-ons.  The C stack trace is only printed on platforms
that support it (the BSDs, OS X and Linux+glibc.)

The warning can be disabled with the new `--nowarn_template_set` flag.

Refs: https://github.com/nodejs/node/issues/6216
PR-URL: https://github.com/nodejs/node/pull/6277
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-04-22 23:48:31 +02:00
Rich Trott
e84c69310f tools: enforce deepStrictEqual over deepEqual
Introduce a lint rule that enforces use of `assert.deepStrictEqual()`
over `assert.deepEqual()`.

PR-URL: https://github.com/nodejs/node/pull/6213
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-04-22 14:39:53 -07:00
Rich Trott
a7335bd1f0 test,benchmark: use deepStrictEqual()
In preparation for a lint rule that will enforce
assert.deepStrictEqual() over assert.deepEqual(), change tests and
benchmarks accordingly. For tests and benchmarks that are testing or
benchmarking assert.deepEqual() itself, apply a comment to ignore the
upcoming rule.

PR-URL: https://github.com/nodejs/node/pull/6213
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-04-22 14:38:09 -07:00
Ben Noordhuis
5eb4ec090d src: squelch -Wunused-variable in non-icu builds
Silence the following compiler warning when building without ICU:

    ../src/node_config.cc:32:16: warning: unused variable 'env'
    [-Wunused-variable]
       Environment* env = Environment::GetCurrent(context);

PR-URL: https://github.com/nodejs/node/pull/6351
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-04-22 23:01:44 +02:00
Robert Chiras
a4b8000029 build: update android-configure script for npm
Now, that we can cross-compile node for Android, we also need to take
care of native node modules installed with npm. Since there is no way to
install and run npm on an Android device, we could instal node on host
and setup an environment for installing node modules and cross-compile
the native sources using Android NDK.
The changes to this script will allow npm, when installing a module, to
compile it using NDK.

In order to do this, the developer should do the following steps:
1. Compile and install node on host, using: configure, make and make
install
2. Build node for Android, using: source android-configure <path_to_ndk>
arch and make
3. Push node binary to Android device
4. Using the same session, configure npm arch using: npm config set
arch=<arch>
5. Install desired node modules using: npm install
6. Push installed node modules to Android device

Signed-off-by: Robert Chiras <robert.chiras@intel.com>
PR-URL: https://github.com/nodejs/node/pull/6349
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-04-22 22:12:53 +02:00
Robert Jefe Lindstaedt
ae991e7577 doc: add note for platform specific flags fs.open()
Note describing platform specific differences in fs.open

E.g. fs.open('<directory>', 'a+', console.log)

Fixes: https://github.com/nodejs/node/issues/3643
PR-URL: https://github.com/nodejs/node/pull/6136
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-04-22 11:32:22 -07:00
Anna Henningsen
a3b5b9cbf2
src: fix out-of-bounds write in TwoByteValue
Plan 2 bytes instead of 1 byte for the final zero terminator
for UTF-16. This is unlikely to cause real-world problems,
but that ultimately depends on the `malloc` implementation.

The issue can be uncovered by running e.g.
`valgrind node -e "Buffer(65536).fill('a'.repeat(4096), 'utf16le')"`

Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
PR-URL: https://github.com/nodejs/node/pull/6330
2016-04-22 20:28:53 +02:00
James M Snell
0e7d57af35 events: add prependListener() and prependOnceListener()
A handful of modules (including readable-streams) make
inappropriate use of the internal _events property. One
such use is to prepend an event listener to the front
of the array of listeners.

This adds EE.prototype.prependListener() and
EE.prototype.prependOnceListener() methods to add handlers
to the *front* of the listener array.

Doc update and test case is included.

Fixes: https://github.com/nodejs/node/issues/1817
PR-URL: https://github.com/nodejs/node/pull/6032
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
2016-04-22 09:28:37 -07:00
Alexander Makarenko
f85412d49b doc: improvements to child_process, process docs
Sort links in lexical order. Add missing links.
Add `disconnect` event description in Process doc.
Fix typos.

R-URL: https://github.com/nodejs/node/pull/5075
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Robert Jefe Lindstädt <robert.lindstaedt@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
2016-04-22 08:38:15 -07:00
vsemozhetbyt
f6d90a912b doc: fix a typo in the CONTRIBUTING.md
Delete a typo dot in the link to stability index.

PR-URL: https://github.com/nodejs/node/pull/6343
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Minwoo Jung <jmwsoft@gmail.com>
2016-04-22 08:35:39 -07:00
Evan Lucas
84ebf2b40d test: add tests for console.assert
There were previously no tests where console.assert failed

PR-URL: https://github.com/nodejs/node/pull/6302
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2016-04-21 22:15:14 -07:00
Robert Jefe Lindstaedt
6815a3b7f9 doc: add vm example, be able to require modules
The intention behind is to present the user a way to
execute code in a vm context. The current API doesn't
allow this out-of-the-box, since it is neither passing a require
function nor creating context with one.
The missing docs for this behaviour have produced a number of
Q&A items and have also been discussed in the node-archive repo.
In both cases there was no real canonical answer.

Refs: nodejs/node-v0.x-archive#9211, #4955
PR-URL: https://github.com/nodejs/node/pull/5323
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2016-04-21 21:44:41 -07:00
Gireesh Punathil
40ede46690 cares: Support malloc(0) scenarios for AIX
Many places in cares library, when the stream data arrives
from the network with respect to dns and reverse dns
resolution, they are populated into data structures created
dymaically based on the size of the data. Malloc is heavily
used for such cases.

Often, based on the data length, malloc(0) is invoked. Linux
behavior on zero byte allocation is to return a valid pointer
where in AIX, it always return NULL.

This manifestst as test failure of test/internet/test-dns.js

Solution is to build cares with Linux compatible malloc behavior

PR-URL: https://github.com/nodejs/node/pull/6305
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-by: Michael Dawson <michael_dawson@ca.ibm.com>
2016-04-21 19:20:37 -04:00
Myles Borins
1fa8fce210 2016-04-20, Version 5.11.0 (Stable) Release
Buffer:
  * Buffer.prototype.compare can now compare sub-ranges of two Buffers
   (James M Snell) https://github.com/nodejs/node/pull/5880

deps:
  * update to http-parser 2.7.0
    (Fedor Indutny) https://github.com/nodejs/node/pull/6279
  * update ESLint to 2.7.0
    (silverwind) https://github.com/nodejs/node/pull/6132

net:
  * adds support for passing DNS lookup hints to createConnection()
    (Colin Ihrig) https://github.com/nodejs/node/pull/6000

node:
  * Make the builtin libraries available for the --eval and --print
    CLI options
    (Anna Henningsen) https://github.com/nodejs/node/pull/6207

npm:
  * upgrade npm to 3.8.6
    (Kat Marchán) https://github.com/nodejs/node/pull/6153

repl:
  * Pressing enter in the repl will repeat the last command by default
    if no input has been received. This behaviour was in node
    previously and was not removed intentionally.
    (Rich Trott) https://github.com/nodejs/node/pull/6090

src:
  * add SIGINFO to supported signals
    (James Reggio) https://github.com/nodejs/node/pull/6093

streams:
  * Fix a regression that caused by net streams requesting multiple
    chunks synchronously when combined with cork/uncork
    (Matteo Collina) https://github.com/nodejs/node/pull/6164

zlib:
  * The flushing flag is now configurable allowing for decompression
    of partial data
    (Anna Henningsen) https://github.com/nodejs/node/pull/6069

PR-URL: https://github.com/nodejs/node/pull/6322
2016-04-21 13:34:57 -07:00
Luigi Pinca
c1cd64481f events: make eventNames() use Reflect.ownKeys()
Use `Reflect.ownKeys()` instead of `Object.keys()` and
`Object.getOwnPropertySymbols()`.

PR-URL: https://github.com/nodejs/node/pull/5822
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-04-21 12:03:47 -07:00
James M Snell
cdba9a6c02 src: add intl and icu configs to process.binding('config')
PR-URL: https://github.com/nodejs/node/pull/6266
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-04-21 11:37:47 -07:00
James M Snell
2e974cdd8c src: add process.binding('config')
It turns out that userland likes to override process.config with
their own stuff. If we want to be able to depend on it in any way,
we need our own internal mechanism.

This adds a new private process.binding('config') that is
intended to serve as a container for internal flags and compile
time configs that need to be passed on to the JS layer.

PR-URL: https://github.com/nodejs/node/pull/6266
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-04-21 11:37:37 -07:00
James M Snell
7f11634a46 doc: note that process.config can and will be changed
PR-URL: https://github.com/nodejs/node/pull/6266
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-04-21 11:37:32 -07:00
Ali Ijaz Sheikh
49e42c530b deps: upgrade to V8 5.0.71.34
Pick up the latest bug fix from the V8 5.0 branch.

Original commit message:
V8-Commit: https://github.com/v8/v8/commit/c36773f
  Version 5.0.71.34 (cherry-pick)
  Merged 9acbca1

  [es6] Fix bug in pattern re-writing

  BUG=v8:4891
  LOG=N
  R=littledan@chromium.org

  Review URL: https://codereview.chromium.org/1906633002 .

PR-URL: https://github.com/nodejs/node/pull/6320
Reviewed-By: cjihrig - Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: jasnell - James M Snell <jasnell@gmail.com>
Reviewed-By: targos - Michaël Zasso <mic.besace@gmail.com>
2016-04-21 10:04:02 -07:00
Ali Ijaz Sheikh
a770a163ab test: v8-flags is sensitive to script caching
V8 may cache compiled scripts, and it is not safe to assume that the
V8 flags can be changed after an isolate has been created. In this
particular case, since we are using the same script multiple times,
the test would fail if V8 cached the result of the compilation.

Ref: https://github.com/nodejs/node/issues/6280
Fixes: https://github.com/nodejs/node/issues/6258
PR-URL: https://github.com/nodejs/node/pull/6316
Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: targos - Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: cjihrig - Colin Ihrig <cjihrig@gmail.com>
2016-04-21 09:31:54 -07:00
cjihrig
1e4d053e6b test: don't assume IPv6 in test-regress-GH-5727
test/parallel/test-regress-GH-5727 assumed that one of the
servers would be listening on IPv6. This breaks when the machine
running the test doesn't have IPv6. This commit builds the
connection key that is compared dynamically.

Refs: https://github.com/nodejs/node/pull/5732
PR-URL: https://github.com/nodejs/node/pull/6319
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
2016-04-21 10:59:13 -04:00
Brian White
7e9b0dd694 http: disallow sending obviously invalid status codes
PR-URL: https://github.com/nodejs/node/pull/6291
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-04-20 16:34:58 -07:00
Robert Jefe Lindstaedt
0800c0aa72 doc: git mv to .md
* doc: rename .markdown references in content
* doc: rename to .md in tools
* doc: rename to .md in CONTRIBUTING.md

PR-URL: https://github.com/nodejs/node/pull/4747
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: techjeffharris
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2016-04-20 16:34:27 -07:00
Myles Borins
cff2a137f2 benchmarks: fix lint error
33c242e7e9 introduced a linting error with indentation

PR-URL: https://github.com/nodejs/node/pull/6314
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-04-20 15:54:50 -07:00
Dirceu Pereira Tiegs
02ac302b6d net: Validate port in createServer().listen()
Make sure we validate the port number in all kinds of `listen()` calls.

Fixes: https://github.com/nodejs/node/issues/5727
PR-URL: https://github.com/nodejs/node/pull/5732
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-04-20 15:41:18 -07:00
James M Snell
7dc1a87a7b benchmarks: add microbenchmarks for new ES6 features
Adds new microbenchmarks for destructuring, rest params and
default params.

PR-URL: https://github.com/nodejs/node/pull/6222
Reviewed-By: Brian White <mscdex@mscdex.net>
2016-04-20 14:57:51 -07:00
James M Snell
cb9eff2f93 benchmarks: add common.v8ForceOptimization
It's useful to be able to force optimization of a function.
Rather than duplicating the code everywhere for it, let's
make a utility available.

PR-URL: https://github.com/nodejs/node/pull/6222
Reviewed-By: Brian White <mscdex@mscdex.net>
2016-04-20 14:57:46 -07:00
James M Snell
33c242e7e9 console: refactor to use rest params and template strings
Overall cleanup in code, eliminate reliance on `arguments`.

Benchmarks show that as of v8 5.0.71.32, using rest params + apply
has good performance. The spread operator is not yet well optimized
in v8

```
misc/console.js method=restAndSpread concat=1 n=1000000: 374779.38359
misc/console.js method=restAndSpread concat=0 n=1000000: 375988.30434
misc/console.js method=argumentsAndApply concat=1 n=1000000: 682618.61125
misc/console.js method=argumentsAndApply concat=0 n=1000000: 645093.74443
misc/console.js method=restAndApply concat=1 n=1000000: 682931.41217
misc/console.js method=restAndApply concat=0 n=1000000: 664473.09700
```

PR-URL: https://github.com/nodejs/node/pull/6233
Reviewed-By: Brian White <mscdex@mscdex.net>
2016-04-20 14:45:42 -07:00
Calvin Metcalf
e7c077c610 stream: make null an invalid chunk to write in object mode
this harmonizes behavior between readable, writable, and transform
streams so that they all handle nulls in object mode the same way by
considering them invalid chunks.

PR-URL: https://github.com/nodejs/node/pull/6170
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2016-04-20 13:28:35 -07:00
Fedor Indutny
ec2822adaa http: unref socket timer on parser execute
When underlying `net.Socket` instance is consumed in http server - no
`data` events are emitted, and thus `socket.setTimeout` fires the
callback even if the data is constantly flowing into the socket.

Fix this by calling `socket._unrefTimer()` on every `onParserExecute`
call.

Fix: #5899
PR-URL: https://github.com/nodejs/node/pull/6286
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-04-20 13:57:54 -04:00
Michaël Zasso
75487f0db8 module: fix resolution of filename with trailing slash
A recent optimization of module loading performance [1] forgot to check that
extensions were set in a certain code path.

[1] ae18bbef48

Fixes: https://github.com/nodejs/node/issues/6214
PR-URL: https://github.com/nodejs/node/pull/6215
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
2016-04-20 09:45:57 -07:00
Fedor Indutny
8636af1012 net: replace __defineGetter__ with defineProperty
`Object.prototype.__defineGetter__` is deprecated now, use
`Object.defineProperty` instead.

PR-URL: https://github.com/nodejs/node/pull/6284
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-04-20 12:42:33 -04:00
Fedor Indutny
6198472d83 stream_base: expose bytesRead getter
This will provide `bytesRead` data on consumed sockets.

Fix: #3021
PR-URL: https://github.com/nodejs/node/pull/6284
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-04-20 12:42:33 -04:00
Fedor Indutny
e1cf634a0b test: spawn new processes in vm-cached-data
V8 may start caching scripts from the first run soon. Preventively
execute scripts in another process to ensure no test failures due to
an update in the future.

See: #6258
PR-URL: https://github.com/nodejs/node/pull/6280
Reviewed-By: Jochen Eisinger <jochen@chromium.org>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-04-20 12:34:44 -04:00
Anna Henningsen
5f0fcd6245
doc: add full example for zlib.flush()
Add a full example using `zlib.flush()` for the common use
case of writing partial compressed HTTP output to the client.

PR-URL: https://github.com/nodejs/node/pull/6172
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Robert Jefe Lindstädt <robert.lindstaedt@gmail.com>
2016-04-20 18:28:39 +02:00