diff options
author | Michaël Zasso <targos@protonmail.com> | 2017-06-06 10:28:14 +0200 |
---|---|---|
committer | Michaël Zasso <targos@protonmail.com> | 2017-06-07 10:33:31 +0200 |
commit | 3dc8c3bed4cf3a77607edbb0b015e33f8b60fc09 (patch) | |
tree | 9dee56e142638b34f1eccbd0ad88c3bce5377c29 /deps/v8/test/js-perf-test | |
parent | 91a1bbe3055a660194ca4d403795aa0c03e9d056 (diff) | |
download | android-node-v8-3dc8c3bed4cf3a77607edbb0b015e33f8b60fc09.tar.gz android-node-v8-3dc8c3bed4cf3a77607edbb0b015e33f8b60fc09.tar.bz2 android-node-v8-3dc8c3bed4cf3a77607edbb0b015e33f8b60fc09.zip |
deps: update V8 to 5.9.211.32
PR-URL: https://github.com/nodejs/node/pull/13263
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Diffstat (limited to 'deps/v8/test/js-perf-test')
-rw-r--r-- | deps/v8/test/js-perf-test/Array/filter.js | 92 | ||||
-rw-r--r-- | deps/v8/test/js-perf-test/Array/map.js | 88 | ||||
-rw-r--r-- | deps/v8/test/js-perf-test/Array/run.js | 30 | ||||
-rw-r--r-- | deps/v8/test/js-perf-test/JSTests.json | 67 | ||||
-rw-r--r-- | deps/v8/test/js-perf-test/SixSpeed.json | 15 | ||||
-rw-r--r-- | deps/v8/test/js-perf-test/TypedArrays/construct-all-typedarrays.js | 40 | ||||
-rw-r--r-- | deps/v8/test/js-perf-test/TypedArrays/construct-same-typedarray.js | 17 | ||||
-rw-r--r-- | deps/v8/test/js-perf-test/TypedArrays/construct-typedarray.js | 17 |
8 files changed, 360 insertions, 6 deletions
diff --git a/deps/v8/test/js-perf-test/Array/filter.js b/deps/v8/test/js-perf-test/Array/filter.js new file mode 100644 index 0000000000..de510a4097 --- /dev/null +++ b/deps/v8/test/js-perf-test/Array/filter.js @@ -0,0 +1,92 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +function benchy(name, test, testSetup) { + new BenchmarkSuite(name, [1000], + [ + new Benchmark(name, false, false, 0, test, testSetup, ()=>{}) + ]); +} + +benchy('NaiveFilterReplacement', NaiveFilter, NaiveFilterSetup); +benchy('DoubleFilter', DoubleFilter, DoubleFilterSetup); +benchy('SmiFilter', SmiFilter, SmiFilterSetup); +benchy('FastFilter', FastFilter, FastFilterSetup); +benchy('ObjectFilter', GenericFilter, ObjectFilterSetup); + +var array; +var func; +var this_arg; +var result; +var array_size = 100; + +// Although these functions have the same code, they are separated for +// clean IC feedback. +function DoubleFilter() { + result = array.filter(func, this_arg); +} +function SmiFilter() { + result = array.filter(func, this_arg); +} +function FastFilter() { + result = array.filter(func, this_arg); +} + +function GenericFilter() { + result = Array.prototype.filter.call(array, func, this_arg); +} + +// From the lodash implementation. +function NaiveFilter() { + let index = -1 + let resIndex = 0 + const length = array == null ? 0 : array.length + const result = [] + + while (++index < length) { + const value = array[index] + if (func(value, index, array)) { + result[resIndex++] = value + } + } + return result +} + +function NaiveFilterSetup() { + // Prime NaiveFilter with polymorphic cases. + array = [1, 2, 3]; + func = ()=>true; + NaiveFilter(); + NaiveFilter(); + array = [3.4]; NaiveFilter(); + array = new Array(10); array[0] = 'hello'; NaiveFilter(); + SmiFilterSetup(); + delete array[1]; +} + +function SmiFilterSetup() { + array = new Array(); + for (var i = 0; i < array_size; i++) array[i] = i; + func = (value, index, object) => { return value % 2 === 0; }; +} + +function DoubleFilterSetup() { + array = new Array(); + for (var i = 0; i < array_size; i++) array[i] = (i + 0.5); + func = (value, index, object) => { return Math.floor(value) % 2 === 0; }; +} + +function FastFilterSetup() { + array = new Array(); + for (var i = 0; i < array_size; i++) array[i] = 'value ' + i; + func = (value, index, object) => { return index % 2 === 0; }; +} + +function ObjectFilterSetup() { + array = { length: array_size }; + for (var i = 0; i < array_size; i++) { + array[i] = i; + } + func = (value, index, object) => { return index % 2 === 0; }; +} diff --git a/deps/v8/test/js-perf-test/Array/map.js b/deps/v8/test/js-perf-test/Array/map.js new file mode 100644 index 0000000000..db6d8f0fe5 --- /dev/null +++ b/deps/v8/test/js-perf-test/Array/map.js @@ -0,0 +1,88 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +function benchy(name, test, testSetup) { + new BenchmarkSuite(name, [1000], + [ + new Benchmark(name, false, false, 0, test, testSetup, ()=>{}) + ]); +} + +benchy('NaiveMapReplacement', NaiveMap, NaiveMapSetup); +benchy('DoubleMap', DoubleMap, DoubleMapSetup); +benchy('SmiMap', SmiMap, SmiMapSetup); +benchy('FastMap', FastMap, FastMapSetup); +benchy('ObjectMap', GenericMap, ObjectMapSetup); + +var array; +var func; +var this_arg; +var result; +var array_size = 100; + +// Although these functions have the same code, they are separated for +// clean IC feedback. +function DoubleMap() { + result = array.map(func, this_arg); +} +function SmiMap() { + result = array.map(func, this_arg); +} +function FastMap() { + result = array.map(func, this_arg); +} + +function NaiveMap() { + let index = -1 + const length = array == null ? 0 : array.length + const result = new Array(length) + + while (++index < length) { + result[index] = func(array[index], index, array) + } + return result +} + + +function GenericMap() { + result = Array.prototype.map.call(array, func, this_arg); +} + +function NaiveMapSetup() { + // Prime NaiveMap with polymorphic cases. + array = [1, 2, 3]; + func = (v, i, a) => v; + NaiveMap(); + NaiveMap(); + array = [3.4]; NaiveMap(); + array = new Array(10); array[0] = 'hello'; NaiveMap(); + SmiMapSetup(); + delete array[1]; +} + +function SmiMapSetup() { + array = new Array(); + for (var i = 0; i < array_size; i++) array[i] = i; + func = (value, index, object) => { return value; }; +} + +function DoubleMapSetup() { + array = new Array(); + for (var i = 0; i < array_size; i++) array[i] = (i + 0.5); + func = (value, index, object) => { return value; }; +} + +function FastMapSetup() { + array = new Array(); + for (var i = 0; i < array_size; i++) array[i] = 'value ' + i; + func = (value, index, object) => { return value; }; +} + +function ObjectMapSetup() { + array = { length: array_size }; + for (var i = 0; i < array_size; i++) { + array[i] = i; + } + func = (value, index, object) => { return value; }; +} diff --git a/deps/v8/test/js-perf-test/Array/run.js b/deps/v8/test/js-perf-test/Array/run.js new file mode 100644 index 0000000000..e11682f7da --- /dev/null +++ b/deps/v8/test/js-perf-test/Array/run.js @@ -0,0 +1,30 @@ +// Copyright 2014 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + + +load('../base.js'); + +load('filter.js'); +load('map.js'); + +var success = true; + +function PrintResult(name, result) { + print(name + '-Array(Score): ' + result); +} + +function PrintStep(name) {} + +function PrintError(name, error) { + PrintResult(name, error); + success = false; +} + + +BenchmarkSuite.config.doWarmup = undefined; +BenchmarkSuite.config.doDeterministic = undefined; + +BenchmarkSuite.RunSuites({ NotifyResult: PrintResult, + NotifyError: PrintError, + NotifyStep: PrintStep }); diff --git a/deps/v8/test/js-perf-test/JSTests.json b/deps/v8/test/js-perf-test/JSTests.json index 79aa6ccd0d..2911ea36ca 100644 --- a/deps/v8/test/js-perf-test/JSTests.json +++ b/deps/v8/test/js-perf-test/JSTests.json @@ -283,50 +283,105 @@ { "name": "CopyWithin", "main": "run.js", + "resources": ["copywithin.js"], "test_flags": ["copywithin"] }, { "name": "Constructor", "main": "run.js", + "resources": ["constructor.js"], "test_flags": ["constructor"] }, { - "name": "Constructor--Future", - "flags": ["--future"], + "name": "Constructor--noTF", + "flags": ["--no-turbo"], "results_regexp": "^TypedArrays\\-Constructor\\(Score\\): (.+)$", "main": "run.js", + "resources": ["constructor.js"], "test_flags": ["constructor"] }, { "name": "ConstructWithBuffer", "main": "run.js", + "resources": ["construct-buffer.js"], "test_flags": ["construct-buffer"] }, { - "name": "ConstructWithBuffer--Future", - "flags": ["--future"], + "name": "ConstructWithBuffer--noTF", + "flags": ["--no-turbo"], "results_regexp": "^TypedArrays\\-ConstructWithBuffer\\(Score\\): (.+)$", "main": "run.js", + "resources": ["construct-buffer.js"], "test_flags": ["construct-buffer"] }, { "name": "ConstructArrayLike", "main": "run.js", + "resources": ["construct-arraylike.js"], "test_flags": ["construct-arraylike"] }, { - "name": "ConstructArrayLike--Future", - "flags": ["--future"], + "name": "ConstructArrayLike--noTF", + "flags": ["--no-turbo"], "results_regexp": "^TypedArrays\\-ConstructArrayLike\\(Score\\): (.+)$", "main": "run.js", + "resources": ["construct-arraylike.js"], "test_flags": ["construct-arraylike"] }, { + "name": "ConstructByTypedArray", + "main": "run.js", + "resources": ["construct-typedarray.js"], + "test_flags": ["construct-typedarray"] + }, + { + "name": "ConstructByTypedArray--noTF", + "flags": ["--no-turbo"], + "results_regexp": "^TypedArrays\\-ConstructByTypedArray\\(Score\\): (.+)$", + "main": "run.js", + "resources": ["construct-typedarray.js"], + "test_flags": ["construct-typedarray"] + }, + { + "name": "ConstructBySameTypedArray", + "main": "run.js", + "resources": ["construct-same-typedarray.js"], + "test_flags": ["construct-same-typedarray"] + }, + { + "name": "ConstructAllTypedArrays", + "main": "run.js", + "resources": ["construct-all-typedarrays.js"], + "test_flags": ["construct-all-typedarrays"] + }, + { "name": "Sort", "main": "run.js", + "resources": ["sort.js"], "test_flags": ["sort"] } ] + }, + { + "name": "Array", + "path": ["Array"], + "main": "run.js", + "resources": [ + "filter.js", "map.js" + ], + "results_regexp": "^%s\\-Array\\(Score\\): (.+)$", + "tests": [ + {"name": "NaiveFilterReplacement"}, + {"name": "DoubleFilter"}, + {"name": "SmiFilter"}, + {"name": "FastFilter"}, + {"name": "ObjectFilter"}, + {"name": "NaiveMapReplacement"}, + {"name": "DoubleMap"}, + {"name": "SmiMap"}, + {"name": "FastMap"}, + {"name": "ObjectMap"} + ] } ] } diff --git a/deps/v8/test/js-perf-test/SixSpeed.json b/deps/v8/test/js-perf-test/SixSpeed.json index 4789ff77f5..0a0dcc024a 100644 --- a/deps/v8/test/js-perf-test/SixSpeed.json +++ b/deps/v8/test/js-perf-test/SixSpeed.json @@ -16,11 +16,13 @@ { "name": "ES5", "main": "run.js", + "resources": ["array_destructuring/es5.js"], "test_flags": ["array_destructuring/es5"] }, { "name": "ES6", "main": "run.js", + "resources": ["array_destructuring/es6.js"], "test_flags": ["array_destructuring/es6"] } ] @@ -33,11 +35,13 @@ { "name": "ES5", "main": "run.js", + "resources": ["object_literals/es5.js"], "test_flags": ["object_literals/es5"] }, { "name": "ES6", "main": "run.js", + "resources": ["object_literals/es6.js"], "test_flags": ["object_literals/es6"] } ] @@ -50,11 +54,13 @@ { "name": "ES5", "main": "run.js", + "resources": ["defaults/es5.js"], "test_flags": ["defaults/es5"] }, { "name": "ES6", "main": "run.js", + "resources": ["defaults/es6.js"], "test_flags": ["defaults/es6"] } ] @@ -68,16 +74,19 @@ { "name": "ES5", "main": "run.js", + "resources": ["spread/es5.js"], "test_flags": ["spread/es5"] }, { "name": "Babel", "main": "run.js", + "resources": ["spread/babel.js"], "test_flags": ["spread/babel"] }, { "name": "ES6", "main": "run.js", + "resources": ["spread/es6.js"], "test_flags": ["spread/es6"] } ] @@ -91,16 +100,19 @@ { "name": "ES5", "main": "run.js", + "resources": ["super_spread/es5.js"], "test_flags": ["super_spread/es5"] }, { "name": "Babel", "main": "run.js", + "resources": ["super_spread/babel.js"], "test_flags": ["super_spread/babel"] }, { "name": "ES6", "main": "run.js", + "resources": ["super_spread/es6.js"], "test_flags": ["super_spread/es6"] } ] @@ -114,16 +126,19 @@ { "name": "ES5", "main": "run.js", + "resources": ["spread_literal/es5.js"], "test_flags": ["spread_literal/es5"] }, { "name": "Babel", "main": "run.js", + "resources": ["spread_literal/babel.js"], "test_flags": ["spread_literal/babel"] }, { "name": "ES6", "main": "run.js", + "resources": ["spread_literal/es6.js"], "test_flags": ["spread_literal/es6"] } ] diff --git a/deps/v8/test/js-perf-test/TypedArrays/construct-all-typedarrays.js b/deps/v8/test/js-perf-test/TypedArrays/construct-all-typedarrays.js new file mode 100644 index 0000000000..bca23ae446 --- /dev/null +++ b/deps/v8/test/js-perf-test/TypedArrays/construct-all-typedarrays.js @@ -0,0 +1,40 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +new BenchmarkSuite('ConstructAllTypedArrays', [1000], [ + new Benchmark('ConstructAllTypedArrays', false, false, 0, constructor), +]); + +var typedArrayConstructors = [ + Uint8Array, + Int8Array, + Uint16Array, + Int16Array, + Uint32Array, + Int32Array, + Float32Array, + Float64Array, + Uint8ClampedArray +]; + +const length = 32; +let uint8_array = new Uint8Array(length); +let int32_array = new Int32Array(length); +let float32_array = new Float32Array(length); +let float64_array = new Float64Array(length); +for (var i = 0; i < length; i++) { + uint8_array[i] = i; + int32_array[i] = i; + float32_array[i] = i; + float64_array[i] = i; +} + +function constructor() { + for (constructor of typedArrayConstructors) { + new constructor(uint8_array); + new constructor(int32_array); + new constructor(float32_array); + new constructor(float64_array); + } +} diff --git a/deps/v8/test/js-perf-test/TypedArrays/construct-same-typedarray.js b/deps/v8/test/js-perf-test/TypedArrays/construct-same-typedarray.js new file mode 100644 index 0000000000..45ad78d846 --- /dev/null +++ b/deps/v8/test/js-perf-test/TypedArrays/construct-same-typedarray.js @@ -0,0 +1,17 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +new BenchmarkSuite('ConstructBySameTypedArray', [1000], [ + new Benchmark('ConstructBySameTypedArray', false, false, 0, constructor), +]); + +const length = 1024; +let arr = new Uint8Array(length); +for (var i = 0; i < length; i++) { + arr[i] = i; +} + +function constructor() { + new Uint8Array(arr); +} diff --git a/deps/v8/test/js-perf-test/TypedArrays/construct-typedarray.js b/deps/v8/test/js-perf-test/TypedArrays/construct-typedarray.js new file mode 100644 index 0000000000..b2ee34483f --- /dev/null +++ b/deps/v8/test/js-perf-test/TypedArrays/construct-typedarray.js @@ -0,0 +1,17 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +new BenchmarkSuite('ConstructByTypedArray', [1000], [ + new Benchmark('ConstructByTypedArray', false, false, 0, constructor), +]); + +var length = 1024; +var arr = new Uint8Array(length); +for (var i = 0; i < length; i++) { + arr[i] = i; +} + +function constructor() { + new Float64Array(arr); +} |