Skip to content
This repository was archived by the owner on Oct 15, 2020. It is now read-only.

Commit 77faa4b

Browse files
committed
meta: merge node/master into node-chakracore/master
Merge feaf6ac as of 2018-01-05 This commit was automatically generated. For any problems, please contact jackhorton Reviewed-By: Taylor Woll <tawoll@ntdev.microsoft.com>
2 parents 4a6d224 + feaf6ac commit 77faa4b

28 files changed

+479
-394
lines changed

Makefile

Lines changed: 66 additions & 79 deletions
Large diffs are not rendered by default.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
'use strict';
2+
const common = require('../common.js');
3+
4+
const types = [
5+
'IntBE',
6+
'IntLE',
7+
'UIntBE',
8+
'UIntLE'
9+
];
10+
11+
const bench = common.createBenchmark(main, {
12+
noAssert: ['false', 'true'],
13+
buffer: ['fast', 'slow'],
14+
type: types,
15+
millions: [1],
16+
byteLength: [1, 2, 4, 6]
17+
});
18+
19+
function main(conf) {
20+
const noAssert = conf.noAssert === 'true';
21+
const len = conf.millions * 1e6;
22+
const clazz = conf.buf === 'fast' ? Buffer : require('buffer').SlowBuffer;
23+
const buff = new clazz(8);
24+
const type = conf.type || 'UInt8';
25+
const fn = `read${type}`;
26+
27+
buff.writeDoubleLE(0, 0, noAssert);
28+
const testFunction = new Function('buff', `
29+
for (var i = 0; i !== ${len}; i++) {
30+
buff.${fn}(0, ${conf.byteLength}, ${JSON.stringify(noAssert)});
31+
}
32+
`);
33+
bench.start();
34+
testFunction(buff);
35+
bench.end(len / 1e6);
36+
}

