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

Commit

Permalink
meta: merge node/master into node-chakracore/master
Browse files Browse the repository at this point in the history
Merge feaf6ac as of 2018-01-05
This commit was automatically generated. For any problems, please contact jackhorton

Reviewed-By: Taylor Woll <[email protected]>
  • Loading branch information
chakrabot committed Jan 20, 2018
2 parents 4a6d224 + feaf6ac commit 77faa4b
Show file tree
Hide file tree
Showing 28 changed files with 479 additions and 394 deletions.
145 changes: 66 additions & 79 deletions Makefile

Large diffs are not rendered by default.

36 changes: 36 additions & 0 deletions benchmark/buffers/buffer-read-with-byteLength.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
'use strict';
const common = require('../common.js');

const types = [
'IntBE',
'IntLE',
'UIntBE',
'UIntLE'
];

const bench = common.createBenchmark(main, {
noAssert: ['false', 'true'],
buffer: ['fast', 'slow'],
type: types,
millions: [1],
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;
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);
}
8 changes: 4 additions & 4 deletions benchmark/fs/write-stream-throughput.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ function main(conf) {
var started = false;
var ending = false;
var ended = false;
setTimeout(function() {
ending = true;
f.end();
}, dur * 1000);

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

if (!started) {
started = true;
setTimeout(function() {
ending = true;
f.end();
}, dur * 1000);
bench.start();
}

Expand Down
5 changes: 4 additions & 1 deletion doc/api/buffer.md
Original file line number Diff line number Diff line change
Expand Up @@ -1776,8 +1776,11 @@ console.log(buf.readIntLE(0, 6).toString(16));
// Prints: 1234567890ab
console.log(buf.readIntBE(0, 6).toString(16));

// Throws an exception: RangeError: Index out of range
// Throws ERR_INDEX_OUT_OF_RANGE:
console.log(buf.readIntBE(1, 6).toString(16));

// Throws ERR_OUT_OF_RANGE:
console.log(buf.readIntBE(1, 0).toString(16));
```

### buf.readUInt8(offset[, noAssert])
Expand Down
2 changes: 2 additions & 0 deletions doc/api/cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,8 @@ changes:
This can be a number, or a function that takes no arguments and returns a
number. By default each worker gets its own port, incremented from the
master's `process.debugPort`.
* `windowsHide` {boolean} Hide the forked processes console window that would
normally be created on Windows systems. **Default:** `false`

After calling `.setupMaster()` (or `.fork()`) this settings object will contain
the settings, including the default values.
Expand Down
3 changes: 0 additions & 3 deletions lib/_http_outgoing.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,6 @@ OutgoingMessage.prototype._renderHeaders = function _renderHeaders() {
};


exports.OutgoingMessage = OutgoingMessage;


OutgoingMessage.prototype.setTimeout = function setTimeout(msecs, callback) {

if (callback) {
Expand Down
38 changes: 30 additions & 8 deletions lib/buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,11 @@ Buffer.from = function from(value, encodingOrOffset, length) {
);
}

if (typeof value === 'number')
if (typeof value === 'number') {
throw new errors.TypeError(
'ERR_INVALID_ARG_TYPE', 'value', 'not number', value
);
}

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

Buffer.concat = function concat(list, length) {
var i;
if (!Array.isArray(list))
if (!Array.isArray(list)) {
throw new errors.TypeError(
'ERR_INVALID_ARG_TYPE', 'list', ['Array', 'Buffer', 'Uint8Array']
);
}

if (list.length === 0)
return new FastBuffer();
Expand All @@ -479,10 +481,11 @@ Buffer.concat = function concat(list, length) {
var pos = 0;
for (i = 0; i < list.length; i++) {
var buf = list[i];
if (!isUint8Array(buf))
if (!isUint8Array(buf)) {
throw new errors.TypeError(
'ERR_INVALID_ARG_TYPE', 'list', ['Array', 'Buffer', 'Uint8Array']
);
}
_copy(buf, buffer, pos);
pos += buf.length;
}
Expand Down Expand Up @@ -1036,13 +1039,23 @@ function checkOffset(offset, ext, length) {
throw new errors.RangeError('ERR_INDEX_OUT_OF_RANGE');
}

function checkByteLength(byteLength) {
if (byteLength < 1 || byteLength > 6) {
throw new errors.RangeError('ERR_OUT_OF_RANGE',
'byteLength',
'>= 1 and <= 6');
}
}


Buffer.prototype.readUIntLE =
function readUIntLE(offset, byteLength, noAssert) {
offset = offset >>> 0;
byteLength = byteLength >>> 0;
if (!noAssert)
if (!noAssert) {
checkByteLength(byteLength);
checkOffset(offset, byteLength, this.length);
}

var val = this[offset];
var mul = 1;
Expand All @@ -1058,8 +1071,10 @@ Buffer.prototype.readUIntBE =
function readUIntBE(offset, byteLength, noAssert) {
offset = offset >>> 0;
byteLength = byteLength >>> 0;
if (!noAssert)
if (!noAssert) {
checkByteLength(byteLength);
checkOffset(offset, byteLength, this.length);
}

var val = this[offset + --byteLength];
var mul = 1;
Expand Down Expand Up @@ -1121,8 +1136,11 @@ Buffer.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) {
Buffer.prototype.readIntLE = function readIntLE(offset, byteLength, noAssert) {
offset = offset >>> 0;
byteLength = byteLength >>> 0;
if (!noAssert)

if (!noAssert) {
checkByteLength(byteLength);
checkOffset(offset, byteLength, this.length);
}

var val = this[offset];
var mul = 1;
Expand All @@ -1141,8 +1159,11 @@ Buffer.prototype.readIntLE = function readIntLE(offset, byteLength, noAssert) {
Buffer.prototype.readIntBE = function readIntBE(offset, byteLength, noAssert) {
offset = offset >>> 0;
byteLength = byteLength >>> 0;
if (!noAssert)

if (!noAssert) {
checkByteLength(byteLength);
checkOffset(offset, byteLength, this.length);
}

var i = byteLength;
var mul = 1;
Expand Down Expand Up @@ -1624,9 +1645,10 @@ if (process.binding('config').hasIntl) {
// Transcodes the Buffer from one encoding to another, returning a new
// Buffer instance.
transcode = function transcode(source, fromEncoding, toEncoding) {
if (!isUint8Array(source))
if (!isUint8Array(source)) {
throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'source',
['Buffer', 'Uint8Array'], source);
}
if (source.length === 0) return Buffer.alloc(0);

fromEncoding = normalizeEncoding(fromEncoding) || fromEncoding;
Expand Down
1 change: 1 addition & 0 deletions lib/internal/cluster/master.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ function createWorkerProcess(id, env) {
return fork(cluster.settings.exec, cluster.settings.args, {
env: workerEnv,
silent: cluster.settings.silent,
windowsHide: cluster.settings.windowsHide,
execArgv: execArgv,
stdio: cluster.settings.stdio,
gid: cluster.settings.gid,
Expand Down
Loading

0 comments on commit 77faa4b

Please sign in to comment.