diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6b9fe7ac42e..e2787fbc8ba 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -29,7 +29,8 @@ release.
-9.4.0
+9.5.0
+9.4.0
9.3.0
9.2.1
9.2.0
diff --git a/benchmark/_http-benchmarkers.js b/benchmark/_http-benchmarkers.js
index 55ebcc96ba2..76e02504b27 100644
--- a/benchmark/_http-benchmarkers.js
+++ b/benchmark/_http-benchmarkers.js
@@ -185,7 +185,7 @@ exports.run = function(options, callback) {
port: exports.PORT,
path: '/',
connections: 100,
- duration: 10,
+ duration: 5,
benchmarker: exports.default_http_benchmarker
}, options);
if (!options.benchmarker) {
diff --git a/benchmark/assert/deepequal-buffer.js b/benchmark/assert/deepequal-buffer.js
index 0e7494544d3..9556a81ec3b 100644
--- a/benchmark/assert/deepequal-buffer.js
+++ b/benchmark/assert/deepequal-buffer.js
@@ -14,8 +14,6 @@ const bench = common.createBenchmark(main, {
});
function main({ len, n, method }) {
- var i;
-
const data = Buffer.allocUnsafe(len + 1);
const actual = Buffer.alloc(len);
const expected = Buffer.alloc(len);
@@ -24,40 +22,13 @@ function main({ len, n, method }) {
data.copy(expected);
data.copy(expectedWrong);
- switch (method) {
- case '':
- // Empty string falls through to next line as default, mostly for tests.
- case 'deepEqual':
- bench.start();
- for (i = 0; i < n; ++i) {
- // eslint-disable-next-line no-restricted-properties
- assert.deepEqual(actual, expected);
- }
- bench.end(n);
- break;
- case 'deepStrictEqual':
- bench.start();
- for (i = 0; i < n; ++i) {
- assert.deepStrictEqual(actual, expected);
- }
- bench.end(n);
- break;
- case 'notDeepEqual':
- bench.start();
- for (i = 0; i < n; ++i) {
- // eslint-disable-next-line no-restricted-properties
- assert.notDeepEqual(actual, expectedWrong);
- }
- bench.end(n);
- break;
- case 'notDeepStrictEqual':
- bench.start();
- for (i = 0; i < n; ++i) {
- assert.notDeepStrictEqual(actual, expectedWrong);
- }
- bench.end(n);
- break;
- default:
- throw new Error('Unsupported method');
+ // eslint-disable-next-line no-restricted-properties
+ const fn = method !== '' ? assert[method] : assert.deepEqual;
+ const value2 = method.includes('not') ? expectedWrong : expected;
+
+ bench.start();
+ for (var i = 0; i < n; ++i) {
+ fn(actual, value2);
}
+ bench.end(n);
}
diff --git a/benchmark/assert/deepequal-map.js b/benchmark/assert/deepequal-map.js
index 085274e8bfb..bdd3c5c6b8c 100644
--- a/benchmark/assert/deepequal-map.js
+++ b/benchmark/assert/deepequal-map.js
@@ -117,6 +117,6 @@ function main({ n, len, method }) {
benchmark(assert.notDeepEqual, n, values, values2);
break;
default:
- throw new Error('Unsupported method');
+ throw new Error(`Unsupported method ${method}`);
}
}
diff --git a/benchmark/assert/deepequal-object.js b/benchmark/assert/deepequal-object.js
index 2c2549d5848..4c95006b3b8 100644
--- a/benchmark/assert/deepequal-object.js
+++ b/benchmark/assert/deepequal-object.js
@@ -28,47 +28,19 @@ function createObj(source, add = '') {
function main({ size, n, method }) {
// TODO: Fix this "hack". `n` should not be manipulated.
n = n / size;
- var i;
const source = Array.apply(null, Array(size));
const actual = createObj(source);
const expected = createObj(source);
const expectedWrong = createObj(source, '4');
- switch (method) {
- case '':
- // Empty string falls through to next line as default, mostly for tests.
- case 'deepEqual':
- bench.start();
- for (i = 0; i < n; ++i) {
- // eslint-disable-next-line no-restricted-properties
- assert.deepEqual(actual, expected);
- }
- bench.end(n);
- break;
- case 'deepStrictEqual':
- bench.start();
- for (i = 0; i < n; ++i) {
- assert.deepStrictEqual(actual, expected);
- }
- bench.end(n);
- break;
- case 'notDeepEqual':
- bench.start();
- for (i = 0; i < n; ++i) {
- // eslint-disable-next-line no-restricted-properties
- assert.notDeepEqual(actual, expectedWrong);
- }
- bench.end(n);
- break;
- case 'notDeepStrictEqual':
- bench.start();
- for (i = 0; i < n; ++i) {
- assert.notDeepStrictEqual(actual, expectedWrong);
- }
- bench.end(n);
- break;
- default:
- throw new Error('Unsupported method');
+ // eslint-disable-next-line no-restricted-properties
+ const fn = method !== '' ? assert[method] : assert.deepEqual;
+ const value2 = method.includes('not') ? expectedWrong : expected;
+
+ bench.start();
+ for (var i = 0; i < n; ++i) {
+ fn(actual, value2);
}
+ bench.end(n);
}
diff --git a/benchmark/assert/deepequal-prims-and-objs-big-array-set.js b/benchmark/assert/deepequal-prims-and-objs-big-array-set.js
index 04802a76928..90dbf105936 100644
--- a/benchmark/assert/deepequal-prims-and-objs-big-array-set.js
+++ b/benchmark/assert/deepequal-prims-and-objs-big-array-set.js
@@ -30,12 +30,19 @@ const bench = common.createBenchmark(main, {
]
});
+function run(fn, n, actual, expected) {
+ bench.start();
+ for (var i = 0; i < n; ++i) {
+ fn(actual, expected);
+ }
+ bench.end(n);
+}
+
function main({ n, len, primitive, method }) {
const prim = primValues[primitive];
const actual = [];
const expected = [];
const expectedWrong = [];
- var i;
for (var x = 0; x < len; x++) {
actual.push(prim);
@@ -51,69 +58,37 @@ function main({ n, len, primitive, method }) {
const expectedWrongSet = new Set(expectedWrong);
switch (method) {
+ // Empty string falls through to next line as default, mostly for tests.
case '':
- // Empty string falls through to next line as default, mostly for tests.
case 'deepEqual_Array':
- bench.start();
- for (i = 0; i < n; ++i) {
- // eslint-disable-next-line no-restricted-properties
- assert.deepEqual(actual, expected);
- }
- bench.end(n);
+ // eslint-disable-next-line no-restricted-properties
+ run(assert.deepEqual, n, actual, expected);
break;
case 'deepStrictEqual_Array':
- bench.start();
- for (i = 0; i < n; ++i) {
- assert.deepStrictEqual(actual, expected);
- }
- bench.end(n);
+ run(assert.deepStrictEqual, n, actual, expected);
break;
case 'notDeepEqual_Array':
- bench.start();
- for (i = 0; i < n; ++i) {
- // eslint-disable-next-line no-restricted-properties
- assert.notDeepEqual(actual, expectedWrong);
- }
- bench.end(n);
+ // eslint-disable-next-line no-restricted-properties
+ run(assert.notDeepEqual, n, actual, expectedWrong);
break;
case 'notDeepStrictEqual_Array':
- bench.start();
- for (i = 0; i < n; ++i) {
- assert.notDeepStrictEqual(actual, expectedWrong);
- }
- bench.end(n);
+ run(assert.notDeepStrictEqual, n, actual, expectedWrong);
break;
case 'deepEqual_Set':
- bench.start();
- for (i = 0; i < n; ++i) {
- // eslint-disable-next-line no-restricted-properties
- assert.deepEqual(actualSet, expectedSet);
- }
- bench.end(n);
+ // eslint-disable-next-line no-restricted-properties
+ run(assert.deepEqual, n, actualSet, expectedSet);
break;
case 'deepStrictEqual_Set':
- bench.start();
- for (i = 0; i < n; ++i) {
- assert.deepStrictEqual(actualSet, expectedSet);
- }
- bench.end(n);
+ run(assert.deepStrictEqual, n, actualSet, expectedSet);
break;
case 'notDeepEqual_Set':
- bench.start();
- for (i = 0; i < n; ++i) {
- // eslint-disable-next-line no-restricted-properties
- assert.notDeepEqual(actualSet, expectedWrongSet);
- }
- bench.end(n);
+ // eslint-disable-next-line no-restricted-properties
+ run(assert.notDeepEqual, n, actualSet, expectedWrongSet);
break;
case 'notDeepStrictEqual_Set':
- bench.start();
- for (i = 0; i < n; ++i) {
- assert.notDeepStrictEqual(actualSet, expectedWrongSet);
- }
- bench.end(n);
+ run(assert.notDeepStrictEqual, n, actualSet, expectedWrongSet);
break;
default:
- throw new Error('Unsupported method');
+ throw new Error(`Unsupported method "${method}"`);
}
}
diff --git a/benchmark/assert/deepequal-prims-and-objs-big-loop.js b/benchmark/assert/deepequal-prims-and-objs-big-loop.js
index 09797dfaf2d..ec51201d518 100644
--- a/benchmark/assert/deepequal-prims-and-objs-big-loop.js
+++ b/benchmark/assert/deepequal-prims-and-objs-big-loop.js
@@ -29,43 +29,14 @@ function main({ n, primitive, method }) {
const actual = prim;
const expected = prim;
const expectedWrong = 'b';
- var i;
- // Creates new array to avoid loop invariant code motion
- switch (method) {
- case '':
- // Empty string falls through to next line as default, mostly for tests.
- case 'deepEqual':
- bench.start();
- for (i = 0; i < n; ++i) {
- // eslint-disable-next-line no-restricted-properties
- assert.deepEqual([actual], [expected]);
- }
- bench.end(n);
- break;
- case 'deepStrictEqual':
- bench.start();
- for (i = 0; i < n; ++i) {
- assert.deepStrictEqual([actual], [expected]);
- }
- bench.end(n);
- break;
- case 'notDeepEqual':
- bench.start();
- for (i = 0; i < n; ++i) {
- // eslint-disable-next-line no-restricted-properties
- assert.notDeepEqual([actual], [expectedWrong]);
- }
- bench.end(n);
- break;
- case 'notDeepStrictEqual':
- bench.start();
- for (i = 0; i < n; ++i) {
- assert.notDeepStrictEqual([actual], [expectedWrong]);
- }
- bench.end(n);
- break;
- default:
- throw new Error('Unsupported method');
+ // eslint-disable-next-line no-restricted-properties
+ const fn = method !== '' ? assert[method] : assert.deepEqual;
+ const value2 = method.includes('not') ? expectedWrong : expected;
+
+ bench.start();
+ for (var i = 0; i < n; ++i) {
+ fn([actual], [value2]);
}
+ bench.end(n);
}
diff --git a/benchmark/assert/deepequal-set.js b/benchmark/assert/deepequal-set.js
index ebcf33cc6d5..e70ddf10e93 100644
--- a/benchmark/assert/deepequal-set.js
+++ b/benchmark/assert/deepequal-set.js
@@ -126,6 +126,6 @@ function main({ n, len, method }) {
benchmark(assert.notDeepEqual, n, values, values2);
break;
default:
- throw new Error('Unsupported method');
+ throw new Error(`Unsupported method "${method}"`);
}
}
diff --git a/benchmark/assert/deepequal-typedarrays.js b/benchmark/assert/deepequal-typedarrays.js
index 01546801ff3..50e6e525b20 100644
--- a/benchmark/assert/deepequal-typedarrays.js
+++ b/benchmark/assert/deepequal-typedarrays.js
@@ -31,42 +31,14 @@ function main({ type, n, len, method }) {
const expectedWrong = Buffer.alloc(len);
const wrongIndex = Math.floor(len / 2);
expectedWrong[wrongIndex] = 123;
- var i;
- switch (method) {
- case '':
- // Empty string falls through to next line as default, mostly for tests.
- case 'deepEqual':
- bench.start();
- for (i = 0; i < n; ++i) {
- // eslint-disable-next-line no-restricted-properties
- assert.deepEqual(actual, expected);
- }
- bench.end(n);
- break;
- case 'deepStrictEqual':
- bench.start();
- for (i = 0; i < n; ++i) {
- assert.deepStrictEqual(actual, expected);
- }
- bench.end(n);
- break;
- case 'notDeepEqual':
- bench.start();
- for (i = 0; i < n; ++i) {
- // eslint-disable-next-line no-restricted-properties
- assert.notDeepEqual(actual, expectedWrong);
- }
- bench.end(n);
- break;
- case 'notDeepStrictEqual':
- bench.start();
- for (i = 0; i < n; ++i) {
- assert.notDeepStrictEqual(actual, expectedWrong);
- }
- bench.end(n);
- break;
- default:
- throw new Error('Unsupported method');
+ // eslint-disable-next-line no-restricted-properties
+ const fn = method !== '' ? assert[method] : assert.deepEqual;
+ const value2 = method.includes('not') ? expectedWrong : expected;
+
+ bench.start();
+ for (var i = 0; i < n; ++i) {
+ fn(actual, value2);
}
+ bench.end(n);
}
diff --git a/benchmark/async_hooks/gc-tracking.js b/benchmark/async_hooks/gc-tracking.js
index a569fb8fa92..d74b2bac463 100644
--- a/benchmark/async_hooks/gc-tracking.js
+++ b/benchmark/async_hooks/gc-tracking.js
@@ -22,22 +22,23 @@ function endAfterGC(n) {
}
function main({ n, method }) {
+ var i;
switch (method) {
case 'trackingEnabled':
bench.start();
- for (let i = 0; i < n; i++) {
+ for (i = 0; i < n; i++) {
new AsyncResource('foobar');
}
endAfterGC(n);
break;
case 'trackingDisabled':
bench.start();
- for (let i = 0; i < n; i++) {
+ for (i = 0; i < n; i++) {
new AsyncResource('foobar', { requireManualDestroy: true });
}
endAfterGC(n);
break;
default:
- throw new Error('Unsupported method');
+ throw new Error(`Unsupported method "${method}"`);
}
}
diff --git a/benchmark/buffers/buffer-bytelength.js b/benchmark/buffers/buffer-bytelength.js
index 0617b4feb3f..fa8852a233e 100644
--- a/benchmark/buffers/buffer-bytelength.js
+++ b/benchmark/buffers/buffer-bytelength.js
@@ -17,10 +17,9 @@ const chars = [
function main({ n, len, encoding }) {
var strings = [];
- var results;
+ var results = [ len * 16 ];
if (encoding === 'buffer') {
strings = [ Buffer.alloc(len * 16, 'a') ];
- results = [ len * 16 ];
} else {
for (const string of chars) {
// Strings must be built differently, depending on encoding
diff --git a/benchmark/buffers/buffer-compare-offset.js b/benchmark/buffers/buffer-compare-offset.js
index 850fe11d3f4..551fcd2f0ce 100644
--- a/benchmark/buffers/buffer-compare-offset.js
+++ b/benchmark/buffers/buffer-compare-offset.js
@@ -8,26 +8,22 @@ const bench = common.createBenchmark(main, {
});
function compareUsingSlice(b0, b1, len, iter) {
- var i;
- bench.start();
- for (i = 0; i < iter; i++)
+ for (var i = 0; i < iter; i++)
Buffer.compare(b0.slice(1, len), b1.slice(1, len));
- bench.end(iter / 1e6);
}
function compareUsingOffset(b0, b1, len, iter) {
- var i;
- bench.start();
- for (i = 0; i < iter; i++)
+ for (var i = 0; i < iter; i++)
b0.compare(b1, 1, len, 1, len);
- bench.end(iter / 1e6);
}
function main({ millions, size, method }) {
const iter = millions * 1e6;
const fn = method === 'slice' ? compareUsingSlice : compareUsingOffset;
+ bench.start();
fn(Buffer.alloc(size, 'a'),
Buffer.alloc(size, 'b'),
size >> 1,
iter);
+ bench.end(millions);
}
diff --git a/benchmark/buffers/buffer-creation.js b/benchmark/buffers/buffer-creation.js
index 73e620955e9..a7b340131eb 100644
--- a/benchmark/buffers/buffer-creation.js
+++ b/benchmark/buffers/buffer-creation.js
@@ -16,51 +16,38 @@ const bench = common.createBenchmark(main, {
});
function main({ len, n, type }) {
+ let fn, i;
switch (type) {
case '':
case 'fast-alloc':
- bench.start();
- for (let i = 0; i < n * 1024; i++) {
- Buffer.alloc(len);
- }
- bench.end(n);
+ fn = Buffer.alloc;
break;
case 'fast-alloc-fill':
bench.start();
- for (let i = 0; i < n * 1024; i++) {
+ for (i = 0; i < n * 1024; i++) {
Buffer.alloc(len, 0);
}
bench.end(n);
- break;
+ return;
case 'fast-allocUnsafe':
- bench.start();
- for (let i = 0; i < n * 1024; i++) {
- Buffer.allocUnsafe(len);
- }
- bench.end(n);
+ fn = Buffer.allocUnsafe;
break;
case 'slow-allocUnsafe':
- bench.start();
- for (let i = 0; i < n * 1024; i++) {
- Buffer.allocUnsafeSlow(len);
- }
- bench.end(n);
+ fn = Buffer.allocUnsafeSlow;
break;
case 'slow':
- bench.start();
- for (let i = 0; i < n * 1024; i++) {
- SlowBuffer(len);
- }
- bench.end(n);
+ fn = SlowBuffer;
break;
case 'buffer()':
- bench.start();
- for (let i = 0; i < n * 1024; i++) {
- Buffer(len);
- }
- bench.end(n);
+ fn = Buffer;
break;
default:
- assert.fail(null, null, 'Should not get here');
+ assert.fail('Should not get here');
+ }
+
+ bench.start();
+ for (i = 0; i < n * 1024; i++) {
+ fn(len);
}
+ bench.end(n);
}
diff --git a/benchmark/buffers/buffer-hex.js b/benchmark/buffers/buffer-hex.js
index 1bdef81139f..4d87313961a 100644
--- a/benchmark/buffers/buffer-hex.js
+++ b/benchmark/buffers/buffer-hex.js
@@ -9,15 +9,16 @@ const bench = common.createBenchmark(main, {
function main({ len, n }) {
const buf = Buffer.alloc(len);
+ var i;
- for (let i = 0; i < buf.length; i++)
+ for (i = 0; i < buf.length; i++)
buf[i] = i & 0xff;
const hex = buf.toString('hex');
bench.start();
- for (let i = 0; i < n; i += 1)
+ for (i = 0; i < n; i += 1)
Buffer.from(hex, 'hex');
bench.end(n);
diff --git a/benchmark/buffers/buffer-iterate.js b/benchmark/buffers/buffer-iterate.js
index 8531e1cae82..7a275b0bcb8 100644
--- a/benchmark/buffers/buffer-iterate.js
+++ b/benchmark/buffers/buffer-iterate.js
@@ -20,36 +20,30 @@ function main({ size, type, method, n }) {
const clazz = type === 'fast' ? Buffer : SlowBuffer;
const buffer = new clazz(size);
buffer.fill(0);
- methods[method || 'for'](buffer, n);
-}
-
+ const fn = methods[method || 'for'];
-function benchFor(buffer, n) {
bench.start();
+ fn(buffer, n);
+ bench.end(n);
+}
+function benchFor(buffer, n) {
for (var k = 0; k < n; k++) {
for (var i = 0; i < buffer.length; i++) {
assert(buffer[i] === 0);
}
}
-
- bench.end(n);
}
function benchForOf(buffer, n) {
- bench.start();
-
for (var k = 0; k < n; k++) {
for (const b of buffer) {
assert(b === 0);
}
}
- bench.end(n);
}
function benchIterator(buffer, n) {
- bench.start();
-
for (var k = 0; k < n; k++) {
const iter = buffer[Symbol.iterator]();
var cur = iter.next();
@@ -60,6 +54,4 @@ function benchIterator(buffer, n) {
}
}
-
- bench.end(n);
}
diff --git a/benchmark/buffers/buffer-read-float.js b/benchmark/buffers/buffer-read-float.js
index 5dda2486c67..afd9edf5578 100644
--- a/benchmark/buffers/buffer-read-float.js
+++ b/benchmark/buffers/buffer-read-float.js
@@ -9,12 +9,10 @@ const bench = common.createBenchmark(main, {
millions: [1]
});
-function main(conf) {
- const noAssert = conf.noAssert === 'true';
- const len = +conf.millions * 1e6;
+function main({ noAssert, millions, type, endian, value }) {
+ noAssert = noAssert === 'true';
+ type = type || 'Double';
const buff = Buffer.alloc(8);
- const type = conf.type || 'Double';
- const endian = conf.endian;
const fn = `read${type}${endian}`;
const values = {
Double: {
@@ -32,15 +30,12 @@ function main(conf) {
nan: NaN,
},
};
- const value = values[type][conf.value];
- buff[`write${type}${endian}`](value, 0, noAssert);
- const testFunction = new Function('buff', `
- for (var i = 0; i !== ${len}; i++) {
- buff.${fn}(0, ${JSON.stringify(noAssert)});
- }
- `);
+ buff[`write${type}${endian}`](values[type][value], 0, noAssert);
+
bench.start();
- testFunction(buff);
- bench.end(len / 1e6);
+ for (var i = 0; i !== millions * 1e6; i++) {
+ buff[fn](0, noAssert);
+ }
+ bench.end(millions);
}
diff --git a/benchmark/buffers/buffer-read-with-byteLength.js b/benchmark/buffers/buffer-read-with-byteLength.js
index 2a659c1bec5..9fe5e6f4bf4 100644
--- a/benchmark/buffers/buffer-read-with-byteLength.js
+++ b/benchmark/buffers/buffer-read-with-byteLength.js
@@ -16,21 +16,17 @@ const bench = common.createBenchmark(main, {
byteLength: [1, 2, 4, 6]
});
-function main(conf) {
- const noAssert = conf.noAssert === 'true';
- const len = conf.millions * 1e6;
- const clazz = conf.buf === 'fast' ? Buffer : require('buffer').SlowBuffer;
+function main({ millions, noAssert, buf, type, byteLength }) {
+ noAssert = noAssert === 'true';
+ type = type || 'UInt8';
+ const clazz = buf === 'fast' ? Buffer : require('buffer').SlowBuffer;
const buff = new clazz(8);
- const type = conf.type || 'UInt8';
const fn = `read${type}`;
buff.writeDoubleLE(0, 0, noAssert);
- const testFunction = new Function('buff', `
- for (var i = 0; i !== ${len}; i++) {
- buff.${fn}(0, ${conf.byteLength}, ${JSON.stringify(noAssert)});
- }
- `);
bench.start();
- testFunction(buff);
- bench.end(len / 1e6);
+ for (var i = 0; i !== millions * 1e6; i++) {
+ buff[fn](0, byteLength, noAssert);
+ }
+ bench.end(millions);
}
diff --git a/benchmark/buffers/buffer-read.js b/benchmark/buffers/buffer-read.js
index 41e842f3123..868f5cede8b 100644
--- a/benchmark/buffers/buffer-read.js
+++ b/benchmark/buffers/buffer-read.js
@@ -27,18 +27,14 @@ const bench = common.createBenchmark(main, {
function main({ noAssert, millions, buf, type }) {
noAssert = noAssert === 'true';
- const len = millions * 1e6;
const clazz = buf === 'fast' ? Buffer : require('buffer').SlowBuffer;
const buff = new clazz(8);
const fn = `read${type || 'UInt8'}`;
buff.writeDoubleLE(0, 0, noAssert);
- const testFunction = new Function('buff', `
- for (var i = 0; i !== ${len}; i++) {
- buff.${fn}(0, ${JSON.stringify(noAssert)});
- }
- `);
bench.start();
- testFunction(buff);
- bench.end(len / 1e6);
+ for (var i = 0; i !== millions * 1e6; i++) {
+ buff[fn](0, noAssert);
+ }
+ bench.end(millions);
}
diff --git a/benchmark/buffers/buffer-write.js b/benchmark/buffers/buffer-write.js
index ce2fbe3103c..823e95bf15d 100644
--- a/benchmark/buffers/buffer-write.js
+++ b/benchmark/buffers/buffer-write.js
@@ -46,36 +46,29 @@ const mod = {
};
function main({ noAssert, millions, buf, type }) {
- const len = millions * 1e6;
const clazz = buf === 'fast' ? Buffer : require('buffer').SlowBuffer;
const buff = new clazz(8);
const fn = `write${type || 'UInt8'}`;
if (/Int/.test(fn))
- benchInt(buff, fn, len, noAssert);
+ benchInt(buff, fn, millions, noAssert);
else
- benchFloat(buff, fn, len, noAssert);
+ benchFloat(buff, fn, millions, noAssert);
}
-function benchInt(buff, fn, len, noAssert) {
+function benchInt(buff, fn, millions, noAssert) {
const m = mod[fn];
- const testFunction = new Function('buff', `
- for (var i = 0; i !== ${len}; i++) {
- buff.${fn}(i & ${m}, 0, ${noAssert});
- }
- `);
bench.start();
- testFunction(buff);
- bench.end(len / 1e6);
+ for (var i = 0; i !== millions * 1e6; i++) {
+ buff[fn](i & m, 0, noAssert);
+ }
+ bench.end(millions);
}
-function benchFloat(buff, fn, len, noAssert) {
- const testFunction = new Function('buff', `
- for (var i = 0; i !== ${len}; i++) {
- buff.${fn}(i, 0, ${noAssert});
- }
- `);
+function benchFloat(buff, fn, millions, noAssert) {
bench.start();
- testFunction(buff);
- bench.end(len / 1e6);
+ for (var i = 0; i !== millions * 1e6; i++) {
+ buff[fn](i, 0, noAssert);
+ }
+ bench.end(millions);
}
diff --git a/benchmark/buffers/buffer_zero.js b/benchmark/buffers/buffer_zero.js
index 06b68c313f1..1263732dce8 100644
--- a/benchmark/buffers/buffer_zero.js
+++ b/benchmark/buffers/buffer_zero.js
@@ -11,12 +11,9 @@ const zeroBuffer = Buffer.alloc(0);
const zeroString = '';
function main({ n, type }) {
- bench.start();
-
- if (type === 'buffer')
- for (let i = 0; i < n * 1024; i++) Buffer.from(zeroBuffer);
- else if (type === 'string')
- for (let i = 0; i < n * 1024; i++) Buffer.from(zeroString);
+ const data = type === 'buffer' ? zeroBuffer : zeroString;
+ bench.start();
+ for (var i = 0; i < n * 1024; i++) Buffer.from(data);
bench.end(n);
}
diff --git a/benchmark/crypto/aes-gcm-throughput.js b/benchmark/crypto/aes-gcm-throughput.js
index 246455de78a..5c1e71e7280 100644
--- a/benchmark/crypto/aes-gcm-throughput.js
+++ b/benchmark/crypto/aes-gcm-throughput.js
@@ -8,13 +8,13 @@ const bench = common.createBenchmark(main, {
len: [1024, 4 * 1024, 16 * 1024, 64 * 1024, 256 * 1024, 1024 * 1024]
});
-function main(conf) {
- const message = Buffer.alloc(conf.len, 'b');
- const key = crypto.randomBytes(keylen[conf.cipher]);
+function main({ n, len, cipher }) {
+ const message = Buffer.alloc(len, 'b');
+ const key = crypto.randomBytes(keylen[cipher]);
const iv = crypto.randomBytes(12);
const associate_data = Buffer.alloc(16, 'z');
bench.start();
- AEAD_Bench(conf.cipher, message, associate_data, key, iv, conf.n, conf.len);
+ AEAD_Bench(cipher, message, associate_data, key, iv, n, len);
}
function AEAD_Bench(cipher, message, associate_data, key, iv, n, len) {
diff --git a/benchmark/crypto/cipher-stream.js b/benchmark/crypto/cipher-stream.js
index ca36bd736d9..64f6ff7b729 100644
--- a/benchmark/crypto/cipher-stream.js
+++ b/benchmark/crypto/cipher-stream.js
@@ -9,8 +9,7 @@ const bench = common.createBenchmark(main, {
api: ['legacy', 'stream']
});
-function main(conf) {
- var api = conf.api;
+function main({ api, cipher, type, len, writes }) {
if (api === 'stream' && /^v0\.[0-8]\./.test(process.version)) {
console.error('Crypto streams not available until v0.10');
// use the legacy, just so that we can compare them.
@@ -33,25 +32,25 @@ function main(conf) {
// alice_secret and bob_secret should be the same
assert(alice_secret === bob_secret);
- const alice_cipher = crypto.createCipher(conf.cipher, alice_secret);
- const bob_cipher = crypto.createDecipher(conf.cipher, bob_secret);
+ const alice_cipher = crypto.createCipher(cipher, alice_secret);
+ const bob_cipher = crypto.createDecipher(cipher, bob_secret);
var message;
var encoding;
- switch (conf.type) {
+ switch (type) {
case 'asc':
- message = 'a'.repeat(conf.len);
+ message = 'a'.repeat(len);
encoding = 'ascii';
break;
case 'utf':
- message = 'ü'.repeat(conf.len / 2);
+ message = 'ü'.repeat(len / 2);
encoding = 'utf8';
break;
case 'buf':
- message = Buffer.alloc(conf.len, 'b');
+ message = Buffer.alloc(len, 'b');
break;
default:
- throw new Error(`unknown message type: ${conf.type}`);
+ throw new Error(`unknown message type: ${type}`);
}
const fn = api === 'stream' ? streamWrite : legacyWrite;
@@ -59,7 +58,7 @@ function main(conf) {
// write data as fast as possible to alice, and have bob decrypt.
// use old API for comparison to v0.8
bench.start();
- fn(alice_cipher, bob_cipher, message, encoding, conf.writes);
+ fn(alice_cipher, bob_cipher, message, encoding, writes);
}
function streamWrite(alice, bob, message, encoding, writes) {
diff --git a/benchmark/crypto/get-ciphers.js b/benchmark/crypto/get-ciphers.js
index 3f5ad17ad38..d4c10a2427d 100644
--- a/benchmark/crypto/get-ciphers.js
+++ b/benchmark/crypto/get-ciphers.js
@@ -7,12 +7,10 @@ const bench = common.createBenchmark(main, {
v: ['crypto', 'tls']
});
-function main(conf) {
- const n = +conf.n;
- const v = conf.v;
+function main({ n, v }) {
const method = require(v).getCiphers;
var i = 0;
- // first call to getChipers will dominate the results
+ // First call to getChipers will dominate the results
if (n > 1) {
for (; i < n; i++)
method();
diff --git a/benchmark/crypto/hash-stream-creation.js b/benchmark/crypto/hash-stream-creation.js
index 5ac5a4f70b5..faaa12a9e5d 100644
--- a/benchmark/crypto/hash-stream-creation.js
+++ b/benchmark/crypto/hash-stream-creation.js
@@ -13,8 +13,7 @@ const bench = common.createBenchmark(main, {
api: ['legacy', 'stream']
});
-function main(conf) {
- var api = conf.api;
+function main({ api, type, len, out, writes, algo }) {
if (api === 'stream' && /^v0\.[0-8]\./.test(process.version)) {
console.error('Crypto streams not available until v0.10');
// use the legacy, just so that we can compare them.
@@ -23,26 +22,26 @@ function main(conf) {
var message;
var encoding;
- switch (conf.type) {
+ switch (type) {
case 'asc':
- message = 'a'.repeat(conf.len);
+ message = 'a'.repeat(len);
encoding = 'ascii';
break;
case 'utf':
- message = 'ü'.repeat(conf.len / 2);
+ message = 'ü'.repeat(len / 2);
encoding = 'utf8';
break;
case 'buf':
- message = Buffer.alloc(conf.len, 'b');
+ message = Buffer.alloc(len, 'b');
break;
default:
- throw new Error(`unknown message type: ${conf.type}`);
+ throw new Error(`unknown message type: ${type}`);
}
const fn = api === 'stream' ? streamWrite : legacyWrite;
bench.start();
- fn(conf.algo, message, encoding, conf.writes, conf.len, conf.out);
+ fn(algo, message, encoding, writes, len, out);
}
function legacyWrite(algo, message, encoding, writes, len, outEnc) {
diff --git a/benchmark/crypto/hash-stream-throughput.js b/benchmark/crypto/hash-stream-throughput.js
index 21ec3c7902b..934e7a0b11b 100644
--- a/benchmark/crypto/hash-stream-throughput.js
+++ b/benchmark/crypto/hash-stream-throughput.js
@@ -12,8 +12,7 @@ const bench = common.createBenchmark(main, {
api: ['legacy', 'stream']
});
-function main(conf) {
- var api = conf.api;
+function main({ api, type, len, algo, writes }) {
if (api === 'stream' && /^v0\.[0-8]\./.test(process.version)) {
console.error('Crypto streams not available until v0.10');
// use the legacy, just so that we can compare them.
@@ -22,26 +21,26 @@ function main(conf) {
var message;
var encoding;
- switch (conf.type) {
+ switch (type) {
case 'asc':
- message = 'a'.repeat(conf.len);
+ message = 'a'.repeat(len);
encoding = 'ascii';
break;
case 'utf':
- message = 'ü'.repeat(conf.len / 2);
+ message = 'ü'.repeat(len / 2);
encoding = 'utf8';
break;
case 'buf':
- message = Buffer.alloc(conf.len, 'b');
+ message = Buffer.alloc(len, 'b');
break;
default:
- throw new Error(`unknown message type: ${conf.type}`);
+ throw new Error(`unknown message type: ${type}`);
}
const fn = api === 'stream' ? streamWrite : legacyWrite;
bench.start();
- fn(conf.algo, message, encoding, conf.writes, conf.len);
+ fn(algo, message, encoding, writes, len);
}
function legacyWrite(algo, message, encoding, writes, len) {
diff --git a/benchmark/crypto/rsa-encrypt-decrypt-throughput.js b/benchmark/crypto/rsa-encrypt-decrypt-throughput.js
index edab5ae08f7..40b69c31f97 100644
--- a/benchmark/crypto/rsa-encrypt-decrypt-throughput.js
+++ b/benchmark/crypto/rsa-encrypt-decrypt-throughput.js
@@ -22,10 +22,10 @@ const bench = common.createBenchmark(main, {
len: [16, 32, 64]
});
-function main(conf) {
- const message = Buffer.alloc(conf.len, 'b');
+function main({ len, algo, keylen, n }) {
+ const message = Buffer.alloc(len, 'b');
bench.start();
- StreamWrite(conf.algo, conf.keylen, message, conf.n, conf.len);
+ StreamWrite(algo, keylen, message, n, len);
}
function StreamWrite(algo, keylen, message, n, len) {
diff --git a/benchmark/crypto/rsa-sign-verify-throughput.js b/benchmark/crypto/rsa-sign-verify-throughput.js
index bcde3a43d4d..3a0373b57d0 100644
--- a/benchmark/crypto/rsa-sign-verify-throughput.js
+++ b/benchmark/crypto/rsa-sign-verify-throughput.js
@@ -23,10 +23,10 @@ const bench = common.createBenchmark(main, {
len: [1024, 102400, 2 * 102400, 3 * 102400, 1024 * 1024]
});
-function main(conf) {
- const message = Buffer.alloc(conf.len, 'b');
+function main({ len, algo, keylen, writes }) {
+ const message = Buffer.alloc(len, 'b');
bench.start();
- StreamWrite(conf.algo, conf.keylen, message, conf.writes, conf.len);
+ StreamWrite(algo, keylen, message, writes, len);
}
function StreamWrite(algo, keylen, message, writes, len) {
diff --git a/benchmark/dgram/bind-params.js b/benchmark/dgram/bind-params.js
index 5f7999f7a39..ea1f430eed9 100644
--- a/benchmark/dgram/bind-params.js
+++ b/benchmark/dgram/bind-params.js
@@ -15,10 +15,11 @@ const noop = () => {};
function main({ n, port, address }) {
port = port === 'true' ? 0 : undefined;
address = address === 'true' ? '0.0.0.0' : undefined;
+ var i;
if (port !== undefined && address !== undefined) {
bench.start();
- for (let i = 0; i < n; i++) {
+ for (i = 0; i < n; i++) {
dgram.createSocket('udp4').bind(port, address)
.on('error', noop)
.unref();
@@ -26,7 +27,7 @@ function main({ n, port, address }) {
bench.end(n);
} else if (port !== undefined) {
bench.start();
- for (let i = 0; i < n; i++) {
+ for (i = 0; i < n; i++) {
dgram.createSocket('udp4')
.bind(port)
.on('error', noop)
@@ -35,7 +36,7 @@ function main({ n, port, address }) {
bench.end(n);
} else if (port === undefined && address === undefined) {
bench.start();
- for (let i = 0; i < n; i++) {
+ for (i = 0; i < n; i++) {
dgram.createSocket('udp4')
.bind()
.on('error', noop)
diff --git a/benchmark/domain/domain-fn-args.js b/benchmark/domain/domain-fn-args.js
index fe912e34d20..c889b35442d 100644
--- a/benchmark/domain/domain-fn-args.js
+++ b/benchmark/domain/domain-fn-args.js
@@ -28,15 +28,6 @@ function main({ n, args }) {
bench.end(n);
}
-function fn(a, b, c) {
- if (!a)
- a = 1;
-
- if (!b)
- b = 2;
-
- if (!c)
- c = 3;
-
+function fn(a = 1, b = 2, c = 3) {
return a + b + c;
}
diff --git a/benchmark/es/defaultparams-bench.js b/benchmark/es/defaultparams-bench.js
index ce2132718ca..a00b50137c1 100644
--- a/benchmark/es/defaultparams-bench.js
+++ b/benchmark/es/defaultparams-bench.js
@@ -20,37 +20,31 @@ function defaultParams(x = 1, y = 2) {
assert.strictEqual(y, 2);
}
-function runOldStyleDefaults(n) {
-
- var i = 0;
+function runOldStyleDefaults(millions) {
bench.start();
- for (; i < n; i++)
+ for (var i = 0; i < millions * 1e6; i++)
oldStyleDefaults();
- bench.end(n / 1e6);
+ bench.end(millions);
}
-function runDefaultParams(n) {
-
- var i = 0;
+function runDefaultParams(millions) {
bench.start();
- for (; i < n; i++)
+ for (var i = 0; i < millions * 1e6; i++)
defaultParams();
- bench.end(n / 1e6);
+ bench.end(millions);
}
function main({ millions, method }) {
- const n = millions * 1e6;
-
switch (method) {
case '':
// Empty string falls through to next line as default, mostly for tests.
case 'withoutdefaults':
- runOldStyleDefaults(n);
+ runOldStyleDefaults(millions);
break;
case 'withdefaults':
- runDefaultParams(n);
+ runDefaultParams(millions);
break;
default:
- throw new Error('Unexpected method');
+ throw new Error(`Unexpected method "${method}"`);
}
}
diff --git a/benchmark/es/destructuring-bench.js b/benchmark/es/destructuring-bench.js
index f244506860d..2168940bdc4 100644
--- a/benchmark/es/destructuring-bench.js
+++ b/benchmark/es/destructuring-bench.js
@@ -8,10 +8,10 @@ const bench = common.createBenchmark(main, {
millions: [100]
});
-function runSwapManual(n) {
+function runSwapManual(millions) {
var x, y, r;
bench.start();
- for (var i = 0; i < n; i++) {
+ for (var i = 0; i < millions * 1e6; i++) {
x = 1, y = 2;
r = x;
x = y;
@@ -19,34 +19,32 @@ function runSwapManual(n) {
assert.strictEqual(x, 2);
assert.strictEqual(y, 1);
}
- bench.end(n / 1e6);
+ bench.end(millions);
}
-function runSwapDestructured(n) {
+function runSwapDestructured(millions) {
var x, y;
bench.start();
- for (var i = 0; i < n; i++) {
+ for (var i = 0; i < millions * 1e6; i++) {
x = 1, y = 2;
[x, y] = [y, x];
assert.strictEqual(x, 2);
assert.strictEqual(y, 1);
}
- bench.end(n / 1e6);
+ bench.end(millions);
}
function main({ millions, method }) {
- const n = millions * 1e6;
-
switch (method) {
case '':
// Empty string falls through to next line as default, mostly for tests.
case 'swap':
- runSwapManual(n);
+ runSwapManual(millions);
break;
case 'destructure':
- runSwapDestructured(n);
+ runSwapDestructured(millions);
break;
default:
- throw new Error('Unexpected method');
+ throw new Error(`Unexpected method "${method}"`);
}
}
diff --git a/benchmark/es/destructuring-object-bench.js b/benchmark/es/destructuring-object-bench.js
index 73687f018de..a84977c59bc 100644
--- a/benchmark/es/destructuring-object-bench.js
+++ b/benchmark/es/destructuring-object-bench.js
@@ -7,45 +7,43 @@ const bench = common.createBenchmark(main, {
millions: [100]
});
-function runNormal(n) {
+function runNormal(millions) {
var i = 0;
const o = { x: 0, y: 1 };
bench.start();
- for (; i < n; i++) {
+ for (; i < millions * 1e6; i++) {
/* eslint-disable no-unused-vars */
const x = o.x;
const y = o.y;
const r = o.r || 2;
/* eslint-enable no-unused-vars */
}
- bench.end(n / 1e6);
+ bench.end(millions);
}
-function runDestructured(n) {
+function runDestructured(millions) {
var i = 0;
const o = { x: 0, y: 1 };
bench.start();
- for (; i < n; i++) {
+ for (; i < millions * 1e6; i++) {
/* eslint-disable no-unused-vars */
const { x, y, r = 2 } = o;
/* eslint-enable no-unused-vars */
}
- bench.end(n / 1e6);
+ bench.end(millions);
}
function main({ millions, method }) {
- const n = millions * 1e6;
-
switch (method) {
case '':
// Empty string falls through to next line as default, mostly for tests.
case 'normal':
- runNormal(n);
+ runNormal(millions);
break;
case 'destructureObject':
- runDestructured(n);
+ runDestructured(millions);
break;
default:
- throw new Error('Unexpected method');
+ throw new Error(`Unexpected method "${method}"`);
}
}
diff --git a/benchmark/es/foreach-bench.js b/benchmark/es/foreach-bench.js
index c7caa7cee6f..e9179ed8ded 100644
--- a/benchmark/es/foreach-bench.js
+++ b/benchmark/es/foreach-bench.js
@@ -8,56 +8,51 @@ const bench = common.createBenchmark(main, {
millions: [5]
});
-function useFor(n, items, count) {
- var i, j;
+function useFor(millions, items, count) {
bench.start();
- for (i = 0; i < n; i++) {
- for (j = 0; j < count; j++) {
+ for (var i = 0; i < millions * 1e6; i++) {
+ for (var j = 0; j < count; j++) {
/* eslint-disable no-unused-vars */
const item = items[j];
/* esline-enable no-unused-vars */
}
}
- bench.end(n / 1e6);
+ bench.end(millions);
}
-function useForOf(n, items) {
- var i, item;
+function useForOf(millions, items) {
+ var item;
bench.start();
- for (i = 0; i < n; i++) {
+ for (var i = 0; i < millions * 1e6; i++) {
for (item of items) {}
}
- bench.end(n / 1e6);
+ bench.end(millions);
}
-function useForIn(n, items) {
- var i, j, item;
+function useForIn(millions, items) {
bench.start();
- for (i = 0; i < n; i++) {
- for (j in items) {
+ for (var i = 0; i < millions * 1e6; i++) {
+ for (var j in items) {
/* eslint-disable no-unused-vars */
- item = items[j];
+ const item = items[j];
/* esline-enable no-unused-vars */
}
}
- bench.end(n / 1e6);
+ bench.end(millions);
}
-function useForEach(n, items) {
- var i;
+function useForEach(millions, items) {
bench.start();
- for (i = 0; i < n; i++) {
+ for (var i = 0; i < millions * 1e6; i++) {
items.forEach((item) => {});
}
- bench.end(n / 1e6);
+ bench.end(millions);
}
function main({ millions, count, method }) {
- const n = millions * 1e6;
const items = new Array(count);
- var i;
var fn;
- for (i = 0; i < count; i++)
+ for (var i = 0; i < count; i++)
items[i] = i;
switch (method) {
@@ -76,7 +71,7 @@ function main({ millions, count, method }) {
fn = useForEach;
break;
default:
- throw new Error('Unexpected method');
+ throw new Error(`Unexpected method "${method}"`);
}
- fn(n, items, count);
+ fn(millions, items, count);
}
diff --git a/benchmark/es/map-bench.js b/benchmark/es/map-bench.js
index ba8e35c2eb9..445031aa983 100644
--- a/benchmark/es/map-bench.js
+++ b/benchmark/es/map-bench.js
@@ -11,63 +11,59 @@ const bench = common.createBenchmark(main, {
millions: [1]
});
-function runObject(n) {
+function runObject(millions) {
const m = {};
- var i = 0;
bench.start();
- for (; i < n; i++) {
+ for (var i = 0; i < millions * 1e6; i++) {
m[`i${i}`] = i;
m[`s${i}`] = String(i);
assert.strictEqual(String(m[`i${i}`]), m[`s${i}`]);
m[`i${i}`] = undefined;
m[`s${i}`] = undefined;
}
- bench.end(n / 1e6);
+ bench.end(millions);
}
-function runNullProtoObject(n) {
+function runNullProtoObject(millions) {
const m = Object.create(null);
- var i = 0;
bench.start();
- for (; i < n; i++) {
+ for (var i = 0; i < millions * 1e6; i++) {
m[`i${i}`] = i;
m[`s${i}`] = String(i);
assert.strictEqual(String(m[`i${i}`]), m[`s${i}`]);
m[`i${i}`] = undefined;
m[`s${i}`] = undefined;
}
- bench.end(n / 1e6);
+ bench.end(millions);
}
-function runNullProtoLiteralObject(n) {
+function runNullProtoLiteralObject(millions) {
const m = { __proto__: null };
- var i = 0;
bench.start();
- for (; i < n; i++) {
+ for (var i = 0; i < millions * 1e6; i++) {
m[`i${i}`] = i;
m[`s${i}`] = String(i);
assert.strictEqual(String(m[`i${i}`]), m[`s${i}`]);
m[`i${i}`] = undefined;
m[`s${i}`] = undefined;
}
- bench.end(n / 1e6);
+ bench.end(millions);
}
function StorageObject() {}
StorageObject.prototype = Object.create(null);
-function runStorageObject(n) {
+function runStorageObject(millions) {
const m = new StorageObject();
- var i = 0;
bench.start();
- for (; i < n; i++) {
+ for (var i = 0; i < millions * 1e6; i++) {
m[`i${i}`] = i;
m[`s${i}`] = String(i);
assert.strictEqual(String(m[`i${i}`]), m[`s${i}`]);
m[`i${i}`] = undefined;
m[`s${i}`] = undefined;
}
- bench.end(n / 1e6);
+ bench.end(millions);
}
function fakeMap() {
@@ -80,59 +76,55 @@ function fakeMap() {
};
}
-function runFakeMap(n) {
+function runFakeMap(millions) {
const m = fakeMap();
- var i = 0;
bench.start();
- for (; i < n; i++) {
+ for (var i = 0; i < millions * 1e6; i++) {
m.set(`i${i}`, i);
m.set(`s${i}`, String(i));
assert.strictEqual(String(m.get(`i${i}`)), m.get(`s${i}`));
m.set(`i${i}`, undefined);
m.set(`s${i}`, undefined);
}
- bench.end(n / 1e6);
+ bench.end(millions);
}
-function runMap(n) {
+function runMap(millions) {
const m = new Map();
- var i = 0;
bench.start();
- for (; i < n; i++) {
+ for (var i = 0; i < millions * 1e6; i++) {
m.set(`i${i}`, i);
m.set(`s${i}`, String(i));
assert.strictEqual(String(m.get(`i${i}`)), m.get(`s${i}`));
m.set(`i${i}`, undefined);
m.set(`s${i}`, undefined);
}
- bench.end(n / 1e6);
+ bench.end(millions);
}
function main({ millions, method }) {
- const n = millions * 1e6;
-
switch (method) {
case '':
// Empty string falls through to next line as default, mostly for tests.
case 'object':
- runObject(n);
+ runObject(millions);
break;
case 'nullProtoObject':
- runNullProtoObject(n);
+ runNullProtoObject(millions);
break;
case 'nullProtoLiteralObject':
- runNullProtoLiteralObject(n);
+ runNullProtoLiteralObject(millions);
break;
case 'storageObject':
- runStorageObject(n);
+ runStorageObject(millions);
break;
case 'fakeMap':
- runFakeMap(n);
+ runFakeMap(millions);
break;
case 'map':
- runMap(n);
+ runMap(millions);
break;
default:
- throw new Error('Unexpected method');
+ throw new Error(`Unexpected method "${method}"`);
}
}
diff --git a/benchmark/es/restparams-bench.js b/benchmark/es/restparams-bench.js
index 78299d292ce..6ad766f10f1 100644
--- a/benchmark/es/restparams-bench.js
+++ b/benchmark/es/restparams-bench.js
@@ -33,49 +33,39 @@ function useArguments() {
assert.strictEqual(arguments[3], 'b');
}
-function runCopyArguments(n) {
-
- var i = 0;
- bench.start();
- for (; i < n; i++)
+function runCopyArguments(millions) {
+ for (var i = 0; i < millions * 1e6; i++)
copyArguments(1, 2, 'a', 'b');
- bench.end(n / 1e6);
}
-function runRestArguments(n) {
-
- var i = 0;
- bench.start();
- for (; i < n; i++)
+function runRestArguments(millions) {
+ for (var i = 0; i < millions * 1e6; i++)
restArguments(1, 2, 'a', 'b');
- bench.end(n / 1e6);
}
-function runUseArguments(n) {
-
- var i = 0;
- bench.start();
- for (; i < n; i++)
+function runUseArguments(millions) {
+ for (var i = 0; i < millions * 1e6; i++)
useArguments(1, 2, 'a', 'b');
- bench.end(n / 1e6);
}
function main({ millions, method }) {
- const n = millions * 1e6;
-
+ var fn;
switch (method) {
case '':
// Empty string falls through to next line as default, mostly for tests.
case 'copy':
- runCopyArguments(n);
+ fn = runCopyArguments;
break;
case 'rest':
- runRestArguments(n);
+ fn = runRestArguments;
break;
case 'arguments':
- runUseArguments(n);
+ fn = runUseArguments;
break;
default:
- throw new Error('Unexpected method');
+ throw new Error(`Unexpected method "${method}"`);
}
+ bench.start();
+ fn(millions);
+ bench.end(millions);
}
diff --git a/benchmark/es/spread-assign.js b/benchmark/es/spread-assign.js
new file mode 100644
index 00000000000..00c634ff879
--- /dev/null
+++ b/benchmark/es/spread-assign.js
@@ -0,0 +1,46 @@
+'use strict';
+
+const common = require('../common.js');
+const util = require('util');
+
+const bench = common.createBenchmark(main, {
+ method: ['spread', 'assign', '_extend'],
+ count: [5, 10, 20],
+ millions: [1]
+});
+
+function main({ millions, context, count, rest, method }) {
+ const n = millions * 1e6;
+
+ const src = {};
+ for (let n = 0; n < count; n++)
+ src[`p${n}`] = n;
+
+ let obj; // eslint-disable-line
+ let i;
+
+ switch (method) {
+ case '':
+ // Empty string falls through to next line as default, mostly for tests.
+ case '_extend':
+ bench.start();
+ for (i = 0; i < n; i++)
+ obj = util._extend({}, src);
+ bench.end(n);
+ break;
+ case 'assign':
+ bench.start();
+ for (i = 0; i < n; i++)
+ obj = Object.assign({}, src);
+ bench.end(n);
+ break;
+ case 'spread':
+ bench.start();
+ for (i = 0; i < n; i++)
+ obj = { ...src };
+ bench.end(n);
+ break;
+ default:
+ throw new Error('Unexpected method');
+ }
+}
diff --git a/benchmark/es/spread-bench.js b/benchmark/es/spread-bench.js
index 3c6cc93ea4f..067299cd650 100644
--- a/benchmark/es/spread-bench.js
+++ b/benchmark/es/spread-bench.js
@@ -24,7 +24,6 @@ function makeTest(count, rest) {
}
function main({ millions, context, count, rest, method }) {
- const n = millions * 1e6;
const ctx = context === 'context' ? {} : null;
var fn = makeTest(count, rest);
const args = new Array(count);
@@ -37,25 +36,25 @@ function main({ millions, context, count, rest, method }) {
// Empty string falls through to next line as default, mostly for tests.
case 'apply':
bench.start();
- for (i = 0; i < n; i++)
+ for (i = 0; i < millions * 1e6; i++)
fn.apply(ctx, args);
- bench.end(n / 1e6);
+ bench.end(millions);
break;
case 'spread':
if (ctx !== null)
fn = fn.bind(ctx);
bench.start();
- for (i = 0; i < n; i++)
+ for (i = 0; i < millions * 1e6; i++)
fn(...args);
- bench.end(n / 1e6);
+ bench.end(millions);
break;
case 'call-spread':
bench.start();
- for (i = 0; i < n; i++)
+ for (i = 0; i < millions * 1e6; i++)
fn.call(ctx, ...args);
- bench.end(n / 1e6);
+ bench.end(millions);
break;
default:
- throw new Error('Unexpected method');
+ throw new Error(`Unexpected method "${method}"`);
}
}
diff --git a/benchmark/es/string-concatenations.js b/benchmark/es/string-concatenations.js
index a40b7fa8c3b..72fb7f9969b 100644
--- a/benchmark/es/string-concatenations.js
+++ b/benchmark/es/string-concatenations.js
@@ -16,7 +16,6 @@ const configs = {
const bench = common.createBenchmark(main, configs);
-
function main({ n, mode }) {
const str = 'abc';
const num = 123;
@@ -63,7 +62,7 @@ function main({ n, mode }) {
bench.end(n);
break;
default:
- throw new Error('Unexpected method');
+ throw new Error(`Unexpected method "${mode}"`);
}
return string;
diff --git a/benchmark/es/string-repeat.js b/benchmark/es/string-repeat.js
index e5bdbb5cc19..9e33e4acf47 100644
--- a/benchmark/es/string-repeat.js
+++ b/benchmark/es/string-repeat.js
@@ -33,7 +33,7 @@ function main({ n, size, encoding, mode }) {
bench.end(n);
break;
default:
- throw new Error('Unexpected method');
+ throw new Error(`Unexpected method "${mode}"`);
}
assert.strictEqual([...str].length, size);
diff --git a/benchmark/fs/bench-realpath.js b/benchmark/fs/bench-realpath.js
index 6690d7e87b0..de03e71b42d 100644
--- a/benchmark/fs/bench-realpath.js
+++ b/benchmark/fs/bench-realpath.js
@@ -16,10 +16,8 @@ function main({ n, pathType }) {
bench.start();
if (pathType === 'relative')
relativePath(n);
- else if (pathType === 'resolved')
- resolvedPath(n);
else
- throw new Error(`unknown "pathType": ${pathType}`);
+ resolvedPath(n);
}
function relativePath(n) {
diff --git a/benchmark/fs/bench-realpathSync.js b/benchmark/fs/bench-realpathSync.js
index 1c751156f73..7a01bd18cb7 100644
--- a/benchmark/fs/bench-realpathSync.js
+++ b/benchmark/fs/bench-realpathSync.js
@@ -15,24 +15,10 @@ const bench = common.createBenchmark(main, {
function main({ n, pathType }) {
+ const path = pathType === 'relative' ? relative_path : resolved_path;
bench.start();
- if (pathType === 'relative')
- relativePath(n);
- else if (pathType === 'resolved')
- resolvedPath(n);
- else
- throw new Error(`unknown "pathType": ${pathType}`);
- bench.end(n);
-}
-
-function relativePath(n) {
- for (var i = 0; i < n; i++) {
- fs.realpathSync(relative_path);
- }
-}
-
-function resolvedPath(n) {
for (var i = 0; i < n; i++) {
- fs.realpathSync(resolved_path);
+ fs.realpathSync(path);
}
+ bench.end(n);
}
diff --git a/benchmark/fs/readfile-partitioned.js b/benchmark/fs/readfile-partitioned.js
new file mode 100644
index 00000000000..be3b7fd057b
--- /dev/null
+++ b/benchmark/fs/readfile-partitioned.js
@@ -0,0 +1,86 @@
+// Submit a mix of short and long jobs to the threadpool.
+// Report total job throughput.
+// If we partition the long job, overall job throughput goes up significantly.
+// However, this comes at the cost of the long job throughput.
+//
+// Short jobs: small zip jobs.
+// Long jobs: fs.readFile on a large file.
+
+'use strict';
+
+const path = require('path');
+const common = require('../common.js');
+const filename = path.resolve(__dirname,
+ `.removeme-benchmark-garbage-${process.pid}`);
+const fs = require('fs');
+const zlib = require('zlib');
+const assert = require('assert');
+
+const bench = common.createBenchmark(main, {
+ dur: [5],
+ len: [1024, 16 * 1024 * 1024],
+ concurrent: [1, 10]
+});
+
+function main(conf) {
+ const len = +conf.len;
+ try { fs.unlinkSync(filename); } catch (e) {}
+ var data = Buffer.alloc(len, 'x');
+ fs.writeFileSync(filename, data);
+ data = null;
+
+ var zipData = Buffer.alloc(1024, 'a');
+
+ var reads = 0;
+ var zips = 0;
+ var benchEnded = false;
+ bench.start();
+ setTimeout(function() {
+ const totalOps = reads + zips;
+ benchEnded = true;
+ bench.end(totalOps);
+ try { fs.unlinkSync(filename); } catch (e) {}
+ }, +conf.dur * 1000);
+
+ function read() {
+ fs.readFile(filename, afterRead);
+ }
+
+ function afterRead(er, data) {
+ if (er) {
+ if (er.code === 'ENOENT') {
+ // Only OK if unlinked by the timer from main.
+ assert.ok(benchEnded);
+ return;
+ }
+ throw er;
+ }
+
+ if (data.length !== len)
+ throw new Error('wrong number of bytes returned');
+
+ reads++;
+ if (!benchEnded)
+ read();
+ }
+
+ function zip() {
+ zlib.deflate(zipData, afterZip);
+ }
+
+ function afterZip(er, data) {
+ if (er)
+ throw er;
+
+ zips++;
+ if (!benchEnded)
+ zip();
+ }
+
+ // Start reads
+ var cur = +conf.concurrent;
+ while (cur--) read();
+
+ // Start a competing zip
+ zip();
+}
diff --git a/benchmark/fs/readfile.js b/benchmark/fs/readfile.js
index 7da7758ed06..282b4ac7621 100644
--- a/benchmark/fs/readfile.js
+++ b/benchmark/fs/readfile.js
@@ -8,6 +8,7 @@ const common = require('../common.js');
const filename = path.resolve(process.env.NODE_TMPDIR || __dirname,
`.removeme-benchmark-garbage-${process.pid}`);
const fs = require('fs');
+const assert = require('assert');
const bench = common.createBenchmark(main, {
dur: [5],
@@ -22,10 +23,10 @@ function main({ len, dur, concurrent }) {
data = null;
var reads = 0;
- var bench_ended = false;
+ var benchEnded = false;
bench.start();
setTimeout(function() {
- bench_ended = true;
+ benchEnded = true;
bench.end(reads);
try { fs.unlinkSync(filename); } catch (e) {}
process.exit(0);
@@ -36,14 +37,20 @@ function main({ len, dur, concurrent }) {
}
function afterRead(er, data) {
- if (er)
+ if (er) {
+ if (er.code === 'ENOENT') {
+ // Only OK if unlinked by the timer from main.
+ assert.ok(benchEnded);
+ return;
+ }
throw er;
+ }
if (data.length !== len)
throw new Error('wrong number of bytes returned');
reads++;
- if (!bench_ended)
+ if (!benchEnded)
read();
}
diff --git a/benchmark/fs/write-stream-throughput.js b/benchmark/fs/write-stream-throughput.js
index 6fe00cde48c..60ad47bc4ea 100644
--- a/benchmark/fs/write-stream-throughput.js
+++ b/benchmark/fs/write-stream-throughput.js
@@ -36,7 +36,6 @@ function main({ dur, encodingType, size }) {
try { fs.unlinkSync(filename); } catch (e) {}
var started = false;
- var ending = false;
var ended = false;
var f = fs.createWriteStream(filename);
@@ -52,15 +51,9 @@ function main({ dur, encodingType, size }) {
function write() {
- // don't try to write after we end, even if a 'drain' event comes.
- // v0.8 streams are so sloppy!
- if (ending)
- return;
-
if (!started) {
started = true;
setTimeout(function() {
- ending = true;
f.end();
}, dur * 1000);
bench.start();
diff --git a/benchmark/http/bench-parser.js b/benchmark/http/bench-parser.js
index 4c691d71345..d629fe67e59 100644
--- a/benchmark/http/bench-parser.js
+++ b/benchmark/http/bench-parser.js
@@ -14,7 +14,6 @@ const bench = common.createBenchmark(main, {
n: [1e5],
});
-
function main({ len, n }) {
var header = `GET /hello HTTP/1.1${CRLF}Content-Type: text/plain${CRLF}`;
@@ -26,7 +25,6 @@ function main({ len, n }) {
processHeader(Buffer.from(header), n);
}
-
function processHeader(header, n) {
const parser = newParser(REQUEST);
@@ -38,7 +36,6 @@ function processHeader(header, n) {
bench.end(n);
}
-
function newParser(type) {
const parser = new HTTPParser(type);
diff --git a/benchmark/http/check_invalid_header_char.js b/benchmark/http/check_invalid_header_char.js
index b9933d690e2..399e71b2dfc 100644
--- a/benchmark/http/check_invalid_header_char.js
+++ b/benchmark/http/check_invalid_header_char.js
@@ -3,6 +3,10 @@
const common = require('../common.js');
const _checkInvalidHeaderChar = require('_http_common')._checkInvalidHeaderChar;
+// Put it here so the benchmark result lines will not be super long.
+const LONG_AND_INVALID = 'Here is a value that is really a folded header ' +
+ 'value\r\n this should be supported, but it is not currently';
+
const bench = common.createBenchmark(main, {
key: [
// Valid
@@ -21,8 +25,7 @@ const bench = common.createBenchmark(main, {
'en-US',
// Invalid
- 'Here is a value that is really a folded header value\r\n this should be \
- supported, but it is not currently',
+ 'LONG_AND_INVALID',
'中文呢', // unicode
'foo\nbar',
'\x7F'
@@ -31,6 +34,9 @@ const bench = common.createBenchmark(main, {
});
function main({ n, key }) {
+ if (key === 'LONG_AND_INVALID') {
+ key = LONG_AND_INVALID;
+ }
bench.start();
for (var i = 0; i < n; i++) {
_checkInvalidHeaderChar(key);
diff --git a/benchmark/http/http_server_for_chunky_client.js b/benchmark/http/http_server_for_chunky_client.js
index f079544e03d..1e5a4583669 100644
--- a/benchmark/http/http_server_for_chunky_client.js
+++ b/benchmark/http/http_server_for_chunky_client.js
@@ -2,22 +2,15 @@
const assert = require('assert');
const http = require('http');
-const fs = require('fs');
const { fork } = require('child_process');
const common = require('../common.js');
-const { PIPE, tmpDir } = require('../../test/common');
+const { PIPE } = require('../../test/common');
+const tmpdir = require('../../test/common/tmpdir');
process.env.PIPE_NAME = PIPE;
-try {
- fs.accessSync(tmpDir, fs.F_OK);
-} catch (e) {
- fs.mkdirSync(tmpDir);
-}
+tmpdir.refresh();
var server;
-try {
- fs.unlinkSync(process.env.PIPE_NAME);
-} catch (e) { /* ignore */ }
server = http.createServer(function(req, res) {
const headers = {
diff --git a/benchmark/http/set-header.js b/benchmark/http/set-header.js
new file mode 100644
index 00000000000..f0987f2cc77
--- /dev/null
+++ b/benchmark/http/set-header.js
@@ -0,0 +1,32 @@
+'use strict';
+const common = require('../common.js');
+const PORT = common.PORT;
+
+const bench = common.createBenchmark(main, {
+ res: ['normal', 'setHeader', 'setHeaderWH']
+});
+
+const type = 'bytes';
+const len = 4;
+const chunks = 0;
+const chunkedEnc = 0;
+const c = 50;
+
+// normal: writeHead(status, {...})
+// setHeader: statusCode = status, setHeader(...) x2
+// setHeaderWH: setHeader(...), writeHead(status, ...)
+function main({ res }) {
+ process.env.PORT = PORT;
+ var server = require('../fixtures/simple-http-server.js')
+ .listen(PORT)
+ .on('listening', function() {
+ const path = `/${type}/${len}/${chunks}/normal/${chunkedEnc}`;
+
+ bench.http({
+ path: path,
+ connections: c
+ }, function() {
+ server.close();
+ });
+ });
+}
diff --git a/benchmark/http/simple.js b/benchmark/http/simple.js
index d5351815fc1..6d1851c45e1 100644
--- a/benchmark/http/simple.js
+++ b/benchmark/http/simple.js
@@ -1,6 +1,5 @@
'use strict';
const common = require('../common.js');
-const PORT = common.PORT;
const bench = common.createBenchmark(main, {
// unicode confuses ab on os x.
@@ -8,16 +7,14 @@ const bench = common.createBenchmark(main, {
len: [4, 1024, 102400],
chunks: [1, 4],
c: [50, 500],
- chunkedEnc: [1, 0],
- res: ['normal', 'setHeader', 'setHeaderWH']
+ chunkedEnc: [1, 0]
});
function main({ type, len, chunks, c, chunkedEnc, res }) {
- process.env.PORT = PORT;
var server = require('../fixtures/simple-http-server.js')
- .listen(PORT)
+ .listen(common.PORT)
.on('listening', function() {
- const path = `/${type}/${len}/${chunks}/${res}/${chunkedEnc}`;
+ const path = `/${type}/${len}/${chunks}/normal/${chunkedEnc}`;
bench.http({
path: path,
diff --git a/benchmark/http/upgrade.js b/benchmark/http/upgrade.js
index 0feaecc8ff1..6b39323396a 100644
--- a/benchmark/http/upgrade.js
+++ b/benchmark/http/upgrade.js
@@ -1,7 +1,6 @@
'use strict';
const common = require('../common.js');
-const PORT = common.PORT;
const net = require('net');
const bench = common.createBenchmark(main, {
@@ -20,7 +19,6 @@ const resData = 'HTTP/1.1 101 Web Socket Protocol Handshake\r\n' +
'\r\n\r\n';
function main({ n }) {
- process.env.PORT = PORT;
var server = require('../fixtures/simple-http-server.js')
.listen(common.PORT)
.on('listening', function() {
diff --git a/benchmark/http2/respond-with-fd.js b/benchmark/http2/respond-with-fd.js
index 6076cf91be9..fa7b2fbd16b 100644
--- a/benchmark/http2/respond-with-fd.js
+++ b/benchmark/http2/respond-with-fd.js
@@ -1,7 +1,6 @@
'use strict';
const common = require('../common.js');
-const PORT = common.PORT;
const path = require('path');
const fs = require('fs');
@@ -25,7 +24,7 @@ function main({ requests, streams, clients }) {
stream.respondWithFD(fd);
stream.on('error', (err) => {});
});
- server.listen(PORT, () => {
+ server.listen(common.PORT, () => {
bench.http({
path: '/',
requests,
diff --git a/benchmark/http2/simple.js b/benchmark/http2/simple.js
index 37c78d34018..cf017e67354 100644
--- a/benchmark/http2/simple.js
+++ b/benchmark/http2/simple.js
@@ -1,11 +1,8 @@
'use strict';
const common = require('../common.js');
-const PORT = common.PORT;
-
const path = require('path');
const fs = require('fs');
-
const file = path.join(path.resolve(__dirname, '../fixtures'), 'alice.html');
const bench = common.createBenchmark(main, {
@@ -24,7 +21,7 @@ function main({ requests, streams, clients }) {
out.pipe(stream);
stream.on('error', (err) => {});
});
- server.listen(PORT, () => {
+ server.listen(common.PORT, () => {
bench.http({
path: '/',
requests,
diff --git a/benchmark/http2/write.js b/benchmark/http2/write.js
index 7a802ef84fd..6fcb1254ca3 100644
--- a/benchmark/http2/write.js
+++ b/benchmark/http2/write.js
@@ -1,7 +1,6 @@
'use strict';
const common = require('../common.js');
-const PORT = common.PORT;
const bench = common.createBenchmark(main, {
streams: [100, 200, 1000],
@@ -26,7 +25,7 @@ function main({ streams, length, size }) {
}
write();
});
- server.listen(PORT, () => {
+ server.listen(common.PORT, () => {
bench.http({
path: '/',
requests: 10000,
diff --git a/benchmark/misc/freelist.js b/benchmark/misc/freelist.js
index 0530255728f..8c3281cc407 100644
--- a/benchmark/misc/freelist.js
+++ b/benchmark/misc/freelist.js
@@ -12,7 +12,6 @@ function main({ n }) {
const FreeList = require('internal/freelist');
const poolSize = 1000;
const list = new FreeList('test', poolSize, Object);
- var i;
var j;
const used = [];
@@ -23,7 +22,7 @@ function main({ n }) {
bench.start();
- for (i = 0; i < n; i++) {
+ for (var i = 0; i < n; i++) {
// Return all the items to the pool
for (j = 0; j < poolSize; j++) {
list.free(used[j]);
diff --git a/benchmark/misc/function_call/index.js b/benchmark/misc/function_call/index.js
index 91efa573597..28561bc48cd 100644
--- a/benchmark/misc/function_call/index.js
+++ b/benchmark/misc/function_call/index.js
@@ -32,11 +32,9 @@ const bench = common.createBenchmark(main, {
});
function main({ millions, type }) {
- const n = millions * 1e6;
-
const fn = type === 'cxx' ? cxx : js;
bench.start();
- for (var i = 0; i < n; i++) {
+ for (var i = 0; i < millions * 1e6; i++) {
fn();
}
bench.end(millions);
diff --git a/benchmark/misc/object-property-bench.js b/benchmark/misc/object-property-bench.js
index 37da82d8875..ddc6faed7fc 100644
--- a/benchmark/misc/object-property-bench.js
+++ b/benchmark/misc/object-property-bench.js
@@ -78,6 +78,6 @@ function main({ millions, method }) {
runSymbol(n);
break;
default:
- throw new Error('Unexpected method');
+ throw new Error(`Unexpected method "${method}"`);
}
}
diff --git a/benchmark/misc/punycode.js b/benchmark/misc/punycode.js
index 7016fa11712..369adcf17d3 100644
--- a/benchmark/misc/punycode.js
+++ b/benchmark/misc/punycode.js
@@ -55,9 +55,8 @@ function runPunycode(n, val) {
}
function runICU(n, val) {
- var i = 0;
bench.start();
- for (; i < n; i++)
+ for (var i = 0; i < n; i++)
usingICU(val);
bench.end(n);
}
@@ -76,6 +75,6 @@ function main({ n, val, method }) {
}
// fallthrough
default:
- throw new Error('Unexpected method');
+ throw new Error(`Unexpected method "${method}"`);
}
}
diff --git a/benchmark/module/module-loader.js b/benchmark/module/module-loader.js
index 8393d1f92e0..58d4dcf81c9 100644
--- a/benchmark/module/module-loader.js
+++ b/benchmark/module/module-loader.js
@@ -3,8 +3,8 @@ const fs = require('fs');
const path = require('path');
const common = require('../common.js');
-const { refreshTmpDir, tmpDir } = require('../../test/common');
-const benchmarkDirectory = path.join(tmpDir, 'nodejs-benchmark-module');
+const tmpdir = require('../../test/common/tmpdir');
+const benchmarkDirectory = path.join(tmpdir.path, 'nodejs-benchmark-module');
const bench = common.createBenchmark(main, {
thousands: [50],
@@ -13,12 +13,10 @@ const bench = common.createBenchmark(main, {
});
function main({ thousands, fullPath, useCache }) {
- const n = thousands * 1e3;
-
- refreshTmpDir();
+ tmpdir.refresh();
try { fs.mkdirSync(benchmarkDirectory); } catch (e) {}
- for (var i = 0; i <= n; i++) {
+ for (var i = 0; i <= thousands * 1e3; i++) {
fs.mkdirSync(`${benchmarkDirectory}${i}`);
fs.writeFileSync(
`${benchmarkDirectory}${i}/package.json`,
@@ -31,37 +29,37 @@ function main({ thousands, fullPath, useCache }) {
}
if (fullPath === 'true')
- measureFull(n, useCache === 'true');
+ measureFull(thousands, useCache === 'true');
else
- measureDir(n, useCache === 'true');
+ measureDir(thousands, useCache === 'true');
- refreshTmpDir();
+ tmpdir.refresh();
}
-function measureFull(n, useCache) {
+function measureFull(thousands, useCache) {
var i;
if (useCache) {
- for (i = 0; i <= n; i++) {
+ for (i = 0; i <= thousands * 1e3; i++) {
require(`${benchmarkDirectory}${i}/index.js`);
}
}
bench.start();
- for (i = 0; i <= n; i++) {
+ for (i = 0; i <= thousands * 1e3; i++) {
require(`${benchmarkDirectory}${i}/index.js`);
}
- bench.end(n / 1e3);
+ bench.end(thousands);
}
-function measureDir(n, useCache) {
+function measureDir(thousands, useCache) {
var i;
if (useCache) {
- for (i = 0; i <= n; i++) {
+ for (i = 0; i <= thousands * 1e3; i++) {
require(`${benchmarkDirectory}${i}`);
}
}
bench.start();
- for (i = 0; i <= n; i++) {
+ for (i = 0; i <= thousands * 1e3; i++) {
require(`${benchmarkDirectory}${i}`);
}
- bench.end(n / 1e3);
+ bench.end(thousands);
}
diff --git a/benchmark/path/basename-win32.js b/benchmark/path/basename-win32.js
index 8a66f56d6e3..937dc6f6948 100644
--- a/benchmark/path/basename-win32.js
+++ b/benchmark/path/basename-win32.js
@@ -1,6 +1,6 @@
'use strict';
const common = require('../common.js');
-const { posix } = require('path');
+const { win32 } = require('path');
const bench = common.createBenchmark(main, {
pathext: [
@@ -28,7 +28,7 @@ function main({ n, pathext }) {
bench.start();
for (var i = 0; i < n; i++) {
- posix.basename(pathext, ext);
+ win32.basename(pathext, ext);
}
bench.end(n);
}
diff --git a/benchmark/timers/set-immediate-breadth.js b/benchmark/timers/set-immediate-breadth.js
index a4b217b5bff..4f7d2cd2761 100644
--- a/benchmark/timers/set-immediate-breadth.js
+++ b/benchmark/timers/set-immediate-breadth.js
@@ -9,7 +9,7 @@ function main({ millions }) {
const N = millions * 1e6;
process.on('exit', function() {
- bench.end(N / 1e6);
+ bench.end(millions);
});
function cb() {}
diff --git a/benchmark/timers/set-immediate-depth-args.js b/benchmark/timers/set-immediate-depth-args.js
index fe1340c4bd5..aa5ec95f7da 100644
--- a/benchmark/timers/set-immediate-depth-args.js
+++ b/benchmark/timers/set-immediate-depth-args.js
@@ -9,7 +9,7 @@ function main({ millions }) {
const N = millions * 1e6;
process.on('exit', function() {
- bench.end(N / 1e6);
+ bench.end(millions);
});
function cb3(n, arg2, arg3) {
diff --git a/benchmark/timers/timers-cancel-pooled.js b/benchmark/timers/timers-cancel-pooled.js
index 33897507c83..3e262f820a3 100644
--- a/benchmark/timers/timers-cancel-pooled.js
+++ b/benchmark/timers/timers-cancel-pooled.js
@@ -28,5 +28,5 @@ function main({ millions }) {
}
function cb() {
- assert(false, 'Timer should not call callback');
+ assert.fail('Timer should not call callback');
}
diff --git a/benchmark/timers/timers-cancel-unpooled.js b/benchmark/timers/timers-cancel-unpooled.js
index 57e0139dfe1..15866731133 100644
--- a/benchmark/timers/timers-cancel-unpooled.js
+++ b/benchmark/timers/timers-cancel-unpooled.js
@@ -22,5 +22,5 @@ function main({ millions }) {
}
function cb() {
- assert(false, `Timer ${this._idleTimeout} should not call callback`);
+ assert.fail(`Timer ${this._idleTimeout} should not call callback`);
}
diff --git a/benchmark/timers/timers-insert-unpooled.js b/benchmark/timers/timers-insert-unpooled.js
index 56526633358..fbbeebb759f 100644
--- a/benchmark/timers/timers-insert-unpooled.js
+++ b/benchmark/timers/timers-insert-unpooled.js
@@ -23,5 +23,5 @@ function main({ millions }) {
}
function cb() {
- assert(false, `Timer ${this._idleTimeout} should not call callback`);
+ assert.fail(`Timer ${this._idleTimeout} should not call callback`);
}
diff --git a/benchmark/tls/convertprotocols.js b/benchmark/tls/convertprotocols.js
index 1ee2672bee7..9f4969344d1 100644
--- a/benchmark/tls/convertprotocols.js
+++ b/benchmark/tls/convertprotocols.js
@@ -8,14 +8,15 @@ const bench = common.createBenchmark(main, {
});
function main({ n }) {
- var i = 0;
+ const input = ['ABC', 'XYZ123', 'FOO'];
var m = {};
// First call dominates results
if (n > 1) {
- tls.convertNPNProtocols(['ABC', 'XYZ123', 'FOO'], m);
+ tls.convertNPNProtocols(input, m);
m = {};
}
bench.start();
- for (; i < n; i++) tls.convertNPNProtocols(['ABC', 'XYZ123', 'FOO'], m);
+ for (var i = 0; i < n; i++)
+ tls.convertNPNProtocols(input, m);
bench.end(n);
}
diff --git a/benchmark/tls/tls-connect.js b/benchmark/tls/tls-connect.js
index 67f2d5f8a93..da0f5e08d5e 100644
--- a/benchmark/tls/tls-connect.js
+++ b/benchmark/tls/tls-connect.js
@@ -11,12 +11,13 @@ const bench = common.createBenchmark(main, {
var clientConn = 0;
var serverConn = 0;
-var server;
var dur;
var concurrency;
var running = true;
-function main({ dur, concurrency }) {
+function main(conf) {
+ dur = conf.dur;
+ concurrency = conf.concurrency;
const cert_dir = path.resolve(__dirname, '../../test/fixtures');
const options = {
key: fs.readFileSync(`${cert_dir}/test_key.pem`),
@@ -25,7 +26,7 @@ function main({ dur, concurrency }) {
ciphers: 'AES256-GCM-SHA384'
};
- server = tls.createServer(options, onConnection);
+ const server = tls.createServer(options, onConnection);
server.listen(common.PORT, onListening);
}
diff --git a/benchmark/url/legacy-vs-whatwg-url-get-prop.js b/benchmark/url/legacy-vs-whatwg-url-get-prop.js
index 93603c258cf..2cc3ab8c75e 100644
--- a/benchmark/url/legacy-vs-whatwg-url-get-prop.js
+++ b/benchmark/url/legacy-vs-whatwg-url-get-prop.js
@@ -74,7 +74,7 @@ function useWHATWG(n, input) {
function main({ type, n, method }) {
const input = inputs[type];
if (!input) {
- throw new Error('Unknown input type');
+ throw new Error(`Unknown input type "${type}"`);
}
var noDead; // Avoid dead code elimination.
@@ -86,7 +86,7 @@ function main({ type, n, method }) {
noDead = useWHATWG(n, input);
break;
default:
- throw new Error('Unknown method');
+ throw new Error(`Unknown method "${method}"`);
}
assert.ok(noDead);
diff --git a/benchmark/url/legacy-vs-whatwg-url-parse.js b/benchmark/url/legacy-vs-whatwg-url-parse.js
index da42d5a189a..2be55e17cc3 100644
--- a/benchmark/url/legacy-vs-whatwg-url-parse.js
+++ b/benchmark/url/legacy-vs-whatwg-url-parse.js
@@ -34,7 +34,7 @@ function useWHATWG(n, input) {
function main({ type, n, method }) {
const input = inputs[type];
if (!input) {
- throw new Error('Unknown input type');
+ throw new Error(`Unknown input type "${type}"`);
}
var noDead; // Avoid dead code elimination.
@@ -46,7 +46,7 @@ function main({ type, n, method }) {
noDead = useWHATWG(n, input);
break;
default:
- throw new Error('Unknown method');
+ throw new Error(`Unknown method ${method}`);
}
assert.ok(noDead);
diff --git a/benchmark/url/legacy-vs-whatwg-url-searchparams-parse.js b/benchmark/url/legacy-vs-whatwg-url-searchparams-parse.js
index 51953ec8707..e915ceb54f9 100644
--- a/benchmark/url/legacy-vs-whatwg-url-searchparams-parse.js
+++ b/benchmark/url/legacy-vs-whatwg-url-searchparams-parse.js
@@ -31,7 +31,7 @@ function useWHATWG(n, input) {
function main({ type, n, method }) {
const input = inputs[type];
if (!input) {
- throw new Error('Unknown input type');
+ throw new Error(`Unknown input type "${type}"`);
}
switch (method) {
@@ -42,6 +42,6 @@ function main({ type, n, method }) {
useWHATWG(n, input);
break;
default:
- throw new Error('Unknown method');
+ throw new Error(`Unknown method ${method}`);
}
}
diff --git a/benchmark/url/legacy-vs-whatwg-url-searchparams-serialize.js b/benchmark/url/legacy-vs-whatwg-url-searchparams-serialize.js
index 3490782a1bf..8fe3e546f07 100644
--- a/benchmark/url/legacy-vs-whatwg-url-searchparams-serialize.js
+++ b/benchmark/url/legacy-vs-whatwg-url-searchparams-serialize.js
@@ -33,7 +33,7 @@ function useWHATWG(n, input, prop) {
function main({ type, n, method }) {
const input = inputs[type];
if (!input) {
- throw new Error('Unknown input type');
+ throw new Error(`Unknown input type "${type}"`);
}
switch (method) {
@@ -44,6 +44,6 @@ function main({ type, n, method }) {
useWHATWG(n, input);
break;
default:
- throw new Error('Unknown method');
+ throw new Error(`Unknown method ${method}`);
}
}
diff --git a/benchmark/url/legacy-vs-whatwg-url-serialize.js b/benchmark/url/legacy-vs-whatwg-url-serialize.js
index e92b941b5d5..017ec4328c5 100644
--- a/benchmark/url/legacy-vs-whatwg-url-serialize.js
+++ b/benchmark/url/legacy-vs-whatwg-url-serialize.js
@@ -36,7 +36,7 @@ function useWHATWG(n, input, prop) {
function main({ type, n, method }) {
const input = inputs[type];
if (!input) {
- throw new Error('Unknown input type');
+ throw new Error(`Unknown input type "${type}"`);
}
var noDead; // Avoid dead code elimination.
@@ -48,7 +48,7 @@ function main({ type, n, method }) {
noDead = useWHATWG(n, input);
break;
default:
- throw new Error('Unknown method');
+ throw new Error(`Unknown method ${method}`);
}
assert.ok(noDead);
diff --git a/benchmark/url/url-searchparams-iteration.js b/benchmark/url/url-searchparams-iteration.js
index 2b13992bdfc..cae2ef5df61 100644
--- a/benchmark/url/url-searchparams-iteration.js
+++ b/benchmark/url/url-searchparams-iteration.js
@@ -53,6 +53,6 @@ function main({ method, n }) {
iterator(n);
break;
default:
- throw new Error('Unknown method');
+ throw new Error(`Unknown method ${method}`);
}
}
diff --git a/benchmark/url/url-searchparams-read.js b/benchmark/url/url-searchparams-read.js
index 29235ee81e0..0cf66dabbc3 100644
--- a/benchmark/url/url-searchparams-read.js
+++ b/benchmark/url/url-searchparams-read.js
@@ -10,45 +10,14 @@ const bench = common.createBenchmark(main, {
const str = 'one=single&two=first&three=first&two=2nd&three=2nd&three=3rd';
-function get(n, param) {
- const params = new URLSearchParams(str);
-
- bench.start();
- for (var i = 0; i < n; i += 1)
- params.get(param);
- bench.end(n);
-}
-
-function getAll(n, param) {
- const params = new URLSearchParams(str);
-
- bench.start();
- for (var i = 0; i < n; i += 1)
- params.getAll(param);
- bench.end(n);
-}
-
-function has(n, param) {
+function main({ method, param, n }) {
const params = new URLSearchParams(str);
+ const fn = params[method];
+ if (!fn)
+ throw new Error(`Unknown method ${method}`);
bench.start();
for (var i = 0; i < n; i += 1)
- params.has(param);
+ fn(param);
bench.end(n);
}
-
-function main({ method, param, n }) {
- switch (method) {
- case 'get':
- get(n, param);
- break;
- case 'getAll':
- getAll(n, param);
- break;
- case 'has':
- has(n, param);
- break;
- default:
- throw new Error('Unknown method');
- }
-}
diff --git a/benchmark/url/url-searchparams-sort.js b/benchmark/url/url-searchparams-sort.js
index 524dacb6d52..fe152bf8234 100644
--- a/benchmark/url/url-searchparams-sort.js
+++ b/benchmark/url/url-searchparams-sort.js
@@ -37,9 +37,8 @@ function main({ type, n }) {
const params = new URLSearchParams();
const array = getParams(input);
- var i;
bench.start();
- for (i = 0; i < n; i++) {
+ for (var i = 0; i < n; i++) {
params[searchParams] = array.slice();
params.sort();
}
diff --git a/benchmark/util/format.js b/benchmark/util/format.js
index 5f9c4c3b594..042b8a93ccf 100644
--- a/benchmark/util/format.js
+++ b/benchmark/util/format.js
@@ -22,9 +22,7 @@ const bench = common.createBenchmark(main, {
function main({ n, type }) {
// For testing, if supplied with an empty type, default to string.
- type = type || 'string';
-
- const [first, second] = inputs[type];
+ const [first, second] = inputs[type || 'string'];
bench.start();
for (var i = 0; i < n; i++) {
diff --git a/benchmark/util/inspect-array.js b/benchmark/util/inspect-array.js
index 74332d18579..8b3c54aeb94 100644
--- a/benchmark/util/inspect-array.js
+++ b/benchmark/util/inspect-array.js
@@ -18,14 +18,13 @@ function main({ n, len, type }) {
var arr = Array(len);
var i, opts;
- // For testing, if supplied with an empty type, default to denseArray.
- type = type || 'denseArray';
-
switch (type) {
case 'denseArray_showHidden':
opts = { showHidden: true };
arr = arr.fill('denseArray');
break;
+ // For testing, if supplied with an empty type, default to denseArray.
+ case '':
case 'denseArray':
arr = arr.fill('denseArray');
break;
diff --git a/benchmark/v8/get-stats.js b/benchmark/v8/get-stats.js
index 6ee74285862..84a0655f5db 100644
--- a/benchmark/v8/get-stats.js
+++ b/benchmark/v8/get-stats.js
@@ -12,9 +12,8 @@ const bench = common.createBenchmark(main, {
});
function main({ method, n }) {
- var i = 0;
bench.start();
- for (; i < n; i++)
+ for (var i = 0; i < n; i++)
v8[method]();
bench.end(n);
}
diff --git a/benchmark/vm/run-in-context.js b/benchmark/vm/run-in-context.js
index da8f56a6e01..9b57067a19c 100644
--- a/benchmark/vm/run-in-context.js
+++ b/benchmark/vm/run-in-context.js
@@ -17,12 +17,10 @@ function main({ n, breakOnSigint, withSigintListener }) {
if (withSigintListener)
process.on('SIGINT', () => {});
- var i = 0;
-
const contextifiedSandbox = vm.createContext();
bench.start();
- for (; i < n; i++)
+ for (var i = 0; i < n; i++)
vm.runInContext('0', contextifiedSandbox, options);
bench.end(n);
}
diff --git a/benchmark/vm/run-in-this-context.js b/benchmark/vm/run-in-this-context.js
index 33fd3a34d81..0754287376d 100644
--- a/benchmark/vm/run-in-this-context.js
+++ b/benchmark/vm/run-in-this-context.js
@@ -17,10 +17,8 @@ function main({ n, breakOnSigint, withSigintListener }) {
if (withSigintListener)
process.on('SIGINT', () => {});
- var i = 0;
-
bench.start();
- for (; i < n; i++)
+ for (var i = 0; i < n; i++)
vm.runInThisContext('0', options);
bench.end(n);
}
diff --git a/common.gypi b/common.gypi
index e686caf17a3..343e48eefc9 100644
--- a/common.gypi
+++ b/common.gypi
@@ -46,32 +46,32 @@
'conditions': [
['GENERATOR=="ninja"', {
- 'OBJ_DIR': '<(PRODUCT_DIR)/obj',
- 'V8_BASE': '<(PRODUCT_DIR)/obj/deps/v8/src/libv8_base.a',
- 'CHAKRASHIM_BASE': '<(PRODUCT_DIR)/obj/deps/chakrashim/libchakrashim.a',
+ 'obj_dir': '<(PRODUCT_DIR)/obj',
+ 'v8_base': '<(PRODUCT_DIR)/obj/deps/v8/src/libv8_base.a',
+ 'chakrashim_base': '<(PRODUCT_DIR)/obj/deps/chakrashim/libchakrashim.a',
}, {
- 'OBJ_DIR%': '<(PRODUCT_DIR)/obj.target',
- 'V8_BASE%': '<(PRODUCT_DIR)/obj.target/deps/v8/src/libv8_base.a',
- 'CHAKRASHIM_BASE': '<(PRODUCT_DIR)/obj.target/deps/chakrashim/libchakrashim.a',
+ 'obj_dir%': '<(PRODUCT_DIR)/obj.target',
+ 'v8_base%': '<(PRODUCT_DIR)/obj.target/deps/v8/src/libv8_base.a',
+ 'chakrashim_base': '<(PRODUCT_DIR)/obj.target/deps/chakrashim/libchakrashim.a',
}],
['OS == "win"', {
'os_posix': 0,
'v8_postmortem_support%': 'false',
- 'OBJ_DIR': '<(PRODUCT_DIR)/obj',
- 'V8_BASE': '<(PRODUCT_DIR)/lib/v8_libbase.lib',
+ 'obj_dir': '<(PRODUCT_DIR)/obj',
+ 'v8_base': '<(PRODUCT_DIR)/lib/v8_libbase.lib',
}, {
'os_posix': 1,
'v8_postmortem_support%': 'true',
}],
['OS== "mac"', {
- 'CHAKRASHIM_BASE': '<(PRODUCT_DIR)/libchakrashim.a',
- 'OBJ_DIR%': '<(PRODUCT_DIR)/obj.target',
- 'V8_BASE': '<(PRODUCT_DIR)/libv8_base.a',
+ 'chakrashim_base': '<(PRODUCT_DIR)/libchakrashim.a',
+ 'obj_dir%': '<(PRODUCT_DIR)/obj.target',
+ 'v8_base': '<(PRODUCT_DIR)/libv8_base.a',
}],
['openssl_fips != ""', {
- 'OPENSSL_PRODUCT': '<(STATIC_LIB_PREFIX)crypto<(STATIC_LIB_SUFFIX)',
+ 'openssl_product': '<(STATIC_LIB_PREFIX)crypto<(STATIC_LIB_SUFFIX)',
}, {
- 'OPENSSL_PRODUCT': '<(STATIC_LIB_PREFIX)openssl<(STATIC_LIB_SUFFIX)',
+ 'openssl_product': '<(STATIC_LIB_PREFIX)openssl<(STATIC_LIB_SUFFIX)',
}],
['OS=="mac"', {
'clang%': 1,
diff --git a/deps/node-inspect/CHANGELOG.md b/deps/node-inspect/CHANGELOG.md
index 41ed928e781..0db3a7842eb 100644
--- a/deps/node-inspect/CHANGELOG.md
+++ b/deps/node-inspect/CHANGELOG.md
@@ -1,3 +1,12 @@
+### 1.11.3
+
+* [`93caa0f`](https://github.com/nodejs/node-inspect/commit/93caa0f5267c7ab452b258d3b03329a0bb5ac7f7) **docs:** Add missing oc in protocol
+* [`2d87cbe`](https://github.com/nodejs/node-inspect/commit/2d87cbe76aa968dfc1ac69d9571af1be81abd8e0) **fix:** Make --inspect-port=0 work
+* [`ebfd02e`](https://github.com/nodejs/node-inspect/commit/ebfd02ece9b642586023f7791da71defeb13d746) **chore:** Bump tap to 10.7
+* [`c07adb1`](https://github.com/nodejs/node-inspect/commit/c07adb17b164c1cf3da8d38659ea9f5d7ff42e9c) **test:** Use useful break location
+* [`94f0bf9`](https://github.com/nodejs/node-inspect/commit/94f0bf97d24c376baf3ecced2088d81715a73464) **fix:** Fix `takeHeapSnapshot()` truncation bug
+
+
### 1.11.2
* [`42e0cd1`](https://github.com/nodejs/node-inspect/commit/42e0cd111d89ed09faba1c0ec45089b0b44de011) **fix:** look for generic hint text
diff --git a/deps/node-inspect/README.md b/deps/node-inspect/README.md
index ecd939b3ea2..b52cc188a62 100644
--- a/deps/node-inspect/README.md
+++ b/deps/node-inspect/README.md
@@ -10,7 +10,7 @@ node has two options:
1. `node --debug `: Start `file` with remote debugging enabled.
2. `node debug `: Start an interactive CLI debugger for ``.
-But for the Chrome inspector protol,
+But for the Chrome inspector protocol,
there's only one: `node --inspect `.
This project tries to provide the missing second option
diff --git a/deps/node-inspect/lib/_inspect.js b/deps/node-inspect/lib/_inspect.js
index 26912274cda..d846efbe6a4 100644
--- a/deps/node-inspect/lib/_inspect.js
+++ b/deps/node-inspect/lib/_inspect.js
@@ -42,18 +42,9 @@ const [ InspectClient, createRepl ] =
const debuglog = util.debuglog('inspect');
-const DEBUG_PORT_PATTERN = /^--(?:debug|inspect)(?:-port|-brk)?=(\d{1,5})$/;
-function getDefaultPort() {
- for (const arg of process.execArgv) {
- const match = arg.match(DEBUG_PORT_PATTERN);
- if (match) {
- return +match[1];
- }
- }
- return 9229;
-}
-
function portIsFree(host, port, timeout = 2000) {
+ if (port === 0) return Promise.resolve(); // Binding to a random port.
+
const retryDelay = 150;
let didTimeOut = false;
@@ -110,9 +101,11 @@ function runScript(script, scriptArgs, inspectHost, inspectPort, childPrint) {
let output = '';
function waitForListenHint(text) {
output += text;
- if (/Debugger listening on/.test(output)) {
+ if (/Debugger listening on ws:\/\/\[?(.+?)\]?:(\d+)\//.test(output)) {
+ const host = RegExp.$1;
+ const port = Number.parseInt(RegExp.$2);
child.stderr.removeListener('data', waitForListenHint);
- resolve(child);
+ resolve([child, port, host]);
}
}
@@ -160,10 +153,11 @@ class NodeInspector {
options.port,
this.childPrint.bind(this));
} else {
- this._runScript = () => Promise.resolve(null);
+ this._runScript =
+ () => Promise.resolve([null, options.port, options.host]);
}
- this.client = new InspectClient(options.port, options.host);
+ this.client = new InspectClient();
this.domainNames = ['Debugger', 'HeapProfiler', 'Profiler', 'Runtime'];
this.domainNames.forEach((domain) => {
@@ -223,9 +217,8 @@ class NodeInspector {
run() {
this.killChild();
- const { host, port } = this.options;
- return this._runScript().then((child) => {
+ return this._runScript().then(([child, port, host]) => {
this.child = child;
let connectionAttempts = 0;
@@ -233,7 +226,7 @@ class NodeInspector {
++connectionAttempts;
debuglog('connection attempt #%d', connectionAttempts);
this.stdout.write('.');
- return this.client.connect()
+ return this.client.connect(port, host)
.then(() => {
debuglog('connection established');
this.stdout.write(' ok');
@@ -288,7 +281,7 @@ class NodeInspector {
function parseArgv([target, ...args]) {
let host = '127.0.0.1';
- let port = getDefaultPort();
+ let port = 9229;
let isRemote = false;
let script = target;
let scriptArgs = args;
diff --git a/deps/node-inspect/lib/internal/inspect_client.js b/deps/node-inspect/lib/internal/inspect_client.js
index c247e2add87..9b8529de21a 100644
--- a/deps/node-inspect/lib/internal/inspect_client.js
+++ b/deps/node-inspect/lib/internal/inspect_client.js
@@ -164,12 +164,12 @@ function decodeFrameHybi17(data) {
}
class Client extends EventEmitter {
- constructor(port, host) {
+ constructor() {
super();
this.handleChunk = this._handleChunk.bind(this);
- this._port = port;
- this._host = host;
+ this._port = undefined;
+ this._host = undefined;
this.reset();
}
@@ -284,7 +284,9 @@ class Client extends EventEmitter {
});
}
- connect() {
+ connect(port, host) {
+ this._port = port;
+ this._host = host;
return this._discoverWebsocketPath()
.then((urlPath) => this._connectWebsocket(urlPath));
}
diff --git a/deps/node-inspect/lib/internal/inspect_repl.js b/deps/node-inspect/lib/internal/inspect_repl.js
index 937c1843d3a..38fe4684cf6 100644
--- a/deps/node-inspect/lib/internal/inspect_repl.js
+++ b/deps/node-inspect/lib/internal/inspect_repl.js
@@ -900,10 +900,8 @@ function createRepl(inspector) {
return new Promise((resolve, reject) => {
const absoluteFile = Path.resolve(filename);
const writer = FS.createWriteStream(absoluteFile);
- let totalSize;
let sizeWritten = 0;
function onProgress({ done, total, finished }) {
- totalSize = total;
if (finished) {
print('Heap snaphost prepared.');
} else {
@@ -913,13 +911,18 @@ function createRepl(inspector) {
function onChunk({ chunk }) {
sizeWritten += chunk.length;
writer.write(chunk);
- print(`Writing snapshot: ${sizeWritten}/${totalSize}`, true);
- if (sizeWritten >= totalSize) {
- writer.end();
+ print(`Writing snapshot: ${sizeWritten}`, true);
+ }
+ function onResolve() {
+ writer.end(() => {
teardown();
print(`Wrote snapshot: ${absoluteFile}`);
resolve();
- }
+ });
+ }
+ function onReject(error) {
+ teardown();
+ reject(error);
}
function teardown() {
HeapProfiler.removeListener(
@@ -932,10 +935,7 @@ function createRepl(inspector) {
print('Heap snapshot: 0/0', true);
HeapProfiler.takeHeapSnapshot({ reportProgress: true })
- .then(null, (error) => {
- teardown();
- reject(error);
- });
+ .then(onResolve, onReject);
});
},
diff --git a/deps/node-inspect/package.json b/deps/node-inspect/package.json
index 070abfa8fe5..d25376b5d4b 100644
--- a/deps/node-inspect/package.json
+++ b/deps/node-inspect/package.json
@@ -1,6 +1,6 @@
{
"name": "node-inspect",
- "version": "1.11.2",
+ "version": "1.11.3",
"description": "Node Inspect",
"license": "MIT",
"main": "lib/_inspect.js",
@@ -29,7 +29,7 @@
"devDependencies": {
"eslint": "^3.10.2",
"nlm": "^3.0.0",
- "tap": "^7.1.2"
+ "tap": "^10.7.0"
},
"author": {
"name": "Jan Krems",
diff --git a/deps/node-inspect/test/cli/break.test.js b/deps/node-inspect/test/cli/break.test.js
index 59b12cde388..ce8c8d6d7d9 100644
--- a/deps/node-inspect/test/cli/break.test.js
+++ b/deps/node-inspect/test/cli/break.test.js
@@ -134,7 +134,7 @@ test('sb before loading file', (t) => {
return cli.waitForInitialBreak()
.then(() => cli.waitForPrompt())
- .then(() => cli.command('sb("other.js", 3)'))
+ .then(() => cli.command('sb("other.js", 2)'))
.then(() => {
t.match(
cli.output,
@@ -145,7 +145,7 @@ test('sb before loading file', (t) => {
.then(() => {
t.match(
cli.output,
- `break in ${otherScript}:3`,
+ `break in ${otherScript}:2`,
'found breakpoint in file that was not loaded yet');
})
.then(() => cli.quit())
diff --git a/deps/node-inspect/test/cli/heap-profiler.test.js b/deps/node-inspect/test/cli/heap-profiler.test.js
new file mode 100644
index 00000000000..ebd734e03cb
--- /dev/null
+++ b/deps/node-inspect/test/cli/heap-profiler.test.js
@@ -0,0 +1,34 @@
+'use strict';
+const { test } = require('tap');
+const { readFileSync, unlinkSync } = require('fs');
+
+const startCLI = require('./start-cli');
+const filename = 'node.heapsnapshot';
+
+function cleanup() {
+ try {
+ unlinkSync(filename);
+ } catch (_) {
+ // Ignore.
+ }
+}
+
+cleanup();
+
+test('Heap profiler take snapshot', (t) => {
+ const cli = startCLI(['examples/empty.js']);
+
+ function onFatal(error) {
+ cli.quit();
+ throw error;
+ }
+
+ // Check that the snapshot is valid JSON.
+ return cli.waitForInitialBreak()
+ .then(() => cli.waitForPrompt())
+ .then(() => cli.command('takeHeapSnapshot()'))
+ .then(() => JSON.parse(readFileSync(filename, 'utf8')))
+ .then(() => cleanup())
+ .then(() => cli.quit())
+ .then(null, onFatal);
+});
diff --git a/deps/node-inspect/test/cli/launch.test.js b/deps/node-inspect/test/cli/launch.test.js
index f7efc6eb3f2..8808d47a08b 100644
--- a/deps/node-inspect/test/cli/launch.test.js
+++ b/deps/node-inspect/test/cli/launch.test.js
@@ -26,6 +26,46 @@ test('custom port', (t) => {
});
});
+test('random port', (t) => {
+ const script = Path.join('examples', 'three-lines.js');
+
+ const cli = startCLI(['--port=0', script]);
+
+ return cli.waitForInitialBreak()
+ .then(() => cli.waitForPrompt())
+ .then(() => {
+ t.match(cli.output, 'debug>', 'prints a prompt');
+ t.match(
+ cli.output,
+ /< Debugger listening on /,
+ 'forwards child output');
+ })
+ .then(() => cli.quit())
+ .then((code) => {
+ t.equal(code, 0, 'exits with success');
+ });
+});
+
+test('random port with --inspect-port=0', (t) => {
+ const script = Path.join('examples', 'three-lines.js');
+
+ const cli = startCLI([script], ['--inspect-port=0']);
+
+ return cli.waitForInitialBreak()
+ .then(() => cli.waitForPrompt())
+ .then(() => {
+ t.match(cli.output, 'debug>', 'prints a prompt');
+ t.match(
+ cli.output,
+ /< Debugger listening on /,
+ 'forwards child output');
+ })
+ .then(() => cli.quit())
+ .then((code) => {
+ t.equal(code, 0, 'exits with success');
+ });
+});
+
test('examples/three-lines.js', (t) => {
const script = Path.join('examples', 'three-lines.js');
const cli = startCLI([script]);
diff --git a/deps/node-inspect/test/cli/start-cli.js b/deps/node-inspect/test/cli/start-cli.js
index ae904308e02..b086dcd8ba2 100644
--- a/deps/node-inspect/test/cli/start-cli.js
+++ b/deps/node-inspect/test/cli/start-cli.js
@@ -16,8 +16,8 @@ const BREAK_MESSAGE = new RegExp('(?:' + [
'exception', 'other', 'promiseRejection',
].join('|') + ') in', 'i');
-function startCLI(args) {
- const child = spawn(process.execPath, [CLI, ...args]);
+function startCLI(args, flags = []) {
+ const child = spawn(process.execPath, [...flags, CLI, ...args]);
let isFirstStdoutChunk = true;
const outputBuffer = [];
diff --git a/doc/api/assert.md b/doc/api/assert.md
index 04f312aa663..dc9a9026951 100644
--- a/doc/api/assert.md
+++ b/doc/api/assert.md
@@ -249,6 +249,8 @@ are recursively evaluated also by the following rules.
* Map keys and Set items are compared unordered.
* Recursion stops when both sides differ or both sides encounter a circular
reference.
+* [`WeakMap`][] and [`WeakSet`][] comparison does not rely on their values. See
+ below for further details.
```js
const assert = require('assert').strict;
@@ -290,6 +292,16 @@ assert.deepStrictEqual({ [symbol1]: 1 }, { [symbol1]: 1 });
// OK, because it is the same symbol on both objects.
assert.deepStrictEqual({ [symbol1]: 1 }, { [symbol2]: 1 });
// Fails because symbol1 !== symbol2!
+
+const weakMap1 = new WeakMap();
+const weakMap2 = new WeakMap([[{}, {}]]);
+const weakMap3 = new WeakMap();
+weakMap3.unequal = true;
+
+assert.deepStrictEqual(weakMap1, weakMap2);
+// OK, because it is impossible to compare the entries
+assert.deepStrictEqual(weakMap1, weakMap3);
+// Fails because weakMap3 has a property that weakMap1 does not contain!
```
If the values are not equal, an `AssertionError` is thrown with a `message`
@@ -692,9 +704,8 @@ parameter is an instance of an [`Error`][] then it will be thrown instead of the
added: v0.1.21
changes:
- version: REPLACEME
- pr-url: https://github.com/nodejs/node/pull/17581
- description: assert.ok() will throw a `ERR_MISSING_ARGS` error.
- Use assert.fail() instead.
+ pr-url: https://github.com/nodejs/node/pull/REPLACEME
+ description: assert.ok() (no arguments) will now use a predefined error msg.
-->
* `value` {any}
* `message` {any}
@@ -707,6 +718,8 @@ property set equal to the value of the `message` parameter. If the `message`
parameter is `undefined`, a default error message is assigned. If the `message`
parameter is an instance of an [`Error`][] then it will be thrown instead of the
`AssertionError`.
+If no arguments are passed in at all `message` will be set to the string:
+"No value argument passed to assert.ok".
Be aware that in the `repl` the error message will be different to the one
thrown in a file! See below for further details.
@@ -719,6 +732,10 @@ assert.ok(true);
assert.ok(1);
// OK
+assert.ok();
+// throws:
+// "AssertionError: No value argument passed to `assert.ok`.
+
assert.ok(false, 'it\'s false');
// throws "AssertionError: it's false"
@@ -915,6 +932,8 @@ second argument. This might lead to difficult-to-spot errors.
[`Set`]: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Set
[`Symbol`]: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Symbol
[`TypeError`]: errors.html#errors_class_typeerror
+[`WeakMap`]: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/WeakMap
+[`WeakSet`]: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/WeakSet
[`assert.deepEqual()`]: #assert_assert_deepequal_actual_expected_message
[`assert.deepStrictEqual()`]: #assert_assert_deepstrictequal_actual_expected_message
[`assert.notDeepStrictEqual()`]: #assert_assert_notdeepstrictequal_actual_expected_message
diff --git a/doc/api/async_hooks.md b/doc/api/async_hooks.md
index 4fa23f28d11..781509900cc 100644
--- a/doc/api/async_hooks.md
+++ b/doc/api/async_hooks.md
@@ -86,7 +86,7 @@ added: v8.1.0
* `before` {Function} The [`before` callback][].
* `after` {Function} The [`after` callback][].
* `destroy` {Function} The [`destroy` callback][].
-* Returns: `{AsyncHook}` Instance used for disabling and enabling hooks
+* Returns: {AsyncHook} Instance used for disabling and enabling hooks
Registers functions to be called for different lifetime events of each async
operation.
diff --git a/doc/api/cli.md b/doc/api/cli.md
index b8ea4826dec..6bae0a67c3d 100644
--- a/doc/api/cli.md
+++ b/doc/api/cli.md
@@ -475,6 +475,8 @@ Node options that are allowed are:
V8 options that are allowed are:
- `--abort-on-uncaught-exception`
- `--max-old-space-size`
+- `--perf-basic-prof`
+- `--perf-prof`
- `--stack-trace-limit`
### `NODE_PENDING_DEPRECATION=1`
diff --git a/doc/api/cluster.md b/doc/api/cluster.md
index 1817ac82027..3063af83bdb 100644
--- a/doc/api/cluster.md
+++ b/doc/api/cluster.md
@@ -267,7 +267,7 @@ changes:
description: This method now returns a reference to `worker`.
-->
-* Returns: {Worker} A reference to `worker`.
+* Returns: {cluster.Worker} A reference to `worker`.
In a worker, this function will close all servers, wait for the `'close'` event on
those servers, and then disconnect the IPC channel.
diff --git a/doc/api/console.md b/doc/api/console.md
index 76f6c6ac462..68cab5b68f3 100644
--- a/doc/api/console.md
+++ b/doc/api/console.md
@@ -78,8 +78,8 @@ const { Console } = console;
```
### new Console(stdout[, stderr])
-* `stdout` {Writable}
-* `stderr` {Writable}
+* `stdout` {stream.Writable}
+* `stderr` {stream.Writable}
Creates a new `Console` with one or two writable stream instances. `stdout` is a
writable stream to print log or info output. `stderr` is used for warning or
diff --git a/doc/api/crypto.md b/doc/api/crypto.md
index ce91007640a..5e2af21dab1 100644
--- a/doc/api/crypto.md
+++ b/doc/api/crypto.md
@@ -1222,6 +1222,7 @@ related operations. The specific constants currently defined are described in
### crypto.DEFAULT_ENCODING
The default encoding to use for functions that can take either strings
@@ -1231,8 +1232,9 @@ default to [`Buffer`][] objects.
The `crypto.DEFAULT_ENCODING` mechanism is provided for backwards compatibility
with legacy programs that expect `'latin1'` to be the default encoding.
-New applications should expect the default to be `'buffer'`. This property may
-become deprecated in a future Node.js release.
+New applications should expect the default to be `'buffer'`.
+
+This property is deprecated.
### crypto.fips
-* Extends: {Duplex}
+* Extends: {stream.Duplex}
Each instance of the `Http2Stream` class represents a bidirectional HTTP/2
communications stream over an `Http2Session` instance. Any single `Http2Session`
@@ -991,7 +991,7 @@ calling `http2stream.close()`, or `http2stream.destroy()`. Will be
#### http2stream.sentHeaders
* Value: {HTTP2 Headers Object}
@@ -1000,7 +1000,7 @@ An object containing the outbound headers sent for this `Http2Stream`.
#### http2stream.sentInfoHeaders
* Value: {HTTP2 Headers Object[]}
@@ -1010,7 +1010,7 @@ sent for this `Http2Stream`.
#### http2stream.sentTrailers
* Value: {HTTP2 Headers Object}
diff --git a/doc/api/perf_hooks.md b/doc/api/perf_hooks.md
index 2f2910af93d..608bee8d574 100644
--- a/doc/api/perf_hooks.md
+++ b/doc/api/perf_hooks.md
@@ -31,7 +31,7 @@ instance of this class is provided via the `performance` property.
### performance.clearEntries(name)
Remove all performance entry objects with `entryType` equal to `name` from the
@@ -125,6 +125,20 @@ Creates a new `PerformanceMark` entry in the Performance Timeline. A
`performanceEntry.duration` is always `0`. Performance marks are used
to mark specific significant moments in the Performance Timeline.
+### performance.maxEntries
+
+
+Value: {number}
+
+The maximum number of Performance Entry items that should be added to the
+Performance Timeline. This limit is not strictly enforced, but a process
+warning will be emitted if the number of entries in the timeline exceeds
+this limit.
+
+Defaults to 150.
+
### performance.measure(name, startMark, endMark)
-* `stream` {Writable}
+* `stream` {stream.Writable}
* `dir` {number}
* `-1` - to the left from cursor
* `1` - to the right from cursor
@@ -338,7 +338,7 @@ in a specified direction identified by `dir`.
added: v0.7.7
-->
-* `stream` {Writable}
+* `stream` {stream.Writable}
The `readline.clearScreenDown()` method clears the given [TTY][] stream from
the current position of the cursor down.
@@ -362,9 +362,9 @@ changes:
-->
* `options` {Object}
- * `input` {Readable} The [Readable][] stream to listen to. This option is
+ * `input` {stream.Readable} The [Readable][] stream to listen to. This option is
*required*.
- * `output` {Writable} The [Writable][] stream to write readline data to.
+ * `output` {stream.Writable} The [Writable][] stream to write readline data to.
* `completer` {Function} An optional function used for Tab autocompletion.
* `terminal` {boolean} `true` if the `input` and `output` streams should be
treated like a TTY, and have ANSI/VT100 escape codes written to it.
@@ -444,7 +444,7 @@ function completer(linePartial, callback) {
added: v0.7.7
-->
-* `stream` {Writable}
+* `stream` {stream.Writable}
* `x` {number}
* `y` {number}
@@ -456,7 +456,7 @@ given [TTY][] `stream`.
added: v0.7.7
-->
-* `stream` {Readable}
+* `stream` {stream.Readable}
* `interface` {readline.Interface}
The `readline.emitKeypressEvents()` method causes the given [Readable][]
@@ -482,7 +482,7 @@ if (process.stdin.isTTY)
added: v0.7.7
-->
-* `stream` {Writable}
+* `stream` {stream.Writable}
* `dx` {number}
* `dy` {number}
diff --git a/doc/api/repl.md b/doc/api/repl.md
index a1dfffa9cc0..506f54a4b8a 100644
--- a/doc/api/repl.md
+++ b/doc/api/repl.md
@@ -412,9 +412,9 @@ changes:
* `options` {Object|string}
* `prompt` {string} The input prompt to display. Defaults to `> `
(with a trailing space).
- * `input` {Readable} The Readable stream from which REPL input will be read.
+ * `input` {stream.Readable} The Readable stream from which REPL input will be read.
Defaults to `process.stdin`.
- * `output` {Writable} The Writable stream to which REPL output will be
+ * `output` {stream.Writable} The Writable stream to which REPL output will be
written. Defaults to `process.stdout`.
* `terminal` {boolean} If `true`, specifies that the `output` should be
treated as a TTY terminal, and have ANSI/VT100 escape codes written to it.
diff --git a/doc/api/stream.md b/doc/api/stream.md
index 222f8dbd49e..345e0d824d5 100644
--- a/doc/api/stream.md
+++ b/doc/api/stream.md
@@ -394,7 +394,7 @@ changes:
-->
* `encoding` {string} The new default encoding
-* Returns: `this`
+* Returns: {this}
The `writable.setDefaultEncoding()` method sets the default `encoding` for a
[Writable][] stream.
@@ -533,7 +533,7 @@ A Writable stream in object mode will always ignore the `encoding` argument.
added: v8.0.0
-->
-* Returns: `this`
+* Returns: {this}
Destroy the stream, and emit the passed error. After this call, the
writable stream has ended. Implementors should not override this method,
@@ -580,8 +580,8 @@ The Readable can switch back to paused mode using one of the following:
* If there are no pipe destinations, by calling the
[`stream.pause()`][stream-pause] method.
-* If there are pipe destinations, by removing any [`'data'`][] event
- handlers, and removing all pipe destinations by calling the
+* If there are pipe destinations, by removing all pipe destinations.
+ Multiple pipe destinations may be removed by calling the
[`stream.unpipe()`][] method.
The important concept to remember is that a Readable will not generate data
@@ -824,7 +824,7 @@ readable.isPaused(); // === false
added: v0.9.4
-->
-* Returns: `this`
+* Returns: {this}
The `readable.pause()` method will cause a stream in flowing mode to stop
emitting [`'data'`][] events, switching out of flowing mode. Any data that
@@ -973,7 +973,7 @@ the status of the `highWaterMark`.
added: v0.9.4
-->
-* Returns: `this`
+* Returns: {this}
The `readable.resume()` method causes an explicitly paused Readable stream to
resume emitting [`'data'`][] events, switching the stream into flowing mode.
@@ -996,7 +996,7 @@ added: v0.9.4
-->
* `encoding` {string} The encoding to use.
-* Returns: `this`
+* Returns: {this}
The `readable.setEncoding()` method sets the character encoding for
data read from the Readable stream.
@@ -1459,7 +1459,7 @@ write succeeded.
All calls to `writable.write()` that occur between the time `writable._write()`
is called and the `callback` is called will cause the written data to be
-buffered. Once the `callback` is invoked, the stream will emit a [`'drain'`][]
+buffered. When the `callback` is invoked, the stream might emit a [`'drain'`][]
event. If a stream implementation is capable of processing multiple chunks of
data at once, the `writable._writev()` method should be implemented.
diff --git a/doc/api/tty.md b/doc/api/tty.md
index ce6dbae8fa6..64612477fc7 100644
--- a/doc/api/tty.md
+++ b/doc/api/tty.md
@@ -126,7 +126,7 @@ is updated whenever the `'resize'` event is emitted.
added: REPLACEME
-->
-* `env` {object} A object containing the environment variables to check.
+* `env` {Object} A object containing the environment variables to check.
Defaults to `process.env`.
* Returns: {number}
diff --git a/doc/changelogs/CHANGELOG_V9.md b/doc/changelogs/CHANGELOG_V9.md
index 57fb7825f02..2f823638f80 100644
--- a/doc/changelogs/CHANGELOG_V9.md
+++ b/doc/changelogs/CHANGELOG_V9.md
@@ -8,6 +8,7 @@
|
+9.5.0
9.4.0
9.3.0
9.2.1
@@ -29,6 +30,189 @@
* [io.js](CHANGELOG_IOJS.md)
* [Archive](CHANGELOG_ARCHIVE.md)
+
+## 2018-01-31, Version 9.5.0 (Current), @evanlucas
+
+### Notable Changes
+
+* **cluster**
+ - add cwd to cluster.settings (cjihrig) [#18399](https://github.com/nodejs/node/pull/18399)
+* **deps**
+ - upgrade libuv to 1.19.1 (cjihrig) [#18260](https://github.com/nodejs/node/pull/18260)
+* **meta**
+ - add Leko to collaborators (Leko) [#18117](https://github.com/nodejs/node/pull/18117)
+ - add vdeturckheim as collaborator (vdeturckheim) [#18432](https://github.com/nodejs/node/pull/18432)
+* **n-api**
+ - expose n-api version in process.versions (Michael Dawson) [#18067](https://github.com/nodejs/node/pull/18067)
+* **perf_hooks**
+ - add performance.clear() (James M Snell) [#18046](https://github.com/nodejs/node/pull/18046)
+* **stream**
+ - avoid writeAfterEnd() while ending (陈刚) [#18170](https://github.com/nodejs/node/pull/18170)
+
+### Commits
+
+* [[`0a68018ad0`](https://github.com/nodejs/node/commit/0a68018ad0)] - **async_hooks**: update defaultTriggerAsyncIdScope for perf (Anatoli Papirovski) [#18004](https://github.com/nodejs/node/pull/18004)
+* [[`dd56bd1591`](https://github.com/nodejs/node/commit/dd56bd1591)] - **async_hooks**: use typed array stack as fast path (Anna Henningsen) [#17780](https://github.com/nodejs/node/pull/17780)
+* [[`a880e272ff`](https://github.com/nodejs/node/commit/a880e272ff)] - **async_hooks**: use scope for defaultTriggerAsyncId (Andreas Madsen) [#17273](https://github.com/nodejs/node/pull/17273)
+* [[`f56eb2a41e`](https://github.com/nodejs/node/commit/f56eb2a41e)] - **async_hooks**: separate missing from default context (Andreas Madsen) [#17273](https://github.com/nodejs/node/pull/17273)
+* [[`2a4f849c39`](https://github.com/nodejs/node/commit/2a4f849c39)] - **async_hooks**: rename initTriggerId (Andreas Madsen) [#17273](https://github.com/nodejs/node/pull/17273)
+* [[`ac2f98d6a6`](https://github.com/nodejs/node/commit/ac2f98d6a6)] - **(SEMVER-MINOR)** **async_hooks,http**: set HTTPParser trigger to socket (Andreas Madsen) [#18003](https://github.com/nodejs/node/pull/18003)
+* [[`e9397d67a3`](https://github.com/nodejs/node/commit/e9397d67a3)] - **async_hooks,test**: only use IPv6 in http test (Andreas Madsen) [#18143](https://github.com/nodejs/node/pull/18143)
+* [[`2efa7d1bfd`](https://github.com/nodejs/node/commit/2efa7d1bfd)] - **benchmark**: implement duration in http test double (Joyee Cheung) [#18380](https://github.com/nodejs/node/pull/18380)
+* [[`b5ec6ea3d0`](https://github.com/nodejs/node/commit/b5ec6ea3d0)] - **benchmark**: make compare.R easier to understand (Andreas Madsen) [#18373](https://github.com/nodejs/node/pull/18373)
+* [[`ea19f7db0d`](https://github.com/nodejs/node/commit/ea19f7db0d)] - **benchmark**: use destructuring (Ruben Bridgewater) [#18250](https://github.com/nodejs/node/pull/18250)
+* [[`cd9bc8bc50`](https://github.com/nodejs/node/commit/cd9bc8bc50)] - **benchmark**: (dgram) use destructuring (Ruben Bridgewater) [#18250](https://github.com/nodejs/node/pull/18250)
+* [[`e19c77b14e`](https://github.com/nodejs/node/commit/e19c77b14e)] - **benchmark**: (child_process) use destructuring (Ruben Bridgewater) [#18250](https://github.com/nodejs/node/pull/18250)
+* [[`5cf5ab154e`](https://github.com/nodejs/node/commit/5cf5ab154e)] - **benchmark**: (buffers) use destructuring (Ruben Bridgewater) [#18250](https://github.com/nodejs/node/pull/18250)
+* [[`71faa5c1b4`](https://github.com/nodejs/node/commit/71faa5c1b4)] - **benchmark**: (events) use destructuring (Ruben Bridgewater) [#18250](https://github.com/nodejs/node/pull/18250)
+* [[`c25d4d66dc`](https://github.com/nodejs/node/commit/c25d4d66dc)] - **benchmark**: (es) use destructuring (Ruben Bridgewater) [#18250](https://github.com/nodejs/node/pull/18250)
+* [[`59271c8f7f`](https://github.com/nodejs/node/commit/59271c8f7f)] - **benchmark**: (fs) use destructuring (Ruben Bridgewater) [#18250](https://github.com/nodejs/node/pull/18250)
+* [[`4e19cbef86`](https://github.com/nodejs/node/commit/4e19cbef86)] - **benchmark**: (http) use destructuring (Ruben Bridgewater) [#18250](https://github.com/nodejs/node/pull/18250)
+* [[`e9c426b35b`](https://github.com/nodejs/node/commit/e9c426b35b)] - **benchmark**: (misc) use destructuring (Ruben Bridgewater) [#18250](https://github.com/nodejs/node/pull/18250)
+* [[`d13d900eee`](https://github.com/nodejs/node/commit/d13d900eee)] - **benchmark**: (http2) use destructuring (Ruben Bridgewater) [#18250](https://github.com/nodejs/node/pull/18250)
+* [[`97e882061d`](https://github.com/nodejs/node/commit/97e882061d)] - **benchmark**: (string_decoder) use destructuring (Ruben Bridgewater) [#18250](https://github.com/nodejs/node/pull/18250)
+* [[`5b0e3b9860`](https://github.com/nodejs/node/commit/5b0e3b9860)] - **benchmark**: (path) use destructuring (Ruben Bridgewater) [#18250](https://github.com/nodejs/node/pull/18250)
+* [[`7bc5bad74f`](https://github.com/nodejs/node/commit/7bc5bad74f)] - **benchmark**: (os) use destructuring (Ruben Bridgewater) [#18250](https://github.com/nodejs/node/pull/18250)
+* [[`cf666d8529`](https://github.com/nodejs/node/commit/cf666d8529)] - **benchmark**: (net) use destructuring (Ruben Bridgewater) [#18250](https://github.com/nodejs/node/pull/18250)
+* [[`88f4bf219d`](https://github.com/nodejs/node/commit/88f4bf219d)] - **benchmark**: (process) use destructuring (Ruben Bridgewater) [#18250](https://github.com/nodejs/node/pull/18250)
+* [[`f4918289e7`](https://github.com/nodejs/node/commit/f4918289e7)] - **benchmark**: (querystring) use destructuring (Ruben Bridgewater) [#18250](https://github.com/nodejs/node/pull/18250)
+* [[`81abea592f`](https://github.com/nodejs/node/commit/81abea592f)] - **benchmark**: (streams) use destructuring (Ruben Bridgewater) [#18250](https://github.com/nodejs/node/pull/18250)
+* [[`11d6458fd7`](https://github.com/nodejs/node/commit/11d6458fd7)] - **benchmark**: (timers) use destructuring (Ruben Bridgewater) [#18250](https://github.com/nodejs/node/pull/18250)
+* [[`3e3254a2e7`](https://github.com/nodejs/node/commit/3e3254a2e7)] - **benchmark**: (tls) use destructuring (Ruben Bridgewater) [#18250](https://github.com/nodejs/node/pull/18250)
+* [[`c0707c54a5`](https://github.com/nodejs/node/commit/c0707c54a5)] - **benchmark**: (util/v8/vm) use destructuring (Ruben Bridgewater) [#18250](https://github.com/nodejs/node/pull/18250)
+* [[`76f671b84e`](https://github.com/nodejs/node/commit/76f671b84e)] - **benchmark**: (zlib) use destructuring (Ruben Bridgewater) [#18250](https://github.com/nodejs/node/pull/18250)
+* [[`aa47fe0ef9`](https://github.com/nodejs/node/commit/aa47fe0ef9)] - **benchmark**: (url) use destructuring (Ruben Bridgewater) [#18250](https://github.com/nodejs/node/pull/18250)
+* [[`e00dac7b06`](https://github.com/nodejs/node/commit/e00dac7b06)] - **benchmark**: (assert) use destructuring (Ruben Bridgewater) [#18250](https://github.com/nodejs/node/pull/18250)
+* [[`3543458988`](https://github.com/nodejs/node/commit/3543458988)] - **benchmark**: (arrays) use destructuring (Ruben Bridgewater) [#18250](https://github.com/nodejs/node/pull/18250)
+* [[`aa21d55403`](https://github.com/nodejs/node/commit/aa21d55403)] - **benchmark**: remove redundant + (sreepurnajasti) [#17803](https://github.com/nodejs/node/pull/17803)
+* [[`a4ba791566`](https://github.com/nodejs/node/commit/a4ba791566)] - **benchmark**: add JSStreamWrap benchmark (Anna Henningsen) [#17983](https://github.com/nodejs/node/pull/17983)
+* [[`deac028cb6`](https://github.com/nodejs/node/commit/deac028cb6)] - **build**: fix rm commands in tarball rule (Ben Noordhuis) [#18332](https://github.com/nodejs/node/pull/18332)
+* [[`2a9afc4c0e`](https://github.com/nodejs/node/commit/2a9afc4c0e)] - **build**: make lint-js independent of local node (Joyee Cheung) [#18272](https://github.com/nodejs/node/pull/18272)
+* [[`ce1eb0be7e`](https://github.com/nodejs/node/commit/ce1eb0be7e)] - **build**: make lint-md independent of local node (Joyee Cheung) [#18272](https://github.com/nodejs/node/pull/18272)
+* [[`f050521a71`](https://github.com/nodejs/node/commit/f050521a71)] - **build**: define NOMINMAX on windows (Ben Noordhuis) [#18216](https://github.com/nodejs/node/pull/18216)
+* [[`70d6fda9f3`](https://github.com/nodejs/node/commit/70d6fda9f3)] - **build**: remove unused vars from configure (Ben Noordhuis) [#18206](https://github.com/nodejs/node/pull/18206)
+* [[`f81c62246d`](https://github.com/nodejs/node/commit/f81c62246d)] - **build**: refine static and shared lib build (Yihong Wang) [#17604](https://github.com/nodejs/node/pull/17604)
+* [[`1506eb5f25`](https://github.com/nodejs/node/commit/1506eb5f25)] - **build**: remove bench-* targets (Joyee Cheung) [#18150](https://github.com/nodejs/node/pull/18150)
+* [[`969c89bf55`](https://github.com/nodejs/node/commit/969c89bf55)] - **build**: fix Makefile wrt finding node executable (Yang Guo) [#18040](https://github.com/nodejs/node/pull/18040)
+* [[`dd72f9c9b7`](https://github.com/nodejs/node/commit/dd72f9c9b7)] - **build**: fix cctest target with --enable-static (Qingyan Li) [#17992](https://github.com/nodejs/node/pull/17992)
+* [[`2c4e0216de`](https://github.com/nodejs/node/commit/2c4e0216de)] - **build,win**: update lint-cpp on Windows (Kyle Farnung) [#18012](https://github.com/nodejs/node/pull/18012)
+* [[`d8ac817cb6`](https://github.com/nodejs/node/commit/d8ac817cb6)] - **build,win**: restore vcbuild TAG functionality (Rod Vagg) [#18031](https://github.com/nodejs/node/pull/18031)
+* [[`799fd24acb`](https://github.com/nodejs/node/commit/799fd24acb)] - **(SEMVER-MINOR)** **cluster**: add cwd to cluster.settings (cjihrig) [#18399](https://github.com/nodejs/node/pull/18399)
+* [[`6b687cf3c9`](https://github.com/nodejs/node/commit/6b687cf3c9)] - **cluster**: resolve relative unix socket paths (laino) [#16749](https://github.com/nodejs/node/pull/16749)
+* [[`693159e627`](https://github.com/nodejs/node/commit/693159e627)] - **(SEMVER-MINOR)** **deps**: upgrade libuv to 1.19.1 (cjihrig) [#18260](https://github.com/nodejs/node/pull/18260)
+* [[`506d85bfba`](https://github.com/nodejs/node/commit/506d85bfba)] - **deps**: cherry-pick c3458a8 from upstream V8 (Michaël Zasso) [#18060](https://github.com/nodejs/node/pull/18060)
+* [[`45051fa48c`](https://github.com/nodejs/node/commit/45051fa48c)] - **doc**: add vdeturckheim as collaborator (vdeturckheim) [#18432](https://github.com/nodejs/node/pull/18432)
+* [[`03cb06944b`](https://github.com/nodejs/node/commit/03cb06944b)] - **doc**: unify type linkification (Vse Mozhet Byt) [#18407](https://github.com/nodejs/node/pull/18407)
+* [[`d829237b92`](https://github.com/nodejs/node/commit/d829237b92)] - **doc**: fix typo in REPL docs (Adam Engebretson) [#18404](https://github.com/nodejs/node/pull/18404)
+* [[`6ae7bb143a`](https://github.com/nodejs/node/commit/6ae7bb143a)] - **doc**: fix e.g., to e.g. in docs (sreepurnajasti) [#18369](https://github.com/nodejs/node/pull/18369)
+* [[`574d3b9ce8`](https://github.com/nodejs/node/commit/574d3b9ce8)] - **doc**: fix documentation of http2Stream.pushstream() (Peter Dalgaard-Jensen) [#18258](https://github.com/nodejs/node/pull/18258)
+* [[`4d3121b6ed`](https://github.com/nodejs/node/commit/4d3121b6ed)] - **doc**: fix return value for require.resolve.paths() (Peter Dalgaard-Jensen) [#18350](https://github.com/nodejs/node/pull/18350)
+* [[`987480c232`](https://github.com/nodejs/node/commit/987480c232)] - **doc**: add missing word in modules.md (Robert Adamian) [#18343](https://github.com/nodejs/node/pull/18343)
+* [[`224cc64d0c`](https://github.com/nodejs/node/commit/224cc64d0c)] - **doc**: add doc for performance.clearGC() (Antony Tran) [#18331](https://github.com/nodejs/node/pull/18331)
+* [[`e5f6159958`](https://github.com/nodejs/node/commit/e5f6159958)] - **doc**: document the collaborator nomination process (Joyee Cheung) [#18268](https://github.com/nodejs/node/pull/18268)
+* [[`c9e09adc8d`](https://github.com/nodejs/node/commit/c9e09adc8d)] - **doc**: improve the instructions of onboarding PR (Joyee Cheung) [#18268](https://github.com/nodejs/node/pull/18268)
+* [[`b055c9efe5`](https://github.com/nodejs/node/commit/b055c9efe5)] - **doc**: split CONTRIBUTING.md (Joyee Cheung) [#18271](https://github.com/nodejs/node/pull/18271)
+* [[`485d60eea2`](https://github.com/nodejs/node/commit/485d60eea2)] - **doc**: fix typos in async_hooks (Matthew Turner) [#18314](https://github.com/nodejs/node/pull/18314)
+* [[`e3cc0919f6`](https://github.com/nodejs/node/commit/e3cc0919f6)] - **doc**: add missing URL argument types in fs.md (Vse Mozhet Byt) [#18309](https://github.com/nodejs/node/pull/18309)
+* [[`1efb9cd271`](https://github.com/nodejs/node/commit/1efb9cd271)] - **doc**: remove confusing signature in fs.md (Vse Mozhet Byt) [#18310](https://github.com/nodejs/node/pull/18310)
+* [[`195bed21eb`](https://github.com/nodejs/node/commit/195bed21eb)] - **doc**: use PBKDF2 in text (Tobias Nießen) [#18279](https://github.com/nodejs/node/pull/18279)
+* [[`17ef69e6e2`](https://github.com/nodejs/node/commit/17ef69e6e2)] - **doc**: fix typo in async_hooks.md (Matthew Turner) [#18286](https://github.com/nodejs/node/pull/18286)
+* [[`01599e2959`](https://github.com/nodejs/node/commit/01599e2959)] - **doc**: Add example of null to assert.ifError (Leko) [#18236](https://github.com/nodejs/node/pull/18236)
+* [[`5c5aa4969c`](https://github.com/nodejs/node/commit/5c5aa4969c)] - **doc**: improve process.platform (Mars Wong) [#18057](https://github.com/nodejs/node/pull/18057)
+* [[`61df843c95`](https://github.com/nodejs/node/commit/61df843c95)] - **doc**: cjs format is now commonjs (Gus Caplan) [#18165](https://github.com/nodejs/node/pull/18165)
+* [[`361fd33709`](https://github.com/nodejs/node/commit/361fd33709)] - **doc**: V8 branch used in 8.x not active anymore (Franziska Hinkelmann) [#18155](https://github.com/nodejs/node/pull/18155)
+* [[`b553daa29b`](https://github.com/nodejs/node/commit/b553daa29b)] - **doc**: add change info for async_hooks.executionAsyncId() (Stephen Belanger) [#17813](https://github.com/nodejs/node/pull/17813)
+* [[`4b918d79df`](https://github.com/nodejs/node/commit/4b918d79df)] - **doc**: remove uannecessary Require (Michael Dawson) [#18184](https://github.com/nodejs/node/pull/18184)
+* [[`926467ab80`](https://github.com/nodejs/node/commit/926467ab80)] - **doc**: add builtin module in building.md (Suixinlei) [#17705](https://github.com/nodejs/node/pull/17705)
+* [[`1ef8f4e22e`](https://github.com/nodejs/node/commit/1ef8f4e22e)] - **doc**: warn users about non-ASCII paths on build (Matheus Marchini) [#16735](https://github.com/nodejs/node/pull/16735)
+* [[`a1096a6b05`](https://github.com/nodejs/node/commit/a1096a6b05)] - **doc**: simplify sentences that use "considered" (Rich Trott) [#18095](https://github.com/nodejs/node/pull/18095)
+* [[`1d74c33148`](https://github.com/nodejs/node/commit/1d74c33148)] - **doc**: update sample output for process.versions (Michael Dawson) [#18167](https://github.com/nodejs/node/pull/18167)
+* [[`2fb5f19894`](https://github.com/nodejs/node/commit/2fb5f19894)] - **doc**: fix typo in TextEncoding section (Yosuke Furukawa) [#18201](https://github.com/nodejs/node/pull/18201)
+* [[`b4e7260d3e`](https://github.com/nodejs/node/commit/b4e7260d3e)] - **doc**: fix typo in http2stream.close param default (Moritz Peters) [#18166](https://github.com/nodejs/node/pull/18166)
+* [[`b05f09a587`](https://github.com/nodejs/node/commit/b05f09a587)] - **doc**: suggest not to throw JS errors from C++ (Joyee Cheung) [#18149](https://github.com/nodejs/node/pull/18149)
+* [[`5a95905d91`](https://github.com/nodejs/node/commit/5a95905d91)] - **doc**: napi: make header style consistent (Ali Ijaz Sheikh) [#18122](https://github.com/nodejs/node/pull/18122)
+* [[`990abbf06c`](https://github.com/nodejs/node/commit/990abbf06c)] - **doc**: napi: fix unbalanced emphasis (Ali Ijaz Sheikh) [#18122](https://github.com/nodejs/node/pull/18122)
+* [[`f8f809b7fa`](https://github.com/nodejs/node/commit/f8f809b7fa)] - **doc**: add documentation for deprecation properties (Jon Moss) [#16539](https://github.com/nodejs/node/pull/16539)
+* [[`0e8596e2a6`](https://github.com/nodejs/node/commit/0e8596e2a6)] - **doc**: prefer make test-only when verifying the build (Joyee Cheung) [#18061](https://github.com/nodejs/node/pull/18061)
+* [[`bbdc3c4ae8`](https://github.com/nodejs/node/commit/bbdc3c4ae8)] - **doc**: add Leko to collaborators (Leko) [#18117](https://github.com/nodejs/node/pull/18117)
+* [[`afc30a56e3`](https://github.com/nodejs/node/commit/afc30a56e3)] - **doc**: decapitalize primitive types (Vse Mozhet Byt) [#18110](https://github.com/nodejs/node/pull/18110)
+* [[`30e2221a15`](https://github.com/nodejs/node/commit/30e2221a15)] - **doc**: fix s/rstStream/close in example (James M Snell) [#18088](https://github.com/nodejs/node/pull/18088)
+* [[`1c81a055df`](https://github.com/nodejs/node/commit/1c81a055df)] - **doc**: update pushStream docs to use err first (James M Snell) [#18088](https://github.com/nodejs/node/pull/18088)
+* [[`de70a363eb`](https://github.com/nodejs/node/commit/de70a363eb)] - **doc**: be less tentative about undefined behavior (Rich Trott) [#18091](https://github.com/nodejs/node/pull/18091)
+* [[`5ebd0178a6`](https://github.com/nodejs/node/commit/5ebd0178a6)] - **doc**: add descriptions of state properties (James M Snell) [#18044](https://github.com/nodejs/node/pull/18044)
+* [[`7911b9b493`](https://github.com/nodejs/node/commit/7911b9b493)] - **doc**: examples for fast-tracking regression fixes (Refael Ackermann) [#17379](https://github.com/nodejs/node/pull/17379)
+* [[`f0a0fdd83a`](https://github.com/nodejs/node/commit/f0a0fdd83a)] - **doc**: multiple updates to BUILDING.md (Rich Trott) [#17985](https://github.com/nodejs/node/pull/17985)
+* [[`278450fc72`](https://github.com/nodejs/node/commit/278450fc72)] - **doc**: multiple updates to child_process.md (Rich Trott) [#17990](https://github.com/nodejs/node/pull/17990)
+* [[`722fe464bc`](https://github.com/nodejs/node/commit/722fe464bc)] - ***Revert*** "**doc**: import() is supported now" (Myles Borins) [#18141](https://github.com/nodejs/node/pull/18141)
+* [[`39970e9caf`](https://github.com/nodejs/node/commit/39970e9caf)] - **doc**: un-mark Socket#write “removal” as notable change (Anna Henningsen) [#18083](https://github.com/nodejs/node/pull/18083)
+* [[`df8cb401a0`](https://github.com/nodejs/node/commit/df8cb401a0)] - **errors**: remove ERR_OUTOFMEMORY (Tobias Nießen) [#17877](https://github.com/nodejs/node/pull/17877)
+* [[`230a102647`](https://github.com/nodejs/node/commit/230a102647)] - **fs**: cleanup fd lchown and lchownSync (James M Snell) [#18329](https://github.com/nodejs/node/pull/18329)
+* [[`778d57c2c2`](https://github.com/nodejs/node/commit/778d57c2c2)] - **fs**: fix options.end of fs.ReadStream() (陈刚) [#18121](https://github.com/nodejs/node/pull/18121)
+* [[`7fc395a0d7`](https://github.com/nodejs/node/commit/7fc395a0d7)] - **http**: there is no `corked` property of `stream` (Fedor Indutny) [#18325](https://github.com/nodejs/node/pull/18325)
+* [[`b87939cf53`](https://github.com/nodejs/node/commit/b87939cf53)] - **http**: use strict comparison (leeseean) [#17011](https://github.com/nodejs/node/pull/17011)
+* [[`0250e1b9c0`](https://github.com/nodejs/node/commit/0250e1b9c0)] - **http**: free the parser before emitting 'upgrade' (Luigi Pinca) [#18209](https://github.com/nodejs/node/pull/18209)
+* [[`155622847f`](https://github.com/nodejs/node/commit/155622847f)] - **http**: fix parsing of binary upgrade response body (Ben Noordhuis) [#17806](https://github.com/nodejs/node/pull/17806)
+* [[`8e084d8bfb`](https://github.com/nodejs/node/commit/8e084d8bfb)] - **http**: simplify parser lifetime tracking (Anna Henningsen) [#18135](https://github.com/nodejs/node/pull/18135)
+* [[`ee6217a4c7`](https://github.com/nodejs/node/commit/ee6217a4c7)] - **http2**: add checks for server close callback (James M Snell) [#18182](https://github.com/nodejs/node/pull/18182)
+* [[`b3332cce46`](https://github.com/nodejs/node/commit/b3332cce46)] - **http2**: refactor read mechanism (Anna Henningsen) [#18030](https://github.com/nodejs/node/pull/18030)
+* [[`eee40c71c9`](https://github.com/nodejs/node/commit/eee40c71c9)] - **http2**: remember sent headers (James M Snell) [#18045](https://github.com/nodejs/node/pull/18045)
+* [[`39612a8657`](https://github.com/nodejs/node/commit/39612a8657)] - **http2,perf_hooks**: perf state using AliasedBuffer (Kyle Farnung) [#18300](https://github.com/nodejs/node/pull/18300)
+* [[`14f7f607f6`](https://github.com/nodejs/node/commit/14f7f607f6)] - **(SEMVER-MINOR)** **lib**: add internal removeColors helper (Ruben Bridgewater) [#17615](https://github.com/nodejs/node/pull/17615)
+* [[`74c1f4ef78`](https://github.com/nodejs/node/commit/74c1f4ef78)] - **lib**: fix typo in trace_events_async_hooks.js (Gilles De Mey) [#18280](https://github.com/nodejs/node/pull/18280)
+* [[`485d656013`](https://github.com/nodejs/node/commit/485d656013)] - **lib**: use american spelling as per style guide (sreepurnajasti) [#18226](https://github.com/nodejs/node/pull/18226)
+* [[`dcdb646ada`](https://github.com/nodejs/node/commit/dcdb646ada)] - **lib**: fix spelling in comments (Tobias Nießen) [#18018](https://github.com/nodejs/node/pull/18018)
+* [[`8f8e7479cb`](https://github.com/nodejs/node/commit/8f8e7479cb)] - **lib**: remove queue implementation from JSStreamWrap (Anna Henningsen) [#17918](https://github.com/nodejs/node/pull/17918)
+* [[`9edf023694`](https://github.com/nodejs/node/commit/9edf023694)] - **n-api**: throw RangeError napi_create_typedarray() (Jinho Bang) [#18037](https://github.com/nodejs/node/pull/18037)
+* [[`0668a75c39`](https://github.com/nodejs/node/commit/0668a75c39)] - **(SEMVER-MINOR)** **n-api**: expose n-api version in process.versions (Michael Dawson) [#18067](https://github.com/nodejs/node/pull/18067)
+* [[`f693e81ee5`](https://github.com/nodejs/node/commit/f693e81ee5)] - **n-api**: throw RangeError in napi_create_dataview() with invalid range (Jinho Bang) [#17869](https://github.com/nodejs/node/pull/17869)
+* [[`470832f203`](https://github.com/nodejs/node/commit/470832f203)] - **path**: fix path.normalize for relative paths (Weijia Wang) [#17974](https://github.com/nodejs/node/pull/17974)
+* [[`645be73b9d`](https://github.com/nodejs/node/commit/645be73b9d)] - **(SEMVER-MINOR)** **perf_hooks,http2**: add performance.clear() (James M Snell) [#18046](https://github.com/nodejs/node/pull/18046)
+* [[`11982aecd4`](https://github.com/nodejs/node/commit/11982aecd4)] - **process**: JS fast path for bindings (Anatoli Papirovski) [#18365](https://github.com/nodejs/node/pull/18365)
+* [[`ce7ce9d1ee`](https://github.com/nodejs/node/commit/ce7ce9d1ee)] - **process**: clean up signal handler setup (Anatoli Papirovski) [#18330](https://github.com/nodejs/node/pull/18330)
+* [[`a5b35db5d2`](https://github.com/nodejs/node/commit/a5b35db5d2)] - **process**: remove dead code (Anatoli Papirovski) [#18330](https://github.com/nodejs/node/pull/18330)
+* [[`56a9ae7773`](https://github.com/nodejs/node/commit/56a9ae7773)] - **readline**: update references to archived repository (Tobias Nießen) [#17924](https://github.com/nodejs/node/pull/17924)
+* [[`144cfb4b99`](https://github.com/nodejs/node/commit/144cfb4b99)] - **src**: remove outdated domain reference (Anatoli Papirovski) [#18291](https://github.com/nodejs/node/pull/18291)
+* [[`3ab391d3d3`](https://github.com/nodejs/node/commit/3ab391d3d3)] - **src**: remove unnecessary block scope (Anatoli Papirovski) [#18291](https://github.com/nodejs/node/pull/18291)
+* [[`84f8e62f97`](https://github.com/nodejs/node/commit/84f8e62f97)] - **src**: DRY ip address parsing code in cares_wrap.cc (Ben Noordhuis) [#18398](https://github.com/nodejs/node/pull/18398)
+* [[`ecf5bea485`](https://github.com/nodejs/node/commit/ecf5bea485)] - **src**: remove unused variable (cjihrig) [#18385](https://github.com/nodejs/node/pull/18385)
+* [[`1c8df28752`](https://github.com/nodejs/node/commit/1c8df28752)] - **src**: fix -Wimplicit-fallthrough warning (Ben Noordhuis) [#18205](https://github.com/nodejs/node/pull/18205)
+* [[`4513cbb4fe`](https://github.com/nodejs/node/commit/4513cbb4fe)] - **src**: refactor callback #defines into C++ templates (Anna Henningsen) [#18133](https://github.com/nodejs/node/pull/18133)
+* [[`077bcbd202`](https://github.com/nodejs/node/commit/077bcbd202)] - **src**: introduce internal buffer slice constructor (Anna Henningsen) [#18030](https://github.com/nodejs/node/pull/18030)
+* [[`87e3d3db89`](https://github.com/nodejs/node/commit/87e3d3db89)] - **src**: fix code coverage cleanup (Michael Dawson) [#18081](https://github.com/nodejs/node/pull/18081)
+* [[`15aaf18b72`](https://github.com/nodejs/node/commit/15aaf18b72)] - **src**: remove declarations for missing functions (Anna Henningsen) [#18134](https://github.com/nodejs/node/pull/18134)
+* [[`ac0a0a6775`](https://github.com/nodejs/node/commit/ac0a0a6775)] - **src**: harden JSStream callbacks (Anna Henningsen) [#18028](https://github.com/nodejs/node/pull/18028)
+* [[`217ddd8ba2`](https://github.com/nodejs/node/commit/217ddd8ba2)] - **src,doc,test**: Fix common misspellings (Roman Reiss) [#18151](https://github.com/nodejs/node/pull/18151)
+* [[`c4abdcdc30`](https://github.com/nodejs/node/commit/c4abdcdc30)] - **(SEMVER-MINOR)** **stream**: avoid writeAfterEnd() while ending (陈刚) [#18170](https://github.com/nodejs/node/pull/18170)
+* [[`25bebae61c`](https://github.com/nodejs/node/commit/25bebae61c)] - **stream**: simplify `src._readableState` to `state` (陈刚) [#18264](https://github.com/nodejs/node/pull/18264)
+* [[`f7d57d039a`](https://github.com/nodejs/node/commit/f7d57d039a)] - **stream**: remove unreachable code (Luigi Pinca) [#18239](https://github.com/nodejs/node/pull/18239)
+* [[`117b20e621`](https://github.com/nodejs/node/commit/117b20e621)] - **test**: adds tests for vm invalid arguments (Gilles De Mey) [#18282](https://github.com/nodejs/node/pull/18282)
+* [[`c84dd03120`](https://github.com/nodejs/node/commit/c84dd03120)] - **test**: refactor addons-napi/test_exception/test.js (Rich Trott) [#18340](https://github.com/nodejs/node/pull/18340)
+* [[`1458e51d2f`](https://github.com/nodejs/node/commit/1458e51d2f)] - **test**: fix test-tls-server-verify.js on Windows CI (Rich Trott) [#18382](https://github.com/nodejs/node/pull/18382)
+* [[`7d27228e90`](https://github.com/nodejs/node/commit/7d27228e90)] - **test**: use correct size in test-stream-buffer-list (Luigi Pinca) [#18239](https://github.com/nodejs/node/pull/18239)
+* [[`5855a57d52`](https://github.com/nodejs/node/commit/5855a57d52)] - **test**: change assert message to default (ryanmahan) [#18259](https://github.com/nodejs/node/pull/18259)
+* [[`fc89cea5cd`](https://github.com/nodejs/node/commit/fc89cea5cd)] - **test**: use countdown timer (Mandeep Singh) [#17326](https://github.com/nodejs/node/pull/17326)
+* [[`761f26eb12`](https://github.com/nodejs/node/commit/761f26eb12)] - **test**: make async-wrap-getasyncid parallelizable (Joyee Cheung) [#18245](https://github.com/nodejs/node/pull/18245)
+* [[`506c6e841c`](https://github.com/nodejs/node/commit/506c6e841c)] - **test**: refactor test-http-parser (Jon Moss) [#18219](https://github.com/nodejs/node/pull/18219)
+* [[`5b5f5b1b32`](https://github.com/nodejs/node/commit/5b5f5b1b32)] - **test**: add assertions for TextEncoder/Decoder (Sho Miyamoto) [#18132](https://github.com/nodejs/node/pull/18132)
+* [[`3299a1a19b`](https://github.com/nodejs/node/commit/3299a1a19b)] - **test**: remove trivial buffer imports (sreepurnajasti) [#18034](https://github.com/nodejs/node/pull/18034)
+* [[`78e05da071`](https://github.com/nodejs/node/commit/78e05da071)] - **test**: use shorthand properties (Tobias Nießen) [#18105](https://github.com/nodejs/node/pull/18105)
+* [[`63be0d6daa`](https://github.com/nodejs/node/commit/63be0d6daa)] - **test**: simplify loadDHParam in TLS test (Tobias Nießen) [#18103](https://github.com/nodejs/node/pull/18103)
+* [[`1dcae5756e`](https://github.com/nodejs/node/commit/1dcae5756e)] - **test**: improve to use template string (sreepurnajasti) [#18097](https://github.com/nodejs/node/pull/18097)
+* [[`0c8b5d5bfb`](https://github.com/nodejs/node/commit/0c8b5d5bfb)] - **test**: fixed typos in napi test (furstenheim) [#18148](https://github.com/nodejs/node/pull/18148)
+* [[`2aeb025999`](https://github.com/nodejs/node/commit/2aeb025999)] - **test**: add common.crashOnUnhandledRejection to addons/callback-scope (Sho Miyamoto) [#18076](https://github.com/nodejs/node/pull/18076)
+* [[`7706e5f1ea`](https://github.com/nodejs/node/commit/7706e5f1ea)] - **test**: remove orphaned entries from status (Kyle Farnung) [#18092](https://github.com/nodejs/node/pull/18092)
+* [[`5fccb6ea3a`](https://github.com/nodejs/node/commit/5fccb6ea3a)] - **test**: fix spelling in test case comments (Tobias Nießen) [#18018](https://github.com/nodejs/node/pull/18018)
+* [[`3456e61b44`](https://github.com/nodejs/node/commit/3456e61b44)] - **test**: use smaller input file for test-zlib.js (Rich Trott) [#17988](https://github.com/nodejs/node/pull/17988)
+* [[`733df362fa`](https://github.com/nodejs/node/commit/733df362fa)] - **test**: update references to archived repository (Tobias Nießen) [#17924](https://github.com/nodejs/node/pull/17924)
+* [[`2eb1aa81fa`](https://github.com/nodejs/node/commit/2eb1aa81fa)] - **test**: move common.fires() to inspector-helper (Rich Trott) [#17401](https://github.com/nodejs/node/pull/17401)
+* [[`167e9c6dcd`](https://github.com/nodejs/node/commit/167e9c6dcd)] - **test**: refactor test-repl (Anna Henningsen) [#17926](https://github.com/nodejs/node/pull/17926)
+* [[`7b73e704ca`](https://github.com/nodejs/node/commit/7b73e704ca)] - **timers**: attach listOnTimeout function to TimerWrap (Matteo Collina) [#18388](https://github.com/nodejs/node/pull/18388)
+* [[`96b072233a`](https://github.com/nodejs/node/commit/96b072233a)] - **tls**: refactor write queues away (Anna Henningsen) [#17883](https://github.com/nodejs/node/pull/17883)
+* [[`be9958afb6`](https://github.com/nodejs/node/commit/be9958afb6)] - **tools**: use babel-eslint as ESLint parser (Michaël Zasso) [#17820](https://github.com/nodejs/node/pull/17820)
+* [[`715e673d06`](https://github.com/nodejs/node/commit/715e673d06)] - **tools**: add babel-eslint (Michaël Zasso) [#17820](https://github.com/nodejs/node/pull/17820)
+* [[`d349fcae11`](https://github.com/nodejs/node/commit/d349fcae11)] - **tools**: update ESLint to 4.15.0 (Michaël Zasso) [#17820](https://github.com/nodejs/node/pull/17820)
+* [[`4bc4d004b1`](https://github.com/nodejs/node/commit/4bc4d004b1)] - **tools**: move eslint from tools to tools/node_modules (Michaël Zasso) [#17820](https://github.com/nodejs/node/pull/17820)
+
## 2018-01-10, Version 9.4.0 (Current), @MylesBorins
diff --git a/lib/_http_client.js b/lib/_http_client.js
index a9ee686c69a..ebfd809e21e 100644
--- a/lib/_http_client.js
+++ b/lib/_http_client.js
@@ -132,6 +132,40 @@ function ClientRequest(options, cb) {
this.once('response', cb);
}
+ if (method === 'GET' ||
+ method === 'HEAD' ||
+ method === 'DELETE' ||
+ method === 'OPTIONS' ||
+ method === 'CONNECT') {
+ this.useChunkedEncodingByDefault = false;
+ } else {
+ this.useChunkedEncodingByDefault = true;
+ }
+
+ this._ended = false;
+ this.res = null;
+ this.aborted = undefined;
+ this.timeoutCb = null;
+ this.upgradeOrConnect = false;
+ this.parser = null;
+ this.maxHeadersCount = null;
+
+ var called = false;
+
+ if (this.agent) {
+ // If there is an agent we should default to Connection:keep-alive,
+ // but only if the Agent will actually reuse the connection!
+ // If it's not a keepAlive agent, and the maxSockets==Infinity, then
+ // there's never a case where this socket will actually be reused
+ if (!this.agent.keepAlive && !Number.isFinite(this.agent.maxSockets)) {
+ this._last = true;
+ this.shouldKeepAlive = false;
+ } else {
+ this._last = false;
+ this.shouldKeepAlive = true;
+ }
+ }
+
var headersArray = Array.isArray(options.headers);
if (!headersArray) {
if (options.headers) {
@@ -141,6 +175,7 @@ function ClientRequest(options, cb) {
this.setHeader(key, options.headers[key]);
}
}
+
if (host && !this.getHeader('host') && setHost) {
var hostHeader = host;
@@ -159,45 +194,25 @@ function ClientRequest(options, cb) {
}
this.setHeader('Host', hostHeader);
}
- }
- if (options.auth && !this.getHeader('Authorization')) {
- this.setHeader('Authorization', 'Basic ' +
- Buffer.from(options.auth).toString('base64'));
- }
+ if (options.auth && !this.getHeader('Authorization')) {
+ this.setHeader('Authorization', 'Basic ' +
+ Buffer.from(options.auth).toString('base64'));
+ }
- if (method === 'GET' ||
- method === 'HEAD' ||
- method === 'DELETE' ||
- method === 'OPTIONS' ||
- method === 'CONNECT') {
- this.useChunkedEncodingByDefault = false;
- } else {
- this.useChunkedEncodingByDefault = true;
- }
+ if (this.getHeader('expect')) {
+ if (this._header) {
+ throw new errors.Error('ERR_HTTP_HEADERS_SENT', 'render');
+ }
- if (headersArray) {
- this._storeHeader(this.method + ' ' + this.path + ' HTTP/1.1\r\n',
- options.headers);
- } else if (this.getHeader('expect')) {
- if (this._header) {
- throw new errors.Error('ERR_HTTP_HEADERS_SENT', 'render');
+ this._storeHeader(this.method + ' ' + this.path + ' HTTP/1.1\r\n',
+ this[outHeadersKey]);
}
-
+ } else {
this._storeHeader(this.method + ' ' + this.path + ' HTTP/1.1\r\n',
- this[outHeadersKey]);
+ options.headers);
}
- this._ended = false;
- this.res = null;
- this.aborted = undefined;
- this.timeoutCb = null;
- this.upgradeOrConnect = false;
- this.parser = null;
- this.maxHeadersCount = null;
-
- var called = false;
-
var oncreate = (err, socket) => {
if (called)
return;
@@ -210,18 +225,8 @@ function ClientRequest(options, cb) {
this._deferToConnect(null, null, () => this._flush());
};
+ // initiate connection
if (this.agent) {
- // If there is an agent we should default to Connection:keep-alive,
- // but only if the Agent will actually reuse the connection!
- // If it's not a keepAlive agent, and the maxSockets==Infinity, then
- // there's never a case where this socket will actually be reused
- if (!this.agent.keepAlive && !Number.isFinite(this.agent.maxSockets)) {
- this._last = true;
- this.shouldKeepAlive = false;
- } else {
- this._last = false;
- this.shouldKeepAlive = true;
- }
this.agent.addRequest(this, options);
} else {
// No agent, default to Connection:close.
diff --git a/lib/_http_server.js b/lib/_http_server.js
index c60119822a9..496ebf285c8 100644
--- a/lib/_http_server.js
+++ b/lib/_http_server.js
@@ -666,7 +666,7 @@ function onSocketPause() {
function unconsume(parser, socket) {
if (socket._handle) {
if (parser._consumed)
- parser.unconsume(socket._handle._externalStream);
+ parser.unconsume();
parser._consumed = false;
socket.removeListener('pause', onSocketPause);
socket.removeListener('resume', onSocketResume);
diff --git a/lib/_stream_readable.js b/lib/_stream_readable.js
index 6854b3d9ebc..19e9e7a7439 100644
--- a/lib/_stream_readable.js
+++ b/lib/_stream_readable.js
@@ -987,106 +987,18 @@ function fromList(n, state) {
if (state.decoder)
ret = state.buffer.join('');
else if (state.buffer.length === 1)
- ret = state.buffer.head.data;
+ ret = state.buffer.first();
else
ret = state.buffer.concat(state.length);
state.buffer.clear();
} else {
// read part of list
- ret = fromListPartial(n, state.buffer, state.decoder);
+ ret = state.buffer.consume(n, state.decoder);
}
return ret;
}
-// Extracts only enough buffered data to satisfy the amount requested.
-// This function is designed to be inlinable, so please take care when making
-// changes to the function body.
-function fromListPartial(n, list, hasStrings) {
- var ret;
- if (n < list.head.data.length) {
- // slice is the same for buffers and strings
- ret = list.head.data.slice(0, n);
- list.head.data = list.head.data.slice(n);
- } else if (n === list.head.data.length) {
- // first chunk is a perfect match
- ret = list.shift();
- } else {
- // result spans more than one buffer
- ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);
- }
- return ret;
-}
-
-// Copies a specified amount of characters from the list of buffered data
-// chunks.
-// This function is designed to be inlinable, so please take care when making
-// changes to the function body.
-function copyFromBufferString(n, list) {
- var p = list.head;
- var c = 1;
- var ret = p.data;
- n -= ret.length;
- while (p = p.next) {
- const str = p.data;
- const nb = (n > str.length ? str.length : n);
- if (nb === str.length)
- ret += str;
- else
- ret += str.slice(0, n);
- n -= nb;
- if (n === 0) {
- if (nb === str.length) {
- ++c;
- if (p.next)
- list.head = p.next;
- else
- list.head = list.tail = null;
- } else {
- list.head = p;
- p.data = str.slice(nb);
- }
- break;
- }
- ++c;
- }
- list.length -= c;
- return ret;
-}
-
-// Copies a specified amount of bytes from the list of buffered data chunks.
-// This function is designed to be inlinable, so please take care when making
-// changes to the function body.
-function copyFromBuffer(n, list) {
- const ret = Buffer.allocUnsafe(n);
- var p = list.head;
- var c = 1;
- p.data.copy(ret);
- n -= p.data.length;
- while (p = p.next) {
- const buf = p.data;
- const nb = (n > buf.length ? buf.length : n);
- buf.copy(ret, ret.length - n, 0, nb);
- n -= nb;
- if (n === 0) {
- if (nb === buf.length) {
- ++c;
- if (p.next)
- list.head = p.next;
- else
- list.head = list.tail = null;
- } else {
- list.head = p;
- p.data = buf.slice(nb);
- }
- break;
- }
- ++c;
- }
- list.length -= c;
- return ret;
-}
-
function endReadable(stream) {
var state = stream._readableState;
diff --git a/lib/assert.js b/lib/assert.js
index 149e9402ad4..340aed850f5 100644
--- a/lib/assert.js
+++ b/lib/assert.js
@@ -141,11 +141,11 @@ function getBuffer(fd, assertLine) {
function innerOk(args, fn) {
var [value, message] = args;
- if (args.length === 0)
- throw new TypeError('ERR_MISSING_ARGS', 'value');
-
if (!value) {
- if (message == null && process.jsEngine !== 'chakracore') {
+
+ if (args.length === 0) {
+ message = 'No value argument passed to `assert.ok()`';
+ } else if (message == null && process.jsEngine !== 'chakracore') {
// Use the call as error message if possible.
// This does not work with e.g. the repl.
const err = new Error();
diff --git a/lib/crypto.js b/lib/crypto.js
index d7c59f553ed..aa6d4f463d7 100644
--- a/lib/crypto.js
+++ b/lib/crypto.js
@@ -205,8 +205,10 @@ Object.defineProperties(exports, {
DEFAULT_ENCODING: {
enumerable: true,
configurable: true,
- get: getDefaultEncoding,
- set: setDefaultEncoding
+ get: deprecate(getDefaultEncoding,
+ 'crypto.DEFAULT_ENCODING is deprecated.', 'DEP0091'),
+ set: deprecate(setDefaultEncoding,
+ 'crypto.DEFAULT_ENCODING is deprecated.', 'DEP0091')
},
constants: {
configurable: false,
diff --git a/lib/fs.js b/lib/fs.js
index 0103500f0b5..0b9cf0cc9b8 100644
--- a/lib/fs.js
+++ b/lib/fs.js
@@ -508,7 +508,7 @@ ReadFileContext.prototype.read = function() {
} else {
buffer = this.buffer;
offset = this.pos;
- length = this.size - this.pos;
+ length = Math.min(kReadFileBufferLength, this.size - this.pos);
}
var req = new FSReqWrap();
@@ -924,8 +924,12 @@ fs.renameSync = function(oldPath, newPath) {
nullCheck(newPath);
validatePath(oldPath, 'oldPath');
validatePath(newPath, 'newPath');
- return binding.rename(pathModule.toNamespacedPath(oldPath),
- pathModule.toNamespacedPath(newPath));
+ const ctx = { path: oldPath, dest: newPath };
+ binding.rename(pathModule.toNamespacedPath(oldPath),
+ pathModule.toNamespacedPath(newPath), undefined, ctx);
+ if (ctx.errno !== undefined) {
+ throw new errors.uvException(ctx);
+ }
};
fs.truncate = function(path, len, callback) {
@@ -991,7 +995,11 @@ fs.ftruncateSync = function(fd, len = 0) {
validateUint32(fd, 'fd');
validateLen(len);
len = Math.max(0, len);
- return binding.ftruncate(fd, len);
+ const ctx = {};
+ binding.ftruncate(fd, len, undefined, ctx);
+ if (ctx.errno !== undefined) {
+ throw new errors.uvException(ctx);
+ }
};
fs.rmdir = function(path, callback) {
@@ -1021,7 +1029,11 @@ fs.fdatasync = function(fd, callback) {
fs.fdatasyncSync = function(fd) {
validateUint32(fd, 'fd');
- return binding.fdatasync(fd);
+ const ctx = {};
+ binding.fdatasync(fd, undefined, ctx);
+ if (ctx.errno !== undefined) {
+ throw new errors.uvException(ctx);
+ }
};
fs.fsync = function(fd, callback) {
@@ -1033,7 +1045,11 @@ fs.fsync = function(fd, callback) {
fs.fsyncSync = function(fd) {
validateUint32(fd, 'fd');
- return binding.fsync(fd);
+ const ctx = {};
+ binding.fsync(fd, undefined, ctx);
+ if (ctx.errno !== undefined) {
+ throw new errors.uvException(ctx);
+ }
};
fs.mkdir = function(path, mode, callback) {
@@ -1163,7 +1179,13 @@ fs.readlinkSync = function(path, options) {
handleError((path = getPathFromURL(path)));
nullCheck(path);
validatePath(path, 'oldPath');
- return binding.readlink(pathModule.toNamespacedPath(path), options.encoding);
+ const ctx = { path };
+ const result = binding.readlink(pathModule.toNamespacedPath(path),
+ options.encoding, undefined, ctx);
+ if (ctx.errno !== undefined) {
+ throw new errors.uvException(ctx);
+ }
+ return result;
};
function preprocessSymlinkDestination(path, type, linkPath) {
@@ -1220,6 +1242,7 @@ fs.symlink = function(target, path, type_, callback_) {
const flags = stringToSymlinkType(type);
const req = new FSReqWrap();
req.oncomplete = callback;
+
binding.symlink(preprocessSymlinkDestination(target, type, path),
pathModule.toNamespacedPath(path), flags, req);
};
@@ -1234,8 +1257,19 @@ fs.symlinkSync = function(target, path, type) {
validatePath(target, 'target');
validatePath(path);
const flags = stringToSymlinkType(type);
- return binding.symlink(preprocessSymlinkDestination(target, type, path),
- pathModule.toNamespacedPath(path), flags);
+
+ const ctx = { path: target, dest: path };
+ binding.symlink(preprocessSymlinkDestination(target, type, path),
+ pathModule.toNamespacedPath(path), flags, undefined, ctx);
+
+ if (ctx.errno !== undefined) {
+ throw new errors.uvException(ctx);
+ } else if (ctx.error) {
+ // TODO(joyeecheung): this is an encoding error usually caused by memory
+ // problems. We need to figure out proper error code(s) for this.
+ Error.captureStackTrace(ctx.error);
+ throw ctx.error;
+ }
};
fs.link = function(existingPath, newPath, callback) {
@@ -1268,8 +1302,15 @@ fs.linkSync = function(existingPath, newPath) {
nullCheck(newPath);
validatePath(existingPath, 'existingPath');
validatePath(newPath, 'newPath');
- return binding.link(pathModule.toNamespacedPath(existingPath),
- pathModule.toNamespacedPath(newPath));
+
+ const ctx = { path: existingPath, dest: newPath };
+ const result = binding.link(pathModule.toNamespacedPath(existingPath),
+ pathModule.toNamespacedPath(newPath),
+ undefined, ctx);
+ if (ctx.errno !== undefined) {
+ throw new errors.uvException(ctx);
+ }
+ return result;
};
fs.unlink = function(path, callback) {
@@ -1287,7 +1328,11 @@ fs.unlinkSync = function(path) {
handleError((path = getPathFromURL(path)));
nullCheck(path);
validatePath(path);
- return binding.unlink(pathModule.toNamespacedPath(path));
+ const ctx = { path };
+ binding.unlink(pathModule.toNamespacedPath(path), undefined, ctx);
+ if (ctx.errno !== undefined) {
+ throw new errors.uvException(ctx);
+ }
};
fs.fchmod = function(fd, mode, callback) {
@@ -1963,7 +2008,10 @@ fs.realpathSync = function realpathSync(p, options) {
if (ctx.errno !== undefined) {
throw new errors.uvException(ctx);
}
- linkTarget = binding.readlink(baseLong);
+ linkTarget = binding.readlink(baseLong, undefined, undefined, ctx);
+ if (ctx.errno !== undefined) {
+ throw new errors.uvException(ctx);
+ }
}
resolvedLink = pathModule.resolve(previous, linkTarget);
diff --git a/lib/internal/async_hooks.js b/lib/internal/async_hooks.js
index f1c98f13ac0..92cd9ba1e42 100644
--- a/lib/internal/async_hooks.js
+++ b/lib/internal/async_hooks.js
@@ -11,16 +11,17 @@ const async_wrap = process.binding('async_wrap');
* the various asynchronous states of the application. These are:
* kExecutionAsyncId: The async_id assigned to the resource responsible for the
* current execution stack.
- * kTriggerAsyncId: The trigger_async_id of the resource responsible for
- * the current execution stack.
+ * kTriggerAsyncId: The async_id of the resource that caused (or 'triggered')
+ * the resource corresponding to the current execution stack.
* kAsyncIdCounter: Incremental counter tracking the next assigned async_id.
* kDefaultTriggerAsyncId: Written immediately before a resource's constructor
- * that sets the value of the init()'s triggerAsyncId. The order of
- * retrieving the triggerAsyncId value is passing directly to the
- * constructor -> value set in kDefaultTriggerAsyncId -> executionAsyncId of
- * the current resource.
+ * that sets the value of the init()'s triggerAsyncId. The precedence order
+ * of retrieving the triggerAsyncId value is:
+ * 1. the value passed directly to the constructor
+ * 2. value set in kDefaultTriggerAsyncId
+ * 3. executionAsyncId of the current resource.
*
- * async_ids_fast_stack is a Float64Array that contains part of the async ID
+ * async_ids_stack is a Float64Array that contains part of the async ID
* stack. Each pushAsyncIds() call adds two doubles to it, and each
* popAsyncIds() call removes two doubles from it.
* It has a fixed size, so if that is exceeded, calls to the native
@@ -28,10 +29,10 @@ const async_wrap = process.binding('async_wrap');
*/
const { async_id_symbol, async_hook_fields, async_id_fields } = async_wrap;
// Store the pair executionAsyncId and triggerAsyncId in a std::stack on
-// Environment::AsyncHooks::ids_stack_ tracks the resource responsible for the
-// current execution stack. This is unwound as each resource exits. In the case
-// of a fatal exception this stack is emptied after calling each hook's after()
-// callback.
+// Environment::AsyncHooks::async_ids_stack_ tracks the resource responsible for
+// the current execution stack. This is unwound as each resource exits. In the
+// case of a fatal exception this stack is emptied after calling each hook's
+// after() callback.
const { pushAsyncIds: pushAsyncIds_, popAsyncIds: popAsyncIds_ } = async_wrap;
// For performance reasons, only track Promises when a hook is enabled.
const { enablePromiseHook, disablePromiseHook } = async_wrap;
diff --git a/lib/internal/bootstrap_node.js b/lib/internal/bootstrap_node.js
index 8bdb4916283..4c58e091779 100644
--- a/lib/internal/bootstrap_node.js
+++ b/lib/internal/bootstrap_node.js
@@ -76,11 +76,7 @@
NativeModule.require('internal/inspector_async_hook').setup();
NativeModule.require('trace_mgr'); //ENABLE_TTD;
- // Do not initialize channel in debugger agent, it deletes env variable
- // and the main thread won't see it.
- if (process.argv[1] !== '--debug-agent')
- _process.setupChannel();
-
+ _process.setupChannel();
_process.setupRawDebug();
const browserGlobals = !process._noBrowserGlobals;
@@ -119,6 +115,7 @@
process.emitWarning(
'The ESM module loader is experimental.',
'ExperimentalWarning', undefined);
+ NativeModule.require('internal/process/modules').setup();
}
diff --git a/lib/internal/child_process.js b/lib/internal/child_process.js
index eb17ec21d40..2bade01f95f 100644
--- a/lib/internal/child_process.js
+++ b/lib/internal/child_process.js
@@ -465,7 +465,10 @@ function setupChannel(target, channel) {
var jsonBuffer = '';
var pendingHandle = null;
channel.buffering = false;
- channel.onread = function(nread, pool, recvHandle) {
+ channel.pendingHandle = null;
+ channel.onread = function(nread, pool) {
+ const recvHandle = channel.pendingHandle;
+ channel.pendingHandle = null;
// TODO(bnoordhuis) Check that nread > 0.
if (pool) {
if (recvHandle)
diff --git a/lib/internal/encoding.js b/lib/internal/encoding.js
index 763ee42426b..fa178f3a8c7 100644
--- a/lib/internal/encoding.js
+++ b/lib/internal/encoding.js
@@ -32,6 +32,21 @@ function lazyBuffer() {
return Buffer;
}
+function validateEncoder(obj) {
+ if (obj == null || obj[kEncoder] !== true)
+ throw new errors.TypeError('ERR_INVALID_THIS', 'TextEncoder');
+}
+
+function validateDecoder(obj) {
+ if (obj == null || obj[kDecoder] !== true)
+ throw new errors.TypeError('ERR_INVALID_THIS', 'TextDecoder');
+}
+
+function validateArgument(prop, expected, propName, expectedName) {
+ if (typeof prop !== expected)
+ throw new errors.Error('ERR_INVALID_ARG_TYPE', propName, expectedName);
+}
+
const CONVERTER_FLAGS_FLUSH = 0x1;
const CONVERTER_FLAGS_FATAL = 0x2;
const CONVERTER_FLAGS_IGNORE_BOM = 0x4;
@@ -288,20 +303,17 @@ class TextEncoder {
}
get encoding() {
- if (this == null || this[kEncoder] !== true)
- throw new errors.TypeError('ERR_INVALID_THIS', 'TextEncoder');
+ validateEncoder(this);
return 'utf-8';
}
encode(input = '') {
- if (this == null || this[kEncoder] !== true)
- throw new errors.TypeError('ERR_INVALID_THIS', 'TextEncoder');
+ validateEncoder(this);
return encodeUtf8String(`${input}`);
}
[inspect](depth, opts) {
- if (this == null || this[kEncoder] !== true)
- throw new errors.TypeError('ERR_INVALID_THIS', 'TextEncoder');
+ validateEncoder(this);
if (typeof depth === 'number' && depth < 0)
return opts.stylize('[Object]', 'special');
var ctor = getConstructorOf(this);
@@ -329,8 +341,7 @@ const { hasConverter, TextDecoder } =
makeTextDecoderJS();
function hasTextDecoder(encoding = 'utf-8') {
- if (typeof encoding !== 'string')
- throw new errors.Error('ERR_INVALID_ARG_TYPE', 'encoding', 'string');
+ validateArgument(encoding, 'string', 'encoding', 'string');
return hasConverter(getEncodingFromLabel(encoding));
}
@@ -344,8 +355,7 @@ function makeTextDecoderICU() {
class TextDecoder {
constructor(encoding = 'utf-8', options = {}) {
encoding = `${encoding}`;
- if (typeof options !== 'object')
- throw new errors.Error('ERR_INVALID_ARG_TYPE', 'options', 'Object');
+ validateArgument(options, 'object', 'options', 'Object');
const enc = getEncodingFromLabel(encoding);
if (enc === undefined)
@@ -369,17 +379,14 @@ function makeTextDecoderICU() {
decode(input = empty, options = {}) {
- if (this == null || this[kDecoder] !== true)
- throw new errors.TypeError('ERR_INVALID_THIS', 'TextDecoder');
+ validateDecoder(this);
if (isArrayBuffer(input)) {
input = lazyBuffer().from(input);
} else if (!isArrayBufferView(input)) {
throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'input',
['ArrayBuffer', 'ArrayBufferView']);
}
- if (typeof options !== 'object') {
- throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'options', 'Object');
- }
+ validateArgument(options, 'object', 'options', 'Object');
var flags = 0;
if (options !== null)
@@ -416,8 +423,7 @@ function makeTextDecoderJS() {
class TextDecoder {
constructor(encoding = 'utf-8', options = {}) {
encoding = `${encoding}`;
- if (typeof options !== 'object')
- throw new errors.Error('ERR_INVALID_ARG_TYPE', 'options', 'Object');
+ validateArgument(options, 'object', 'options', 'Object');
const enc = getEncodingFromLabel(encoding);
if (enc === undefined || !hasConverter(enc))
@@ -440,8 +446,7 @@ function makeTextDecoderJS() {
}
decode(input = empty, options = {}) {
- if (this == null || this[kDecoder] !== true)
- throw new errors.TypeError('ERR_INVALID_THIS', 'TextDecoder');
+ validateDecoder(this);
if (isArrayBuffer(input)) {
input = lazyBuffer().from(input);
} else if (isArrayBufferView(input)) {
@@ -451,9 +456,7 @@ function makeTextDecoderJS() {
throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'input',
['ArrayBuffer', 'ArrayBufferView']);
}
- if (typeof options !== 'object') {
- throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'options', 'Object');
- }
+ validateArgument(options, 'object', 'options', 'Object');
if (this[kFlags] & CONVERTER_FLAGS_FLUSH) {
this[kBOMSeen] = false;
@@ -496,27 +499,23 @@ function makeTextDecoderJS() {
TextDecoder.prototype,
Object.getOwnPropertyDescriptors({
get encoding() {
- if (this == null || this[kDecoder] !== true)
- throw new errors.TypeError('ERR_INVALID_THIS', 'TextDecoder');
+ validateDecoder(this);
return this[kEncoding];
},
get fatal() {
- if (this == null || this[kDecoder] !== true)
- throw new errors.TypeError('ERR_INVALID_THIS', 'TextDecoder');
+ validateDecoder(this);
return (this[kFlags] & CONVERTER_FLAGS_FATAL) === CONVERTER_FLAGS_FATAL;
},
get ignoreBOM() {
- if (this == null || this[kDecoder] !== true)
- throw new errors.TypeError('ERR_INVALID_THIS', 'TextDecoder');
+ validateDecoder(this);
return (this[kFlags] & CONVERTER_FLAGS_IGNORE_BOM) ===
CONVERTER_FLAGS_IGNORE_BOM;
},
[inspect](depth, opts) {
- if (this == null || this[kDecoder] !== true)
- throw new errors.TypeError('ERR_INVALID_THIS', 'TextDecoder');
+ validateDecoder(this);
if (typeof depth === 'number' && depth < 0)
return opts.stylize('[Object]', 'special');
var ctor = getConstructorOf(this);
diff --git a/lib/internal/loader/ModuleJob.js b/lib/internal/loader/ModuleJob.js
index 2d6325b85c6..db37765b20b 100644
--- a/lib/internal/loader/ModuleJob.js
+++ b/lib/internal/loader/ModuleJob.js
@@ -6,9 +6,6 @@ const { decorateErrorStack } = require('internal/util');
const assert = require('assert');
const resolvedPromise = SafePromise.resolve();
-const enableDebug = (process.env.NODE_DEBUG || '').match(/\besm\b/) ||
- process.features.debug;
-
/* A ModuleJob tracks the loading of a single Module, and the ModuleJobs of
* its dependencies, over time. */
class ModuleJob {
@@ -27,7 +24,6 @@ class ModuleJob {
// Wait for the ModuleWrap instance being linked with all dependencies.
const link = async () => {
- const dependencyJobs = [];
({ module: this.module,
reflect: this.reflect } = await this.modulePromise);
if (inspectBrk) {
@@ -35,17 +31,17 @@ class ModuleJob {
initWrapper(this.module.instantiate, this.module);
}
assert(this.module instanceof ModuleWrap);
- this.module.link(async (dependencySpecifier) => {
- const dependencyJobPromise =
- this.loader.getModuleJob(dependencySpecifier, url);
- dependencyJobs.push(dependencyJobPromise);
- const dependencyJob = await dependencyJobPromise;
- return (await dependencyJob.modulePromise).module;
+
+ const dependencyJobs = [];
+ const promises = this.module.link(async (specifier) => {
+ const jobPromise = this.loader.getModuleJob(specifier, url);
+ dependencyJobs.push(jobPromise);
+ return (await (await jobPromise).modulePromise).module;
});
- if (enableDebug) {
- // Make sure all dependencies are entered into the list synchronously.
- Object.freeze(dependencyJobs);
- }
+
+ if (promises !== undefined)
+ await SafePromise.all(promises);
+
return SafePromise.all(dependencyJobs);
};
// Promise for the list of all dependencyJobs.
diff --git a/lib/internal/process/modules.js b/lib/internal/process/modules.js
new file mode 100644
index 00000000000..eda47f80cdd
--- /dev/null
+++ b/lib/internal/process/modules.js
@@ -0,0 +1,17 @@
+'use strict';
+
+const {
+ setInitializeImportMetaObjectCallback
+} = internalBinding('module_wrap');
+
+function initializeImportMetaObject(wrap, meta) {
+ meta.url = wrap.url;
+}
+
+function setupModules() {
+ setInitializeImportMetaObjectCallback(initializeImportMetaObject);
+}
+
+module.exports = {
+ setup: setupModules
+};
diff --git a/lib/internal/streams/BufferList.js b/lib/internal/streams/BufferList.js
index b3980e007a4..a72bf37a314 100644
--- a/lib/internal/streams/BufferList.js
+++ b/lib/internal/streams/BufferList.js
@@ -73,6 +73,91 @@ module.exports = class BufferList {
return ret;
}
+ // Consumes a specified amount of bytes or characters from the buffered data.
+ consume(n, hasStrings) {
+ var ret;
+ if (n < this.head.data.length) {
+ // `slice` is the same for buffers and strings.
+ ret = this.head.data.slice(0, n);
+ this.head.data = this.head.data.slice(n);
+ } else if (n === this.head.data.length) {
+ // First chunk is a perfect match.
+ ret = this.shift();
+ } else {
+ // Result spans more than one buffer.
+ ret = hasStrings ? this._getString(n) : this._getBuffer(n);
+ }
+ return ret;
+ }
+
+ first() {
+ return this.head.data;
+ }
+
+ // Consumes a specified amount of characters from the buffered data.
+ _getString(n) {
+ var p = this.head;
+ var c = 1;
+ var ret = p.data;
+ n -= ret.length;
+ while (p = p.next) {
+ const str = p.data;
+ const nb = (n > str.length ? str.length : n);
+ if (nb === str.length)
+ ret += str;
+ else
+ ret += str.slice(0, n);
+ n -= nb;
+ if (n === 0) {
+ if (nb === str.length) {
+ ++c;
+ if (p.next)
+ this.head = p.next;
+ else
+ this.head = this.tail = null;
+ } else {
+ this.head = p;
+ p.data = str.slice(nb);
+ }
+ break;
+ }
+ ++c;
+ }
+ this.length -= c;
+ return ret;
+ }
+
+ // Consumes a specified amount of bytes from the buffered data.
+ _getBuffer(n) {
+ const ret = Buffer.allocUnsafe(n);
+ var p = this.head;
+ var c = 1;
+ p.data.copy(ret);
+ n -= p.data.length;
+ while (p = p.next) {
+ const buf = p.data;
+ const nb = (n > buf.length ? buf.length : n);
+ buf.copy(ret, ret.length - n, 0, nb);
+ n -= nb;
+ if (n === 0) {
+ if (nb === buf.length) {
+ ++c;
+ if (p.next)
+ this.head = p.next;
+ else
+ this.head = this.tail = null;
+ } else {
+ this.head = p;
+ p.data = buf.slice(nb);
+ }
+ break;
+ }
+ ++c;
+ }
+ this.length -= c;
+ return ret;
+ }
+
[inspect.custom]() {
const obj = inspect({ length: this.length });
return `${this.constructor.name} ${obj}`;
diff --git a/lib/perf_hooks.js b/lib/perf_hooks.js
index 15256a63c0b..6fd6e4a6b76 100644
--- a/lib/perf_hooks.js
+++ b/lib/perf_hooks.js
@@ -53,6 +53,9 @@ const kClearEntry = Symbol('clear-entry');
const kGetEntries = Symbol('get-entries');
const kIndex = Symbol('index');
const kMarks = Symbol('marks');
+const kCount = Symbol('count');
+const kMaxCount = Symbol('max-count');
+const kDefaultMaxCount = 150;
observerCounts[NODE_PERFORMANCE_ENTRY_TYPE_MARK] = 1;
observerCounts[NODE_PERFORMANCE_ENTRY_TYPE_MEASURE] = 1;
@@ -250,10 +253,17 @@ const nodeTiming = new PerformanceNodeTiming();
// Maintains a list of entries as a linked list stored in insertion order.
class PerformanceObserverEntryList {
constructor() {
- Object.defineProperty(this, kEntries, {
- writable: true,
- enumerable: false,
- value: {}
+ Object.defineProperties(this, {
+ [kEntries]: {
+ writable: true,
+ enumerable: false,
+ value: {}
+ },
+ [kCount]: {
+ writable: true,
+ enumerable: false,
+ value: 0
+ }
});
L.init(this[kEntries]);
}
@@ -261,9 +271,14 @@ class PerformanceObserverEntryList {
[kInsertEntry](entry) {
const item = { entry };
L.append(this[kEntries], item);
+ this[kCount]++;
this[kIndexEntry](item);
}
+ get length() {
+ return this[kCount];
+ }
+
[kIndexEntry](entry) {
// Default implementation does nothing
}
@@ -384,9 +399,22 @@ class Performance extends PerformanceObserverEntryList {
this[kIndex] = {
[kMarks]: new Set()
};
+ this[kMaxCount] = kDefaultMaxCount;
this[kInsertEntry](nodeTiming);
}
+ set maxEntries(val) {
+ if (typeof val !== 'number' || val >>> 0 !== val) {
+ const errors = lazyErrors();
+ throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'val', 'number');
+ }
+ this[kMaxCount] = Math.max(1, val >>> 0);
+ }
+
+ get maxEntries() {
+ return this[kMaxCount];
+ }
+
[kIndexEntry](item) {
const index = this[kIndex];
const type = item.entry.entryType;
@@ -397,6 +425,17 @@ class Performance extends PerformanceObserverEntryList {
}
const entry = item.entry;
L.append(items, { entry, item });
+ const count = this[kCount];
+ if (count > this[kMaxCount]) {
+ const text = count === 1 ? 'is 1 entry' : `are ${count} entries`;
+ process.emitWarning('Possible perf_hooks memory leak detected. ' +
+ `There ${text} in the ` +
+ 'Performance Timeline. Use the clear methods ' +
+ 'to remove entries that are no longer needed or ' +
+ 'set performance.maxEntries equal to a higher ' +
+ 'value (currently the maxEntries is ' +
+ `${this[kMaxCount]}).`);
+ }
}
[kClearEntry](type, name) {
@@ -411,10 +450,12 @@ class Performance extends PerformanceObserverEntryList {
if (entry.name === `${name}`) {
L.remove(item); // remove from the index
L.remove(item.item); // remove from the master
+ this[kCount]--;
}
} else {
L.remove(item); // remove from the index
L.remove(item.item); // remove from the master
+ this[kCount]--;
}
item = next;
}
diff --git a/lib/util.js b/lib/util.js
index 0f0ed408ba4..4525792b2ec 100644
--- a/lib/util.js
+++ b/lib/util.js
@@ -342,6 +342,7 @@ inspect.colors = Object.assign(Object.create(null), {
inspect.styles = Object.assign(Object.create(null), {
'special': 'cyan',
'number': 'yellow',
+ 'bigint': 'yellow',
'boolean': 'yellow',
'undefined': 'grey',
'null': 'bold',
@@ -650,6 +651,9 @@ function formatPrimitive(fn, value, ctx) {
}
if (typeof value === 'number')
return formatNumber(fn, value);
+ // eslint-disable-next-line valid-typeof
+ if (typeof value === 'bigint')
+ return fn(`${value}n`, 'bigint');
if (typeof value === 'boolean')
return fn(`${value}`, 'boolean');
if (typeof value === 'undefined')
diff --git a/node.gyp b/node.gyp
index 7623a9ebb04..68fcb67d70d 100644
--- a/node.gyp
+++ b/node.gyp
@@ -114,6 +114,7 @@
'lib/internal/net.js',
'lib/internal/module.js',
'lib/internal/os.js',
+ 'lib/internal/process/modules.js',
'lib/internal/process/next_tick.js',
'lib/internal/process/promises.js',
'lib/internal/process/stdio.js',
@@ -249,7 +250,7 @@
'conditions': [
['OS in "linux freebsd openbsd solaris android"', {
'ldflags': [
- '-Wl,--whole-archive,<(OBJ_DIR)/<(STATIC_LIB_PREFIX)'
+ '-Wl,--whole-archive,<(obj_dir)/<(STATIC_LIB_PREFIX)'
'<(node_core_target_name)<(STATIC_LIB_SUFFIX)',
'-Wl,--no-whole-archive',
],
@@ -817,10 +818,10 @@
{
'action_name': 'node_dtrace_provider_o',
'inputs': [
- '<(OBJ_DIR)/<(node_lib_target_name)/src/node_dtrace.o',
+ '<(obj_dir)/<(node_lib_target_name)/src/node_dtrace.o',
],
'outputs': [
- '<(OBJ_DIR)/<(node_lib_target_name)/src/node_dtrace_provider.o'
+ '<(obj_dir)/<(node_lib_target_name)/src/node_dtrace_provider.o'
],
'action': [ 'dtrace', '-G', '-xnolibs', '-s', 'src/node_provider.d',
'<@(_inputs)', '-o', '<@(_outputs)' ]
@@ -852,7 +853,7 @@
{
'action_name': 'node_dtrace_ustack_constants',
'inputs': [
- '<(V8_BASE)'
+ '<(v8_base)'
],
'outputs': [
'<(SHARED_INTERMEDIATE_DIR)/v8constants.h'
@@ -870,7 +871,7 @@
'<(SHARED_INTERMEDIATE_DIR)/v8constants.h'
],
'outputs': [
- '<(OBJ_DIR)/<(node_lib_target_name)/src/node_dtrace_ustack.o'
+ '<(obj_dir)/<(node_lib_target_name)/src/node_dtrace_ustack.o'
],
'conditions': [
[ 'target_arch=="ia32" or target_arch=="arm"', {
@@ -960,32 +961,32 @@
],
'variables': {
- 'OBJ_PATH': '<(OBJ_DIR)/<(node_lib_target_name)/src',
- 'OBJ_GEN_PATH': '<(OBJ_DIR)/<(node_lib_target_name)/gen',
- 'OBJ_TRACING_PATH': '<(OBJ_DIR)/<(node_lib_target_name)/src/tracing',
- 'OBJ_SUFFIX': 'o',
- 'OBJ_SEPARATOR': '/',
+ 'obj_path': '<(obj_dir)/<(node_lib_target_name)/src',
+ 'obj_gen_path': '<(obj_dir)/<(node_lib_target_name)/gen',
+ 'obj_tracing_path': '<(obj_dir)/<(node_lib_target_name)/src/tracing',
+ 'obj_suffix': 'o',
+ 'obj_separator': '/',
'conditions': [
['OS=="win"', {
- 'OBJ_SUFFIX': 'obj',
+ 'obj_suffix': 'obj',
}],
['GENERATOR=="ninja"', {
- 'OBJ_PATH': '<(OBJ_DIR)/src',
- 'OBJ_GEN_PATH': '<(OBJ_DIR)/gen',
- 'OBJ_TRACING_PATH': '<(OBJ_DIR)/src/tracing',
- 'OBJ_SEPARATOR': '/<(node_lib_target_name).',
+ 'obj_path': '<(obj_dir)/src',
+ 'obj_gen_path': '<(obj_dir)/gen',
+ 'obj_tracing_path': '<(obj_dir)/src/tracing',
+ 'obj_separator': '/<(node_lib_target_name).',
}, {
'conditions': [
['OS=="win"', {
- 'OBJ_PATH': '<(OBJ_DIR)/<(node_lib_target_name)',
- 'OBJ_GEN_PATH': '<(OBJ_DIR)/<(node_lib_target_name)',
- 'OBJ_TRACING_PATH': '<(OBJ_DIR)/<(node_lib_target_name)',
+ 'obj_path': '<(obj_dir)/<(node_lib_target_name)',
+ 'obj_gen_path': '<(obj_dir)/<(node_lib_target_name)',
+ 'obj_tracing_path': '<(obj_dir)/<(node_lib_target_name)',
}],
['OS=="aix"', {
- 'OBJ_PATH': '<(OBJ_DIR)/<(node_lib_target_name)/src',
- 'OBJ_GEN_PATH': '<(OBJ_DIR)/<(node_lib_target_name)/gen',
- 'OBJ_TRACING_PATH':
- '<(OBJ_DIR)/<(node_lib_target_name)/src/tracing',
+ 'obj_path': '<(obj_dir)/<(node_lib_target_name)/src',
+ 'obj_gen_path': '<(obj_dir)/<(node_lib_target_name)/gen',
+ 'obj_tracing_path':
+ '<(obj_dir)/<(node_lib_target_name)/src/tracing',
}],
]}
]
@@ -1017,26 +1018,26 @@
'test/cctest/test_url.cc'
],
'libraries': [
- '<(OBJ_PATH)<(OBJ_SEPARATOR)async_wrap.<(OBJ_SUFFIX)',
- '<(OBJ_PATH)<(OBJ_SEPARATOR)handle_wrap.<(OBJ_SUFFIX)',
- '<(OBJ_PATH)<(OBJ_SEPARATOR)env.<(OBJ_SUFFIX)',
- '<(OBJ_PATH)<(OBJ_SEPARATOR)node.<(OBJ_SUFFIX)',
- '<(OBJ_PATH)<(OBJ_SEPARATOR)node_buffer.<(OBJ_SUFFIX)',
- '<(OBJ_PATH)<(OBJ_SEPARATOR)node_debug_options.<(OBJ_SUFFIX)',
- '<(OBJ_PATH)<(OBJ_SEPARATOR)node_i18n.<(OBJ_SUFFIX)',
- '<(OBJ_PATH)<(OBJ_SEPARATOR)node_perf.<(OBJ_SUFFIX)',
- '<(OBJ_PATH)<(OBJ_SEPARATOR)node_platform.<(OBJ_SUFFIX)',
- '<(OBJ_PATH)<(OBJ_SEPARATOR)node_url.<(OBJ_SUFFIX)',
- '<(OBJ_PATH)<(OBJ_SEPARATOR)util.<(OBJ_SUFFIX)',
- '<(OBJ_PATH)<(OBJ_SEPARATOR)string_bytes.<(OBJ_SUFFIX)',
- '<(OBJ_PATH)<(OBJ_SEPARATOR)string_search.<(OBJ_SUFFIX)',
- '<(OBJ_PATH)<(OBJ_SEPARATOR)stream_base.<(OBJ_SUFFIX)',
- '<(OBJ_PATH)<(OBJ_SEPARATOR)node_constants.<(OBJ_SUFFIX)',
- '<(OBJ_TRACING_PATH)<(OBJ_SEPARATOR)agent.<(OBJ_SUFFIX)',
- '<(OBJ_TRACING_PATH)<(OBJ_SEPARATOR)node_trace_buffer.<(OBJ_SUFFIX)',
- '<(OBJ_TRACING_PATH)<(OBJ_SEPARATOR)node_trace_writer.<(OBJ_SUFFIX)',
- '<(OBJ_TRACING_PATH)<(OBJ_SEPARATOR)trace_event.<(OBJ_SUFFIX)',
- '<(OBJ_GEN_PATH)<(OBJ_SEPARATOR)node_javascript.<(OBJ_SUFFIX)',
+ '<(obj_path)<(obj_separator)async_wrap.<(obj_suffix)',
+ '<(obj_path)<(obj_separator)handle_wrap.<(obj_suffix)',
+ '<(obj_path)<(obj_separator)env.<(obj_suffix)',
+ '<(obj_path)<(obj_separator)node.<(obj_suffix)',
+ '<(obj_path)<(obj_separator)node_buffer.<(obj_suffix)',
+ '<(obj_path)<(obj_separator)node_debug_options.<(obj_suffix)',
+ '<(obj_path)<(obj_separator)node_i18n.<(obj_suffix)',
+ '<(obj_path)<(obj_separator)node_perf.<(obj_suffix)',
+ '<(obj_path)<(obj_separator)node_platform.<(obj_suffix)',
+ '<(obj_path)<(obj_separator)node_url.<(obj_suffix)',
+ '<(obj_path)<(obj_separator)util.<(obj_suffix)',
+ '<(obj_path)<(obj_separator)string_bytes.<(obj_suffix)',
+ '<(obj_path)<(obj_separator)string_search.<(obj_suffix)',
+ '<(obj_path)<(obj_separator)stream_base.<(obj_suffix)',
+ '<(obj_path)<(obj_separator)node_constants.<(obj_suffix)',
+ '<(obj_tracing_path)<(obj_separator)agent.<(obj_suffix)',
+ '<(obj_tracing_path)<(obj_separator)node_trace_buffer.<(obj_suffix)',
+ '<(obj_tracing_path)<(obj_separator)node_trace_writer.<(obj_suffix)',
+ '<(obj_tracing_path)<(obj_separator)trace_event.<(obj_suffix)',
+ '<(obj_gen_path)<(obj_separator)node_javascript.<(obj_suffix)',
],
'conditions': [
@@ -1073,10 +1074,10 @@
'conditions': [
['node_target_type!="static_library"', {
'libraries': [
- '<(OBJ_PATH)<(OBJ_SEPARATOR)node_crypto.<(OBJ_SUFFIX)',
- '<(OBJ_PATH)<(OBJ_SEPARATOR)node_crypto_bio.<(OBJ_SUFFIX)',
- '<(OBJ_PATH)<(OBJ_SEPARATOR)node_crypto_clienthello.<(OBJ_SUFFIX)',
- '<(OBJ_PATH)<(OBJ_SEPARATOR)tls_wrap.<(OBJ_SUFFIX)',
+ '<(obj_path)<(obj_separator)node_crypto.<(obj_suffix)',
+ '<(obj_path)<(obj_separator)node_crypto_bio.<(obj_suffix)',
+ '<(obj_path)<(obj_separator)node_crypto_clienthello.<(obj_suffix)',
+ '<(obj_path)<(obj_separator)tls_wrap.<(obj_suffix)',
],
}],
],
@@ -1090,9 +1091,9 @@
[ 'node_use_perfctr=="true"', {
'defines': [ 'HAVE_PERFCTR=1' ],
'libraries': [
- '<(OBJ_PATH)<(OBJ_SEPARATOR)node_counters.<(OBJ_SUFFIX)',
- '<(OBJ_PATH)<(OBJ_SEPARATOR)'
- 'node_win32_perfctr_provider.<(OBJ_SUFFIX)',
+ '<(obj_path)<(obj_separator)node_counters.<(obj_suffix)',
+ '<(obj_path)<(obj_separator)'
+ 'node_win32_perfctr_provider.<(obj_suffix)',
],
}],
['v8_enable_inspector==1', {
@@ -1103,11 +1104,11 @@
'conditions': [
['node_target_type!="static_library"', {
'libraries': [
- '<(OBJ_PATH)<(OBJ_SEPARATOR)inspector_agent.<(OBJ_SUFFIX)',
- '<(OBJ_PATH)<(OBJ_SEPARATOR)inspector_io.<(OBJ_SUFFIX)',
- '<(OBJ_PATH)<(OBJ_SEPARATOR)inspector_js_api.<(OBJ_SUFFIX)',
- '<(OBJ_PATH)<(OBJ_SEPARATOR)inspector_socket.<(OBJ_SUFFIX)',
- '<(OBJ_PATH)<(OBJ_SEPARATOR)inspector_socket_server.<(OBJ_SUFFIX)',
+ '<(obj_path)<(obj_separator)inspector_agent.<(obj_suffix)',
+ '<(obj_path)<(obj_separator)inspector_io.<(obj_suffix)',
+ '<(obj_path)<(obj_separator)inspector_js_api.<(obj_suffix)',
+ '<(obj_path)<(obj_separator)inspector_socket.<(obj_suffix)',
+ '<(obj_path)<(obj_separator)inspector_socket_server.<(obj_suffix)',
],
}],
],
@@ -1117,19 +1118,19 @@
}],
[ 'node_use_dtrace=="true" and node_target_type!="static_library"', {
'libraries': [
- '<(OBJ_PATH)<(OBJ_SEPARATOR)node_dtrace.<(OBJ_SUFFIX)',
+ '<(obj_path)<(obj_separator)node_dtrace.<(obj_suffix)',
],
'conditions': [
['OS!="mac" and OS!="linux"', {
'libraries': [
- '<(OBJ_PATH)<(OBJ_SEPARATOR)node_dtrace_provider.<(OBJ_SUFFIX)',
- '<(OBJ_PATH)<(OBJ_SEPARATOR)node_dtrace_ustack.<(OBJ_SUFFIX)',
+ '<(obj_path)<(obj_separator)node_dtrace_provider.<(obj_suffix)',
+ '<(obj_path)<(obj_separator)node_dtrace_ustack.<(obj_suffix)',
]
}],
['OS=="linux"', {
'libraries': [
- '<(SHARED_INTERMEDIATE_DIR)<(OBJ_SEPARATOR)'
- 'node_dtrace_provider.<(OBJ_SUFFIX)',
+ '<(SHARED_INTERMEDIATE_DIR)<(obj_separator)'
+ 'node_dtrace_provider.<(obj_suffix)',
]
}],
],
@@ -1137,16 +1138,16 @@
'conditions': [
[ 'node_use_etw=="true" and OS=="win"', {
'libraries': [
- '<(OBJ_PATH)<(OBJ_SEPARATOR)node_dtrace.<(OBJ_SUFFIX)',
- '<(OBJ_PATH)<(OBJ_SEPARATOR)'
- 'node_win32_etw_provider.<(OBJ_SUFFIX)',
+ '<(obj_path)<(obj_separator)node_dtrace.<(obj_suffix)',
+ '<(obj_path)<(obj_separator)'
+ 'node_win32_etw_provider.<(obj_suffix)',
],
}]
]
}],
[ 'OS=="win" and node_target_type!="static_library"', {
'libraries': [
- '<(OBJ_PATH)<(OBJ_SEPARATOR)backtrace_win32.<(OBJ_SUFFIX)',
+ '<(obj_path)<(obj_separator)backtrace_win32.<(obj_suffix)',
],
'conditions': [
# this is only necessary for chakra on windows because chakra is dynamically linked on windows
@@ -1158,7 +1159,7 @@
'conditions': [
['node_target_type!="static_library"', {
'libraries': [
- '<(OBJ_PATH)<(OBJ_SEPARATOR)backtrace_posix.<(OBJ_SUFFIX)',
+ '<(obj_path)<(obj_separator)backtrace_posix.<(obj_suffix)',
],
}],
],
diff --git a/node.gypi b/node.gypi
index 7e972b833eb..50237106a6c 100644
--- a/node.gypi
+++ b/node.gypi
@@ -99,7 +99,7 @@
[ 'force_load=="true"', {
'xcode_settings': {
'OTHER_LDFLAGS': [
- '-Wl,-force_load,<(V8_BASE)',
+ '-Wl,-force_load,<(v8_base)',
],
},
}],
@@ -117,7 +117,7 @@
[ 'force_load=="true"', {
'xcode_settings': {
'OTHER_LDFLAGS': [
- '-Wl,-force_load,<(CHAKRASHIM_BASE)',
+ '-Wl,-force_load,<(chakrashim_base)',
],
},
}],
@@ -172,7 +172,7 @@
{
'action_name': 'expfile',
'inputs': [
- '<(OBJ_DIR)'
+ '<(obj_dir)'
],
'outputs': [
'<(PRODUCT_DIR)/node.exp'
@@ -206,11 +206,11 @@
'ldflags': [ '-Wl,-z,noexecstack' ],
'conditions': [
[ 'node_engine=="v8"', {
- 'ldflags': [ '-Wl,--whole-archive <(V8_BASE)',
+ 'ldflags': [ '-Wl,--whole-archive <(v8_base)',
'-Wl,--no-whole-archive' ],
}],
['node_engine=="chakracore"', {
- 'ldflags': [ '-Wl,--whole-archive <(CHAKRASHIM_BASE)',
+ 'ldflags': [ '-Wl,--whole-archive <(chakrashim_base)',
'-Wl,--no-whole-archive' ],
}],
]
@@ -218,6 +218,8 @@
[ '(OS=="freebsd" or OS=="linux") and node_shared=="false"'
' and coverage=="true" and force_load=="true"', {
'ldflags': [ '-Wl,-z,noexecstack',
+ '-Wl,--whole-archive <(v8_base)',
+ '-Wl,--no-whole-archive',
'--coverage',
'-g',
'-O0' ],
@@ -261,15 +263,15 @@
[ 'force_load=="true"', {
'xcode_settings': {
'OTHER_LDFLAGS': [
- '-Wl,-force_load,<(PRODUCT_DIR)/<(OPENSSL_PRODUCT)',
+ '-Wl,-force_load,<(PRODUCT_DIR)/<(openssl_product)',
],
},
'conditions': [
['OS in "linux freebsd" and node_shared=="false"', {
'ldflags': [
'-Wl,--whole-archive,'
- '<(OBJ_DIR)/deps/openssl/'
- '<(OPENSSL_PRODUCT)',
+ '<(obj_dir)/deps/openssl/'
+ '<(openssl_product)',
'-Wl,--no-whole-archive',
],
}],
diff --git a/src/async_wrap.cc b/src/async_wrap.cc
index 5258674ff33..706cd879901 100644
--- a/src/async_wrap.cc
+++ b/src/async_wrap.cc
@@ -540,12 +540,12 @@ void AsyncWrap::Initialize(Local |