benchmark/fs/write-stream-throughput.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,6 @@ function main(conf) {
4141
var started = false;
4242
var ending = false;
4343
var ended = false;
44-
setTimeout(function() {
45-
ending = true;
46-
f.end();
47-
}, dur * 1000);
4844

4945
var f = fs.createWriteStream(filename);
5046
f.on('drain', write);
@@ -66,6 +62,10 @@ function main(conf) {
6662

6763
if (!started) {
6864
started = true;
65+
setTimeout(function() {
66+
ending = true;
67+
f.end();
68+
}, dur * 1000);
6969
bench.start();
7070
}
7171

doc/api/buffer.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1776,8 +1776,11 @@ console.log(buf.readIntLE(0, 6).toString(16));
17761776
// Prints: 1234567890ab
17771777
console.log(buf.readIntBE(0, 6).toString(16));
17781778

1779-
// Throws an exception: RangeError: Index out of range
1779+
// Throws ERR_INDEX_OUT_OF_RANGE:
17801780
console.log(buf.readIntBE(1, 6).toString(16));
1781+
1782+
// Throws ERR_OUT_OF_RANGE:
1783+
console.log(buf.readIntBE(1, 0).toString(16));
17811784
```
17821785

17831786
### buf.readUInt8(offset[, noAssert])

doc/api/cluster.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -722,6 +722,8 @@ changes:
722722
This can be a number, or a function that takes no arguments and returns a
723723
number. By default each worker gets its own port, incremented from the
724724
master's `process.debugPort`.
725+
* `windowsHide` {boolean} Hide the forked processes console window that would
726+
normally be created on Windows systems. **Default:** `false`
725727

726728
After calling `.setupMaster()` (or `.fork()`) this settings object will contain
727729
the settings, including the default values.

lib/_http_outgoing.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,6 @@ OutgoingMessage.prototype._renderHeaders = function _renderHeaders() {
179179
};
180180

181181

182-
exports.OutgoingMessage = OutgoingMessage;
183-
184-
185182
OutgoingMessage.prototype.setTimeout = function setTimeout(msecs, callback) {
186183

187184
if (callback) {

lib/buffer.js

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -210,10 +210,11 @@ Buffer.from = function from(value, encodingOrOffset, length) {
210210
);
211211
}
212212

213-
if (typeof value === 'number')
213+
if (typeof value === 'number') {
214214
throw new errors.TypeError(
215215
'ERR_INVALID_ARG_TYPE', 'value', 'not number', value
216216
);
217+
}
217218

218219
const valueOf = value.valueOf && value.valueOf();
219220
if (valueOf !== null && valueOf !== undefined && valueOf !== value)
@@ -459,10 +460,11 @@ Buffer[kIsEncodingSymbol] = Buffer.isEncoding;
459460

460461
Buffer.concat = function concat(list, length) {
461462
var i;
462-
if (!Array.isArray(list))
463+
if (!Array.isArray(list)) {
463464
throw new errors.TypeError(
464465
'ERR_INVALID_ARG_TYPE', 'list', ['Array', 'Buffer', 'Uint8Array']
465466
);
467+
}
466468

467469
if (list.length === 0)
468470
return new FastBuffer();
@@ -479,10 +481,11 @@ Buffer.concat = function concat(list, length) {
479481
var pos = 0;
480482
for (i = 0; i < list.length; i++) {
481483
var buf = list[i];
482-
if (!isUint8Array(buf))
484+
if (!isUint8Array(buf)) {
483485
throw new errors.TypeError(
484486
'ERR_INVALID_ARG_TYPE', 'list', ['Array', 'Buffer', 'Uint8Array']
485487
);
488+
}
486489
_copy(buf, buffer, pos);
487490
pos += buf.length;
488491
}
@@ -1036,13 +1039,23 @@ function checkOffset(offset, ext, length) {
10361039
throw new errors.RangeError('ERR_INDEX_OUT_OF_RANGE');
10371040
}
10381041

1042+
function checkByteLength(byteLength) {
1043+
if (byteLength < 1 || byteLength > 6) {
1044+
throw new errors.RangeError('ERR_OUT_OF_RANGE',
1045+
'byteLength',
1046+
'>= 1 and <= 6');
1047+
}
1048+
}
1049+
10391050

10401051
Buffer.prototype.readUIntLE =
10411052
function readUIntLE(offset, byteLength, noAssert) {
10421053
offset = offset >>> 0;
10431054
byteLength = byteLength >>> 0;
1044-
if (!noAssert)
1055+
if (!noAssert) {
1056+
checkByteLength(byteLength);
10451057
checkOffset(offset, byteLength, this.length);
1058+
}
10461059

10471060
var val = this[offset];
10481061
var mul = 1;
@@ -1058,8 +1071,10 @@ Buffer.prototype.readUIntBE =
10581071
function readUIntBE(offset, byteLength, noAssert) {
10591072
offset = offset >>> 0;
10601073
byteLength = byteLength >>> 0;
1061-
if (!noAssert)
1074+
if (!noAssert) {
1075+
checkByteLength(byteLength);
10621076
checkOffset(offset, byteLength, this.length);
1077+
}
10631078

10641079
var val = this[offset + --byteLength];
10651080
var mul = 1;
@@ -1121,8 +1136,11 @@ Buffer.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) {
11211136
Buffer.prototype.readIntLE = function readIntLE(offset, byteLength, noAssert) {
11221137
offset = offset >>> 0;
11231138
byteLength = byteLength >>> 0;
1124-
if (!noAssert)
1139+
1140+
if (!noAssert) {
1141+
checkByteLength(byteLength);
11251142
checkOffset(offset, byteLength, this.length);
1143+
}
11261144

11271145
var val = this[offset];
11281146
var mul = 1;
@@ -1141,8 +1159,11 @@ Buffer.prototype.readIntLE = function readIntLE(offset, byteLength, noAssert) {
11411159
Buffer.prototype.readIntBE = function readIntBE(offset, byteLength, noAssert) {
11421160
offset = offset >>> 0;
11431161
byteLength = byteLength >>> 0;
1144-
if (!noAssert)
1162+
1163+
if (!noAssert) {
1164+
checkByteLength(byteLength);
11451165
checkOffset(offset, byteLength, this.length);
1166+
}
11461167

11471168
var i = byteLength;
11481169
var mul = 1;
@@ -1624,9 +1645,10 @@ if (process.binding('config').hasIntl) {
16241645
// Transcodes the Buffer from one encoding to another, returning a new
16251646
// Buffer instance.
16261647
transcode = function transcode(source, fromEncoding, toEncoding) {
1627-
if (!isUint8Array(source))
1648+
if (!isUint8Array(source)) {
16281649
throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'source',
16291650
['Buffer', 'Uint8Array'], source);
1651+
}
16301652
if (source.length === 0) return Buffer.alloc(0);
16311653

16321654
fromEncoding = normalizeEncoding(fromEncoding) || fromEncoding;

lib/internal/cluster/master.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ function createWorkerProcess(id, env) {
127127
return fork(cluster.settings.exec, cluster.settings.args, {
128128
env: workerEnv,
129129
silent: cluster.settings.silent,
130+
windowsHide: cluster.settings.windowsHide,
130131
execArgv: execArgv,
131132
stdio: cluster.settings.stdio,
132133
gid: cluster.settings.gid,

0 commit comments

Comments
 (0)