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

Commit df48e70

Browse files
committed
meta: merge node/master into node-chakracore/master
Merge 9870b53 as of 2018-01-23 This commit was automatically generated. For any problems, please contact jackhorton Reviewed-By: chakrabot <[email protected]>
2 parents c3d4d6a + 9870b53 commit df48e70

File tree

183 files changed

+573
-1073
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

183 files changed

+573
-1073
lines changed

Diff for: benchmark/arrays/var-int.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,8 @@ const bench = common.createBenchmark(main, {
1717
n: [25]
1818
});
1919

20-
function main(conf) {
21-
const type = conf.type;
20+
function main({ type, n }) {
2221
const clazz = global[type];
23-
const n = +conf.n;
2422

2523
bench.start();
2624
const arr = new clazz(n * 1e6);

Diff for: benchmark/arrays/zero-float.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,8 @@ const bench = common.createBenchmark(main, {
1717
n: [25]
1818
});
1919

20-
function main(conf) {
21-
const type = conf.type;
20+
function main({ type, n }) {
2221
const clazz = global[type];
23-
const n = +conf.n;
2422

2523
bench.start();
2624
const arr = new clazz(n * 1e6);

Diff for: benchmark/arrays/zero-int.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,8 @@ const bench = common.createBenchmark(main, {
1717
n: [25]
1818
});
1919

20-
function main(conf) {
21-
const type = conf.type;
20+
function main({ type, n }) {
2221
const clazz = global[type];
23-
const n = +conf.n;
2422

2523
bench.start();
2624
const arr = new clazz(n * 1e6);

Diff for: benchmark/assert/deepequal-buffer.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@ const bench = common.createBenchmark(main, {
1313
]
1414
});
1515

16-
function main(conf) {
17-
const n = +conf.n;
18-
const len = +conf.len;
16+
function main({ len, n, method }) {
1917
var i;
2018

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

29-
switch (conf.method) {
27+
switch (method) {
3028
case '':
3129
// Empty string falls through to next line as default, mostly for tests.
3230
case 'deepEqual':

Diff for: benchmark/assert/deepequal-map.js

+2-5
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,11 @@ function benchmark(method, n, values, values2) {
3838
bench.end(n);
3939
}
4040

41-
function main(conf) {
42-
const n = +conf.n;
43-
const len = +conf.len;
44-
41+
function main({ n, len, method }) {
4542
const array = Array(len).fill(1);
4643
var values, values2;
4744

48-
switch (conf.method) {
45+
switch (method) {
4946
case '':
5047
// Empty string falls through to next line as default, mostly for tests.
5148
case 'deepEqual_primitiveOnly':

Diff for: benchmark/assert/deepequal-object.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,17 @@ function createObj(source, add = '') {
2525
}));
2626
}
2727

28-
function main(conf) {
29-
const size = conf.size;
30-
// TODO: Fix this "hack"
31-
const n = conf.n / size;
28+
function main({ size, n, method }) {
29+
// TODO: Fix this "hack". `n` should not be manipulated.
30+
n = n / size;
3231
var i;
3332

3433
const source = Array.apply(null, Array(size));
3534
const actual = createObj(source);
3635
const expected = createObj(source);
3736
const expectedWrong = createObj(source, '4');
3837

39-
switch (conf.method) {
38+
switch (method) {
4039
case '':
4140
// Empty string falls through to next line as default, mostly for tests.
4241
case 'deepEqual':

Diff for: benchmark/assert/deepequal-prims-and-objs-big-array-set.js

+4-6
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const primValues = {
1515
};
1616

1717
const bench = common.createBenchmark(main, {
18-
prim: Object.keys(primValues),
18+
primitive: Object.keys(primValues),
1919
n: [25],
2020
len: [1e5],
2121
method: [
@@ -30,10 +30,8 @@ const bench = common.createBenchmark(main, {
3030
]
3131
});
3232

33-
function main(conf) {
34-
const prim = primValues[conf.prim];
35-
const n = +conf.n;
36-
const len = +conf.len;
33+
function main({ n, len, primitive, method }) {
34+
const prim = primValues[primitive];
3735
const actual = [];
3836
const expected = [];
3937
const expectedWrong = [];
@@ -52,7 +50,7 @@ function main(conf) {
5250
const expectedSet = new Set(expected);
5351
const expectedWrongSet = new Set(expectedWrong);
5452

55-
switch (conf.method) {
53+
switch (method) {
5654
case '':
5755
// Empty string falls through to next line as default, mostly for tests.
5856
case 'deepEqual_Array':

Diff for: benchmark/assert/deepequal-prims-and-objs-big-loop.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const primValues = {
1414
};
1515

1616
const bench = common.createBenchmark(main, {
17-
prim: Object.keys(primValues),
17+
primitive: Object.keys(primValues),
1818
n: [1e6],
1919
method: [
2020
'deepEqual',
@@ -24,16 +24,15 @@ const bench = common.createBenchmark(main, {
2424
]
2525
});
2626

27-
function main(conf) {
28-
const prim = primValues[conf.prim];
29-
const n = +conf.n;
27+
function main({ n, primitive, method }) {
28+
const prim = primValues[primitive];
3029
const actual = prim;
3130
const expected = prim;
3231
const expectedWrong = 'b';
3332
var i;
3433

3534
// Creates new array to avoid loop invariant code motion
36-
switch (conf.method) {
35+
switch (method) {
3736
case '':
3837
// Empty string falls through to next line as default, mostly for tests.
3938
case 'deepEqual':

Diff for: benchmark/assert/deepequal-set.js

+2-5
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,12 @@ function benchmark(method, n, values, values2) {
3838
bench.end(n);
3939
}
4040

41-
function main(conf) {
42-
const n = +conf.n;
43-
const len = +conf.len;
44-
41+
function main({ n, len, method }) {
4542
const array = Array(len).fill(1);
4643

4744
var values, values2;
4845

49-
switch (conf.method) {
46+
switch (method) {
5047
case '':
5148
// Empty string falls through to next line as default, mostly for tests.
5249
case 'deepEqual_primitiveOnly':

Diff for: benchmark/assert/deepequal-typedarrays.js

+2-6
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,16 @@ const bench = common.createBenchmark(main, {
2424
len: [1e6]
2525
});
2626

27-
function main(conf) {
28-
const type = conf.type;
27+
function main({ type, n, len, method }) {
2928
const clazz = global[type];
30-
const n = +conf.n;
31-
const len = +conf.len;
32-
3329
const actual = new clazz(len);
3430
const expected = new clazz(len);
3531
const expectedWrong = Buffer.alloc(len);
3632
const wrongIndex = Math.floor(len / 2);
3733
expectedWrong[wrongIndex] = 123;
3834
var i;
3935

40-
switch (conf.method) {
36+
switch (method) {
4137
case '':
4238
// Empty string falls through to next line as default, mostly for tests.
4339
case 'deepEqual':

Diff for: benchmark/assert/throws.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,14 @@ const bench = common.createBenchmark(main, {
1313
]
1414
});
1515

16-
function main(conf) {
17-
const n = +conf.n;
16+
function main({ n, method }) {
1817
const throws = () => { throw new TypeError('foobar'); };
1918
const doesNotThrow = () => { return 'foobar'; };
2019
const regExp = /foobar/;
2120
const message = 'failure';
2221
var i;
2322

24-
switch (conf.method) {
23+
switch (method) {
2524
case '':
2625
// Empty string falls through to next line as default, mostly for tests.
2726
case 'doesNotThrow':
@@ -54,6 +53,6 @@ function main(conf) {
5453
bench.end(n);
5554
break;
5655
default:
57-
throw new Error(`Unsupported method ${conf.method}`);
56+
throw new Error(`Unsupported method ${method}`);
5857
}
5958
}

Diff for: benchmark/async_hooks/gc-tracking.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,8 @@ function endAfterGC(n) {
2121
});
2222
}
2323

24-
function main(conf) {
25-
const n = +conf.n;
26-
27-
switch (conf.method) {
24+
function main({ n, method }) {
25+
switch (method) {
2826
case 'trackingEnabled':
2927
bench.start();
3028
for (let i = 0; i < n; i++) {

Diff for: benchmark/buffers/buffer-base64-decode-wrapped.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ const bench = common.createBenchmark(main, {
66
n: [32],
77
});
88

9-
function main(conf) {
10-
const n = +conf.n;
9+
function main({ n }) {
1110
const charsPerLine = 76;
1211
const linesCount = 8 << 16;
1312
const bytesCount = charsPerLine * linesCount / 4 * 3;

Diff for: benchmark/buffers/buffer-base64-decode.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ const bench = common.createBenchmark(main, {
66
n: [32],
77
});
88

9-
function main(conf) {
10-
const n = +conf.n;
9+
function main({ n }) {
1110
const s = 'abcd'.repeat(8 << 20);
1211
// eslint-disable-next-line no-unescaped-regexp-dot
1312
s.match(/./); // Flatten string.

Diff for: benchmark/buffers/buffer-base64-encode.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@ const bench = common.createBenchmark(main, {
2727
n: [32]
2828
});
2929

30-
function main(conf) {
31-
const n = +conf.n;
32-
const len = +conf.len;
30+
function main({ n, len }) {
3331
const b = Buffer.allocUnsafe(len);
3432
let s = '';
3533
let i;

Diff for: benchmark/buffers/buffer-bytelength.js

+1-5
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,7 @@ const chars = [
1515
'𠜎𠜱𠝹𠱓𠱸𠲖𠳏𠳕𠴕𠵼𠵿𠸎𠸏𠹷𠺝𠺢' // 4 bytes
1616
];
1717

18-
function main(conf) {
19-
const n = conf.n | 0;
20-
const len = conf.len | 0;
21-
const encoding = conf.encoding;
22-
18+
function main({ n, len, encoding }) {
2319
var strings = [];
2420
var results;
2521
if (encoding === 'buffer') {

Diff for: benchmark/buffers/buffer-compare-instance-method.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@ const bench = common.createBenchmark(main, {
77
millions: [1]
88
});
99

10-
function main(conf) {
11-
const iter = (conf.millions >>> 0) * 1e6;
12-
const size = (conf.size >>> 0);
13-
const args = (conf.args >>> 0);
10+
function main({ millions, size, args }) {
11+
const iter = millions * 1e6;
1412
const b0 = Buffer.alloc(size, 'a');
1513
const b1 = Buffer.alloc(size, 'a');
1614
const b0Len = b0.length;

Diff for: benchmark/buffers/buffer-compare-offset.js

+7-9
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,11 @@ function compareUsingOffset(b0, b1, len, iter) {
2323
bench.end(iter / 1e6);
2424
}
2525

26-
function main(conf) {
27-
const iter = (conf.millions >>> 0) * 1e6;
28-
const size = (conf.size >>> 0);
29-
const method =
30-
conf.method === 'slice' ? compareUsingSlice : compareUsingOffset;
31-
method(Buffer.alloc(size, 'a'),
32-
Buffer.alloc(size, 'b'),
33-
size >> 1,
34-
iter);
26+
function main({ millions, size, method }) {
27+
const iter = millions * 1e6;
28+
const fn = method === 'slice' ? compareUsingSlice : compareUsingOffset;
29+
fn(Buffer.alloc(size, 'a'),
30+
Buffer.alloc(size, 'b'),
31+
size >> 1,
32+
iter);
3533
}

Diff for: benchmark/buffers/buffer-compare.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,8 @@ const bench = common.createBenchmark(main, {
2727
millions: [1]
2828
});
2929

30-
function main(conf) {
31-
const iter = (conf.millions >>> 0) * 1e6;
32-
const size = (conf.size >>> 0);
30+
function main({ millions, size }) {
31+
const iter = millions * 1e6;
3332
const b0 = Buffer.alloc(size, 'a');
3433
const b1 = Buffer.alloc(size, 'a');
3534

Diff for: benchmark/buffers/buffer-concat.js

+3-7
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,11 @@ const bench = common.createBenchmark(main, {
88
n: [1024]
99
});
1010

11-
function main(conf) {
12-
const n = +conf.n;
13-
const size = +conf.pieceSize;
14-
const pieces = +conf.pieces;
15-
11+
function main({ n, pieces, pieceSize, withTotalLength }) {
1612
const list = new Array(pieces);
17-
list.fill(Buffer.allocUnsafe(size));
13+
list.fill(Buffer.allocUnsafe(pieceSize));
1814

19-
const totalLength = conf.withTotalLength ? pieces * size : undefined;
15+
const totalLength = withTotalLength ? pieces * pieceSize : undefined;
2016

2117
bench.start();
2218
for (var i = 0; i < n * 1024; i++) {

Diff for: benchmark/buffers/buffer-creation.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,8 @@ const bench = common.createBenchmark(main, {
1515
n: [1024]
1616
});
1717

18-
function main(conf) {
19-
const len = +conf.len;
20-
const n = +conf.n;
21-
switch (conf.type) {
18+
function main({ len, n, type }) {
19+
switch (type) {
2220
case '':
2321
case 'fast-alloc':
2422
bench.start();

Diff for: benchmark/buffers/buffer-from.js

+2-5
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@ const bench = common.createBenchmark(main, {
1818
n: [2048]
1919
});
2020

21-
function main(conf) {
22-
const len = +conf.len;
23-
const n = +conf.n;
24-
21+
function main({ len, n, source }) {
2522
const array = new Array(len).fill(42);
2623
const arrayBuf = new ArrayBuffer(len);
2724
const str = 'a'.repeat(len);
@@ -31,7 +28,7 @@ function main(conf) {
3128

3229
var i;
3330

34-
switch (conf.source) {
31+
switch (source) {
3532
case 'array':
3633
bench.start();
3734
for (i = 0; i < n * 1024; i++) {

Diff for: benchmark/buffers/buffer-hex.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ const bench = common.createBenchmark(main, {
77
n: [1e7]
88
});
99

10-
function main(conf) {
11-
const len = conf.len | 0;
12-
const n = conf.n | 0;
10+
function main({ len, n }) {
1311
const buf = Buffer.alloc(len);
1412

1513
for (let i = 0; i < buf.length; i++)

0 commit comments

Comments
 (0)