Commit 631fec46 authored by Jérémy Lal's avatar Jérémy Lal

Imported Upstream version 4.2.0~dfsg

parent 18f7b242
......@@ -20,6 +20,7 @@ Brandon Benvie <brandon@bbenvie.com> <brandon@brandonbenvie.com>
Brian White <mscdex@mscdex.net>
Brian White <mscdex@mscdex.net> <mscdex@gmail.com>
Chew Choon Keat <choonkeat@gmail.com>
Charles Rudolph <charles.rudolph@originate.com>
Colin Ihrig <cjihrig@gmail.com>
Christopher Lenz <cmlenz@gmail.com> <chris@lamech.local>
Daniel Berger <code+node@dpbis.net>
......@@ -58,6 +59,7 @@ Jeremiah Senkpiel <fishrock123@rocketmail.com>
Joe Shaw <joe@joeshaw.org> <joeshaw@litl.com>
Johan Bergström <bugs@bergstroem.nu>
Johan Dahlberg <jfd@distrop.com> <dahlberg.johan@gmail.com>
Johann Hofmann <git@johann-hofmann.com>
Jonas Pfenniger <jonas@pfenniger.name> <jonas@stvs.ch>
Jonathan Ong <jonathanrichardong@gmail.com> <jonathanong@users.noreply.github.com>
Jonathan Rentzsch <jwr.git@redshed.net>
......@@ -124,6 +126,7 @@ Tadashi SAWADA <cesare@mayverse.jp>
Takahiro ANDO <takahiro.ando@gmail.com>
Ted Young <ted@radicaldesigns.org>
Thomas Lee <thomas.lee@shinetech.com> <tom@tom-debian.sensis.com.au>
Thomas Reggi <thomas@reggi.com>
Tim Caswell <tim@creationix.com> <tim@0-26-8-e9-4c-e1.dyn.utdallas.edu>
Tim Price <timprice@mangoraft.com>
Tim Smart <timehandgod@gmail.com> <tim@fostle.com>
......
......@@ -789,5 +789,26 @@ Mike Atkins <mike.atkins@lanetix.com>
hackerjs <4141095@qq.com>
Minwoo Jung <jmwsoft@gmail.com>
Marcin Cieślak <saper@marcincieslak.com>
Anne-Gaelle Colom <coloma@wmin.ac.uk>
Oleksandr Chekhovskyi <oleksandr.chekhovskyi@hansoft.com>
Tristian Flanagan <tflanagan@datacollaborative.com>
Mike Tunnicliffe <mike.tunnicliffe@uk.ibm.com>
Ionică Bizău <bizauionica@gmail.com>
Danny Nemer <DannyNemer@users.noreply.github.com>
Sven Slootweg <jamsoftgamedev@gmail.com>
Dmitry Vasilyev <vaseker@gmail.com>
Malcolm Ahoy <malcolmahoy@gmail.com>
Imran Iqbal <imrani@ca.ibm.com>
Stewart Addison <sxa@uk.ibm.com>
Matt Harrison <hi@matt-harrison.com>
Christopher J. Brody <brodybits@litehelpers.net>
Salman Aljammaz <s@0x65.net>
Thomas Reggi <thomas@reggi.com>
Laurent Fortin <laurent.fortin@gmail.com>
Fabio Oliveira <fabio.an.oliveira@gmail.com>
Michał Gołębiowski <m.goleb@gmail.com>
Johann Hofmann <git@johann-hofmann.com>
Charles Rudolph <charles.rudolph@originate.com>
Dave Eddy <dave@daveeddy.com>
# Generated by tools/update-authors.sh
This diff is collapsed.
......@@ -6,6 +6,9 @@ When opening new issues or commenting on existing issues on this repository
please make sure discussions are related to concrete technical issues with the
Node.js software.
For general help using Node.js, please file an issue at the
[Node.js help repository](https://github.com/nodejs/help/issues).
Discussion of non-technical topics including subjects like intellectual
property, trademark and high level project questions should move to the
[node-forward discussions repository](https://github.com/node-forward/discussions)
......
......@@ -237,38 +237,6 @@ The externally maintained libraries used by Node.js are:
THE SOFTWARE.
"""
- python-gflags is located at tools/gflags. Its license follows:
"""
# Copyright (c) 2006, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# * Neither the name of Google Inc. nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""
- tools/cpplint.py is a C++ linter. Its license follows:
"""
# Copyright (c) 2009 Google Inc. All rights reserved.
......
......@@ -67,8 +67,9 @@ uninstall:
clean:
-rm -rf out/Makefile $(NODE_EXE) $(NODE_G_EXE) out/$(BUILDTYPE)/$(NODE_EXE)
@if [ -d out ]; then find out/ -name '*.o' -o -name '*.a' | xargs rm -rf; fi
@if [ -d out ]; then find out/ -name '*.o' -o -name '*.a' -o -name '*.d' | xargs rm -rf; fi
-rm -rf node_modules
@if [ -d deps/icu ]; then echo deleting deps/icu; rm -rf deps/icu; fi
-rm -f test.tap
distclean:
......@@ -505,7 +506,8 @@ bench-idle:
$(NODE) benchmark/idle_clients.js &
jslint:
$(NODE) tools/eslint/bin/eslint.js src lib test --rulesdir tools/eslint-rules --reset --quiet
$(NODE) tools/eslint/bin/eslint.js src lib test tools/eslint-rules \
--rulesdir tools/eslint-rules --reset --quiet
CPPLINT_EXCLUDE ?=
CPPLINT_EXCLUDE += src/node_lttng.cc
......
......@@ -159,7 +159,7 @@ $ make
### `Intl` (ECMA-402) support:
[Intl](https://github.com/joyent/node/wiki/Intl) support is not
[Intl](https://github.com/nodejs/node/wiki/Intl) support is not
enabled by default.
#### "small" (English only) support
......@@ -184,7 +184,7 @@ The `small-icu` mode builds with English-only data. You can add full
data at runtime.
*Note:* more docs are on
[the joyent/node wiki](https://github.com/joyent/node/wiki/Intl).
[the node wiki](https://github.com/nodejs/node/wiki/Intl).
#### Build with full ICU support (all locales supported by ICU):
......
var common = require('../common.js');
var bench = common.createBenchmark(main, {
type: 'Array Buffer Int8Array Uint8Array Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array'.split(' '),
n: [25]
});
function main(conf) {
var type = conf.type;
var clazz = global[type];
var n = +conf.n;
bench.start();
var arr = new clazz(n * 1e6);
for (var i = 0; i < 10; ++i) {
for (var j = 0, k = arr.length; j < k; ++j) {
arr[j] = (j ^ k) & 127;
}
}
bench.end(n);
}
var common = require('../common.js');
var bench = common.createBenchmark(main, {
type: 'Array Buffer Int8Array Uint8Array Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array'.split(' '),
n: [25]
});
function main(conf) {
var type = conf.type;
var clazz = global[type];
var n = +conf.n;
bench.start();
var arr = new clazz(n * 1e6);
for (var i = 0; i < 10; ++i) {
for (var j = 0, k = arr.length; j < k; ++j) {
arr[j] = 0.0;
}
}
bench.end(n);
}
var common = require('../common.js');
var bench = common.createBenchmark(main, {
type: 'Array Buffer Int8Array Uint8Array Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array'.split(' '),
n: [25]
});
function main(conf) {
var type = conf.type;
var clazz = global[type];
var n = +conf.n;
bench.start();
var arr = new clazz(n * 1e6);
for (var i = 0; i < 10; ++i) {
for (var j = 0, k = arr.length; j < k; ++j) {
arr[j] = 0;
}
}
bench.end(n);
}
var common = require('../common.js');
var fs = require('fs');
var bench = common.createBenchmark(main, {
search: ['@', 'SQ', '10x', '--l', 'Alice', 'Gryphon', 'Panther',
'Ou est ma chatte?', 'found it very', 'among mad people',
'neighbouring pool', 'Soo--oop', 'aaaaaaaaaaaaaaaaa',
'venture to go near the house till she had brought herself down to',
'</i> to the Caterpillar'],
encoding: ['undefined', 'utf8', 'ucs2', 'binary'],
type: ['buffer', 'string'],
iter: [1]
});
function main(conf) {
var iter = (conf.iter) * 100000;
var aliceBuffer = fs.readFileSync(__dirname + '/../fixtures/alice.html');
var search = conf.search;
var encoding = conf.encoding;
if (encoding === 'undefined') {
encoding = undefined;
}
if (encoding === 'ucs2') {
aliceBuffer = new Buffer(aliceBuffer.toString(), encoding);
}
if (conf.type === 'buffer') {
search = new Buffer(new Buffer(search).toString(), encoding);
}
bench.start();
for (var i = 0; i < iter; i++) {
aliceBuffer.indexOf(search, 0, encoding);
}
bench.end(iter);
}
var common = require('../common.js');
var SlowBuffer = require('buffer').SlowBuffer;
var bench = common.createBenchmark(main, {
type: 'Array Buffer Int8Array Uint8Array Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array'.split(' '),
n: [25]
type: ['fast', 'slow'],
n: [1024]
});
var buf = new Buffer(1024);
var slowBuf = new SlowBuffer(1024);
function main(conf) {
var type = conf.type;
var clazz = global[type];
var n = +conf.n;
var b = conf.type === 'fast' ? buf : slowBuf;
bench.start();
var arr = new clazz(n * 1e6);
for (var i = 0; i < 10; ++i) {
for (var j = 0, k = ar
\ No newline at end of file
for (var i = 0; i < n * 1024; i++) {
b.slice(10, 256);
}
bench.end(n);
}
'use strict';
const common = require('../common.js');
const bench = common.createBenchmark(main, {
arg: [true, false],
len: [0, 1, 64, 1024],
n: [1e7]
});
function main(conf) {
const arg = conf.arg;
const len = conf.len | 0;
const n = conf.n | 0;
const buf = Buffer(len).fill(42);
bench.start();
if (arg) {
for (var i = 0; i < n; i += 1)
buf.toString('utf8');
} else {
for (var i = 0; i < n; i += 1)
buf.toString();
}
bench.end(n);
}
var common = require('../common.js');
var bench = common.createBenchmark(main, {
noAssert: [false, true],
buffer: ['fast', 'slow'],
type: ['UInt8', 'UInt16LE', 'UInt16BE',
'UInt32LE', 'UInt32BE',
'Int8', 'Int16LE', 'Int16BE',
'Int32LE', 'Int32BE',
'FloatLE', 'FloatBE',
'DoubleLE', 'DoubleBE'],
millions: [1]
});
const INT8 = 0x7f;
const INT16 = 0x7fff;
const INT32 = 0x7fffffff;
const UINT8 = (INT8 * 2) + 1;
const UINT16 = (INT16 * 2) + 1;
const UINT32 = INT32;
var mod = {
writeInt8: INT8,
writeInt16BE: INT16,
writeInt16LE: INT16,
writeInt32BE: INT32,
writeInt32LE: INT32,
writeUInt8: UINT8,
writeUInt16BE: UINT16,
writeUInt16LE: UINT16,
writeUInt32BE: UINT32,
writeUInt32LE: UINT32
};
function main(conf) {
var noAssert = conf.noAssert === 'true';
var len = +conf.millions * 1e6;
var clazz = conf.buf === 'fast' ? Buffer : require('buffer').SlowBuffer;
var buff = new clazz(8);
var fn = 'write' + conf.type;
if (fn.match(/Int/))
benchInt(buff, fn, len, noAssert);
else
benchFloat(buff, fn, len, noAssert);
}
function benchInt(buff, fn, len, noAssert) {
var m = mod[fn];
var testFunction = new Function('buff', [
"for (var i = 0; i !== " + len + "; i++) {",
" buff." + fn + "(i & " + m + ", 0, " + JSON.stringify(noAssert) + ");",
"}"
].join("\n"));
bench.start();
testFunction(buff);
bench.end(len / 1e6);
}
function benchFloat(buff, fn, len, noAssert) {
var testFunction = new Function('buff', [
"for (var i = 0; i !== " + len + "; i++) {",
" buff." + fn + "(i, 0, " + JSON.stringify(noAssert) + ");",
"}"
].join("\n"));
bench.start();
testFunction(buff);
bench.end(len / 1e6);
}
var common = require('../common.js');
var bench = common.createBenchmark(main, {
type: ['Uint8', 'Uint16LE', 'Uint16BE',
'Uint32LE', 'Uint32BE',
'Int8', 'Int16LE', 'Int16BE',
'Int32LE', 'Int32BE',
'Float32LE', 'Float32BE',
'Float64LE', 'Float64BE'],
millions: [1]
});
const INT8 = 0x7f;
const INT16 = 0x7fff;
const INT32 = 0x7fffffff;
const UINT8 = INT8 * 2;
const UINT16 = INT16 * 2;
const UINT32 = INT32 * 2;
var mod = {
setInt8: INT8,
setInt16: INT16,
setInt32: INT32,
setUint8: UINT8,
setUint16: UINT16,
setUint32: UINT32
};
function main(conf) {
var len = +conf.millions * 1e6;
var ab = new ArrayBuffer(8);
var dv = new DataView(ab, 0, 8);
var le = /LE$/.test(conf.type);
var fn = 'set' + conf.type.replace(/[LB]E$/, '');
if (/int/i.test(fn))
benchInt(dv, fn, len, le);
else
benchFloat(dv, fn, len, le);
}
function benchInt(dv, fn, len, le) {
var m = mod[fn];
bench.start();
for (var i = 0; i < len; i++) {
dv[fn](0, i % m, le);
}
bench.end(len / 1e6);
}
function benchFloat(dv, fn, len, le) {
bench.start();
for (var i = 0; i < len; i++) {
dv[fn](0, i * 0.1, le);
}
bench.end(len / 1e6);
}
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -30,6 +30,7 @@ valid_os = ('win', 'mac', 'solaris', 'freebsd', 'openbsd', 'linux',
valid_arch = ('arm', 'arm64', 'ia32', 'mips', 'mipsel', 'ppc', 'ppc64', 'x32',
'x64', 'x86')
valid_arm_float_abi = ('soft', 'softfp', 'hard')
valid_arm_fpu = ('vfp', 'vfpv2', 'vfpv3', 'vfpv3-d16', 'neon')
valid_mips_arch = ('loongson', 'r1', 'r2', 'r6', 'rx')
valid_mips_fpu = ('fp32', 'fp64', 'fpxx')
valid_mips_float_abi = ('soft', 'hard')
......@@ -219,6 +220,13 @@ parser.add_option('--with-arm-float-abi',
help='specifies which floating-point ABI to use ({0}).'.format(
', '.join(valid_arm_float_abi)))
parser.add_option('--with-arm-fpu',
action='store',
dest='arm_fpu',
choices=valid_arm_fpu,
help='ARM FPU mode ({0}) [default: %default]'.format(
', '.join(valid_arm_fpu)))
parser.add_option('--with-mips-arch-variant',
action='store',
dest='mips_arch_variant',
......@@ -288,6 +296,12 @@ intl_optgroup.add_option('--download',
dest='download_list',
help=nodedownload.help())
intl_optgroup.add_option('--download-path',
action='store',
dest='download_path',
default=os.path.join(root_dir, 'deps'),
help='Download directory [default: %default]')
parser.add_option_group(intl_optgroup)
parser.add_option('--with-perfctr',
......@@ -607,20 +621,23 @@ def configure_arm(o):
else:
arm_float_abi = 'default'
arm_fpu = 'vfpv2'
if is_arch_armv7():
o['variables']['arm_fpu'] = 'vfpv3'
arm_fpu = 'vfpv3'
o['variables']['arm_version'] = '7'
else:
o['variables']['arm_fpu'] = 'vfpv2'
o['variables']['arm_version'] = '6' if is_arch_armv6() else 'default'
o['variables']['arm_thumb'] = 0 # -marm
o['variables']['arm_float_abi'] = arm_float_abi
if options.dest_os == 'android':
o['variables']['arm_fpu'] = 'vfpv3'
arm_fpu = 'vfpv3'
o['variables']['arm_version'] = '7'
o['variables']['arm_fpu'] = options.arm_fpu or arm_fpu
def configure_mips(o):
can_use_fpu_instructions = (options.mips_float_abi != 'soft')
......@@ -826,18 +843,21 @@ def glob_to_var(dir_base, dir_sub, patch_dir):
def configure_intl(o):
icus = [
{
'url': 'http://download.icu-project.org/files/icu4c/55.1/icu4c-55_1-src.zip',
# from https://ssl.icu-project.org/files/icu4c/55.1/icu4c-src-55_1.md5:
'md5': '4cddf1e1d47622fdd9de2cd7bb5001fd',
'url': 'https://ssl.icu-project.org/files/icu4c/56.1/icu4c-56_1-src.zip',
'md5': '61d71888f14bf00cc3e8a6f2c087d367',
},
]
def icu_download(path):
# download ICU, if needed
if not os.access(options.download_path, os.W_OK):
print 'Error: cannot write to desired download path. ' \
'Either create it or verify permissions.'
sys.exit(1)
for icu in icus:
url = icu['url']
md5 = icu['md5']
local = url.split('/')[-1]
targetfile = os.path.join(root_dir, 'deps', local)
targetfile = os.path.join(options.download_path, local)
if not os.path.isfile(targetfile):
if nodedownload.candownload(auto_downloads, "icu"):
nodedownload.retrievefile(url, targetfile)
......
......@@ -5380,6 +5380,19 @@ class V8_EXPORT Isolate {
*/
static Isolate* GetCurrent();
/**
* Custom callback used by embedders to help V8 determine if it should abort
* when it throws and no internal handler is predicted to catch the
* exception. If --abort-on-uncaught-exception is used on the command line,
* then V8 will abort if either:
* - no custom callback is set.
* - the custom callback set returns true.
* Otherwise, the custom callback will not be called and V8 will not abort.
*/
typedef bool (*AbortOnUncaughtExceptionCallback)(Isolate*);
void SetAbortOnUncaughtExceptionCallback(
AbortOnUncaughtExceptionCallback callback);
/**
* Methods below this point require holding a lock (using Locker) in
* a multi-threaded environment.
......
......@@ -7176,6 +7176,13 @@ void Isolate::Exit() {
}
void Isolate::SetAbortOnUncaughtExceptionCallback(
AbortOnUncaughtExceptionCallback callback) {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
isolate->SetAbortOnUncaughtExceptionCallback(callback);
}
Isolate::DisallowJavascriptExecutionScope::DisallowJavascriptExecutionScope(
Isolate* isolate,
Isolate::DisallowJavascriptExecutionScope::OnFailure on_failure)
......
......@@ -1013,13 +1013,21 @@ Object* Isolate::Throw(Object* exception, MessageLocation* location) {
Handle<Object> message_obj = CreateMessage(exception_handle, location);
thread_local_top()->pending_message_obj_ = *message_obj;
// If the abort-on-uncaught-exception flag is specified, abort on any
// exception not caught by JavaScript, even when an external handler is
// present. This flag is intended for use by JavaScript developers, so
// print a user-friendly stack trace (not an internal one).
// For any exception not caught by JavaScript, even when an external
// handler is present:
// If the abort-on-uncaught-exception flag is specified, and if the
// embedder didn't specify a custom uncaught exception callback,
// or if the custom callback determined that V8 should abort, then
// abort.
if (FLAG_abort_on_uncaught_exception &&
PredictExceptionCatcher() != CAUGHT_BY_JAVASCRIPT) {
FLAG_abort_on_uncaught_exception = false; // Prevent endless recursion.
PredictExceptionCatcher() != CAUGHT_BY_JAVASCRIPT &&
(!abort_on_uncaught_exception_callback_ ||
abort_on_uncaught_exception_callback_(
reinterpret_cast<v8::Isolate*>(this)))) {
// Prevent endless recursion.
FLAG_abort_on_uncaught_exception = false;
// This flag is intended for use by JavaScript developers, so
// print a user-friendly stack trace (not an internal one).
PrintF(stderr, "%s\n\nFROM\n",
MessageHandler::GetLocalizedMessage(this, message_obj).get());
PrintCurrentStackTrace(stderr);
......@@ -1612,6 +1620,12 @@ void Isolate::SetCaptureStackTraceForUncaughtExceptions(
}
void Isolate::SetAbortOnUncaughtExceptionCallback(
v8::Isolate::AbortOnUncaughtExceptionCallback callback) {
abort_on_uncaught_exception_callback_ = callback;
}
Handle<Context> Isolate::native_context() {
return handle(context()->native_context());
}
......@@ -1782,7 +1796,8 @@ Isolate::Isolate(bool enable_serializer)
next_unique_sfi_id_(0),
#endif
use_counter_callback_(NULL),
basic_block_profiler_(NULL) {
basic_block_profiler_(NULL),
abort_on_uncaught_exception_callback_(NULL) {
{
base::LockGuard<base::Mutex> lock_guard(thread_data_table_mutex_.Pointer());
CHECK(thread_data_table_);
......
......@@ -690,6 +690,9 @@ class Isolate {
int frame_limit,
StackTrace::StackTraceOptions options);
void SetAbortOnUncaughtExceptionCallback(
v8::Isolate::AbortOnUncaughtExceptionCallback callback);
enum PrintStackMode { kPrintStackConcise, kPrintStackVerbose };
void PrintCurrentStackTrace(FILE* out);
void PrintStack(StringStream* accumulator,
......@@ -1363,6 +1366,9 @@ class Isolate {
v8::ArrayBuffer::Allocator* array_buffer_allocator_;
v8::Isolate::AbortOnUncaughtExceptionCallback
abort_on_uncaught_exception_callback_;
friend class ExecutionAccess;
friend class HandleScopeImplementer;
friend class OptimizingCompileDispatcher;
......
......@@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8">
<title> Node.js v4.1.2 Manual &amp; Documentation</title>
<title> Node.js v4.2.0 Manual &amp; Documentation</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Lato:400,700,400italic">
<link rel="stylesheet" href="assets/style.css">
<link rel="stylesheet" href="assets/sh.css">
......@@ -61,7 +61,7 @@