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 9870b53 as of 2018-01-23
This commit was automatically generated. For any problems, please contact jackhorton

Reviewed-By: chakrabot <chakrabot@users.noreply.github.com>
  • Loading branch information
chakrabot committed Feb 6, 2018
2 parents c3d4d6a + 9870b53 commit df48e70
Show file tree
Hide file tree
Showing 183 changed files with 573 additions and 1,073 deletions.
4 changes: 1 addition & 3 deletions benchmark/arrays/var-int.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@ const bench = common.createBenchmark(main, {
n: [25]
});

function main(conf) {
const type = conf.type;
function main({ type, n }) {
const clazz = global[type];
const n = +conf.n;

bench.start();
const arr = new clazz(n * 1e6);
Expand Down
4 changes: 1 addition & 3 deletions benchmark/arrays/zero-float.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@ const bench = common.createBenchmark(main, {
n: [25]
});

function main(conf) {
const type = conf.type;
function main({ type, n }) {
const clazz = global[type];
const n = +conf.n;

bench.start();
const arr = new clazz(n * 1e6);
Expand Down
4 changes: 1 addition & 3 deletions benchmark/arrays/zero-int.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@ const bench = common.createBenchmark(main, {
n: [25]
});

function main(conf) {
const type = conf.type;
function main({ type, n }) {
const clazz = global[type];
const n = +conf.n;

bench.start();
const arr = new clazz(n * 1e6);
Expand Down
6 changes: 2 additions & 4 deletions benchmark/assert/deepequal-buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ const bench = common.createBenchmark(main, {
]
});

function main(conf) {
const n = +conf.n;
const len = +conf.len;
function main({ len, n, method }) {
var i;

const data = Buffer.allocUnsafe(len + 1);
Expand All @@ -26,7 +24,7 @@ function main(conf) {
data.copy(expected);
data.copy(expectedWrong);

switch (conf.method) {
switch (method) {
case '':
// Empty string falls through to next line as default, mostly for tests.
case 'deepEqual':
Expand Down
7 changes: 2 additions & 5 deletions benchmark/assert/deepequal-map.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,11 @@ function benchmark(method, n, values, values2) {
bench.end(n);
}

function main(conf) {
const n = +conf.n;
const len = +conf.len;

function main({ n, len, method }) {
const array = Array(len).fill(1);
var values, values2;

switch (conf.method) {
switch (method) {
case '':
// Empty string falls through to next line as default, mostly for tests.
case 'deepEqual_primitiveOnly':
Expand Down
9 changes: 4 additions & 5 deletions benchmark/assert/deepequal-object.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,17 @@ function createObj(source, add = '') {
}));
}

function main(conf) {
const size = conf.size;
// TODO: Fix this "hack"
const n = conf.n / size;
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 (conf.method) {
switch (method) {
case '':
// Empty string falls through to next line as default, mostly for tests.
case 'deepEqual':
Expand Down
10 changes: 4 additions & 6 deletions benchmark/assert/deepequal-prims-and-objs-big-array-set.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const primValues = {
};

const bench = common.createBenchmark(main, {
prim: Object.keys(primValues),
primitive: Object.keys(primValues),
n: [25],
len: [1e5],
method: [
Expand All @@ -30,10 +30,8 @@ const bench = common.createBenchmark(main, {
]
});

function main(conf) {
const prim = primValues[conf.prim];
const n = +conf.n;
const len = +conf.len;
function main({ n, len, primitive, method }) {
const prim = primValues[primitive];
const actual = [];
const expected = [];
const expectedWrong = [];
Expand All @@ -52,7 +50,7 @@ function main(conf) {
const expectedSet = new Set(expected);
const expectedWrongSet = new Set(expectedWrong);

switch (conf.method) {
switch (method) {
case '':
// Empty string falls through to next line as default, mostly for tests.
case 'deepEqual_Array':
Expand Down
9 changes: 4 additions & 5 deletions benchmark/assert/deepequal-prims-and-objs-big-loop.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const primValues = {
};

const bench = common.createBenchmark(main, {
prim: Object.keys(primValues),
primitive: Object.keys(primValues),
n: [1e6],
method: [
'deepEqual',
Expand All @@ -24,16 +24,15 @@ const bench = common.createBenchmark(main, {
]
});

function main(conf) {
const prim = primValues[conf.prim];
const n = +conf.n;
function main({ n, primitive, method }) {
const prim = primValues[primitive];
const actual = prim;
const expected = prim;
const expectedWrong = 'b';
var i;

// Creates new array to avoid loop invariant code motion
switch (conf.method) {
switch (method) {
case '':
// Empty string falls through to next line as default, mostly for tests.
case 'deepEqual':
Expand Down
7 changes: 2 additions & 5 deletions benchmark/assert/deepequal-set.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,12 @@ function benchmark(method, n, values, values2) {
bench.end(n);
}

function main(conf) {
const n = +conf.n;
const len = +conf.len;

function main({ n, len, method }) {
const array = Array(len).fill(1);

var values, values2;

switch (conf.method) {
switch (method) {
case '':
// Empty string falls through to next line as default, mostly for tests.
case 'deepEqual_primitiveOnly':
Expand Down
8 changes: 2 additions & 6 deletions benchmark/assert/deepequal-typedarrays.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,16 @@ const bench = common.createBenchmark(main, {
len: [1e6]
});

function main(conf) {
const type = conf.type;
function main({ type, n, len, method }) {
const clazz = global[type];
const n = +conf.n;
const len = +conf.len;

const actual = new clazz(len);
const expected = new clazz(len);
const expectedWrong = Buffer.alloc(len);
const wrongIndex = Math.floor(len / 2);
expectedWrong[wrongIndex] = 123;
var i;

switch (conf.method) {
switch (method) {
case '':
// Empty string falls through to next line as default, mostly for tests.
case 'deepEqual':
Expand Down
7 changes: 3 additions & 4 deletions benchmark/assert/throws.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,14 @@ const bench = common.createBenchmark(main, {
]
});

function main(conf) {
const n = +conf.n;
function main({ n, method }) {
const throws = () => { throw new TypeError('foobar'); };
const doesNotThrow = () => { return 'foobar'; };
const regExp = /foobar/;
const message = 'failure';
var i;

switch (conf.method) {
switch (method) {
case '':
// Empty string falls through to next line as default, mostly for tests.
case 'doesNotThrow':
Expand Down Expand Up @@ -54,6 +53,6 @@ function main(conf) {
bench.end(n);
break;
default:
throw new Error(`Unsupported method ${conf.method}`);
throw new Error(`Unsupported method ${method}`);
}
}
6 changes: 2 additions & 4 deletions benchmark/async_hooks/gc-tracking.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@ function endAfterGC(n) {
});
}

function main(conf) {
const n = +conf.n;

switch (conf.method) {
function main({ n, method }) {
switch (method) {
case 'trackingEnabled':
bench.start();
for (let i = 0; i < n; i++) {
Expand Down
3 changes: 1 addition & 2 deletions benchmark/buffers/buffer-base64-decode-wrapped.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ const bench = common.createBenchmark(main, {
n: [32],
});

function main(conf) {
const n = +conf.n;
function main({ n }) {
const charsPerLine = 76;
const linesCount = 8 << 16;
const bytesCount = charsPerLine * linesCount / 4 * 3;
Expand Down
3 changes: 1 addition & 2 deletions benchmark/buffers/buffer-base64-decode.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ const bench = common.createBenchmark(main, {
n: [32],
});

function main(conf) {
const n = +conf.n;
function main({ n }) {
const s = 'abcd'.repeat(8 << 20);
// eslint-disable-next-line no-unescaped-regexp-dot
s.match(/./); // Flatten string.
Expand Down
4 changes: 1 addition & 3 deletions benchmark/buffers/buffer-base64-encode.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ const bench = common.createBenchmark(main, {
n: [32]
});

function main(conf) {
const n = +conf.n;
const len = +conf.len;
function main({ n, len }) {
const b = Buffer.allocUnsafe(len);
let s = '';
let i;
Expand Down
6 changes: 1 addition & 5 deletions benchmark/buffers/buffer-bytelength.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@ const chars = [
'𠜎𠜱𠝹𠱓𠱸𠲖𠳏𠳕𠴕𠵼𠵿𠸎𠸏𠹷𠺝𠺢' // 4 bytes
];

function main(conf) {
const n = conf.n | 0;
const len = conf.len | 0;
const encoding = conf.encoding;

function main({ n, len, encoding }) {
var strings = [];
var results;
if (encoding === 'buffer') {
Expand Down
6 changes: 2 additions & 4 deletions benchmark/buffers/buffer-compare-instance-method.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@ const bench = common.createBenchmark(main, {
millions: [1]
});

function main(conf) {
const iter = (conf.millions >>> 0) * 1e6;
const size = (conf.size >>> 0);
const args = (conf.args >>> 0);
function main({ millions, size, args }) {
const iter = millions * 1e6;
const b0 = Buffer.alloc(size, 'a');
const b1 = Buffer.alloc(size, 'a');
const b0Len = b0.length;
Expand Down
16 changes: 7 additions & 9 deletions benchmark/buffers/buffer-compare-offset.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,11 @@ function compareUsingOffset(b0, b1, len, iter) {
bench.end(iter / 1e6);
}

function main(conf) {
const iter = (conf.millions >>> 0) * 1e6;
const size = (conf.size >>> 0);
const method =
conf.method === 'slice' ? compareUsingSlice : compareUsingOffset;
method(Buffer.alloc(size, 'a'),
Buffer.alloc(size, 'b'),
size >> 1,
iter);
function main({ millions, size, method }) {
const iter = millions * 1e6;
const fn = method === 'slice' ? compareUsingSlice : compareUsingOffset;
fn(Buffer.alloc(size, 'a'),
Buffer.alloc(size, 'b'),
size >> 1,
iter);
}
5 changes: 2 additions & 3 deletions benchmark/buffers/buffer-compare.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@ const bench = common.createBenchmark(main, {
millions: [1]
});

function main(conf) {
const iter = (conf.millions >>> 0) * 1e6;
const size = (conf.size >>> 0);
function main({ millions, size }) {
const iter = millions * 1e6;
const b0 = Buffer.alloc(size, 'a');
const b1 = Buffer.alloc(size, 'a');

Expand Down
10 changes: 3 additions & 7 deletions benchmark/buffers/buffer-concat.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,11 @@ const bench = common.createBenchmark(main, {
n: [1024]
});

function main(conf) {
const n = +conf.n;
const size = +conf.pieceSize;
const pieces = +conf.pieces;

function main({ n, pieces, pieceSize, withTotalLength }) {
const list = new Array(pieces);
list.fill(Buffer.allocUnsafe(size));
list.fill(Buffer.allocUnsafe(pieceSize));

const totalLength = conf.withTotalLength ? pieces * size : undefined;
const totalLength = withTotalLength ? pieces * pieceSize : undefined;

bench.start();
for (var i = 0; i < n * 1024; i++) {
Expand Down
6 changes: 2 additions & 4 deletions benchmark/buffers/buffer-creation.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@ const bench = common.createBenchmark(main, {
n: [1024]
});

function main(conf) {
const len = +conf.len;
const n = +conf.n;
switch (conf.type) {
function main({ len, n, type }) {
switch (type) {
case '':
case 'fast-alloc':
bench.start();
Expand Down
7 changes: 2 additions & 5 deletions benchmark/buffers/buffer-from.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@ const bench = common.createBenchmark(main, {
n: [2048]
});

function main(conf) {
const len = +conf.len;
const n = +conf.n;

function main({ len, n, source }) {
const array = new Array(len).fill(42);
const arrayBuf = new ArrayBuffer(len);
const str = 'a'.repeat(len);
Expand All @@ -31,7 +28,7 @@ function main(conf) {

var i;

switch (conf.source) {
switch (source) {
case 'array':
bench.start();
for (i = 0; i < n * 1024; i++) {
Expand Down
4 changes: 1 addition & 3 deletions benchmark/buffers/buffer-hex.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ const bench = common.createBenchmark(main, {
n: [1e7]
});

function main(conf) {
const len = conf.len | 0;
const n = conf.n | 0;
function main({ len, n }) {
const buf = Buffer.alloc(len);

for (let i = 0; i < buf.length; i++)
Expand Down
Loading

0 comments on commit df48e70

Please sign in to comment.