From 586db2414a338e1bf6eaf6e672a3adc7ce309f6a Mon Sep 17 00:00:00 2001 From: Michaël Zasso Date: Fri, 7 Sep 2018 17:07:13 +0200 Subject: deps: update V8 to 6.9.427.22 PR-URL: https://github.com/nodejs/node/pull/21983 Reviewed-By: Refael Ackermann Reviewed-By: Gus Caplan Reviewed-By: Ujjwal Sharma Reviewed-By: Matteo Collina --- deps/v8/test/js-perf-test/Array/from.js | 293 +++++++++++---------- deps/v8/test/js-perf-test/Array/join.js | 8 +- deps/v8/test/js-perf-test/Array/of.js | 224 ++++++++-------- deps/v8/test/js-perf-test/Array/run.js | 10 +- deps/v8/test/js-perf-test/Array/slice.js | 83 ++++++ deps/v8/test/js-perf-test/Array/to-string.js | 9 +- deps/v8/test/js-perf-test/ArraySort/run.js | 7 - deps/v8/test/js-perf-test/ArraySort/sort-base.js | 27 +- .../ArraySort/sort-cmpfn-kindchange.js | 26 +- deps/v8/test/js-perf-test/ArraySort/sort-cmpfn.js | 15 +- .../v8/test/js-perf-test/ArraySort/sort-lengths.js | 40 +++ .../js-perf-test/ArraySort/sort-megamorphic.js | 6 +- .../test/js-perf-test/ArraySort/sort-presorted.js | 107 +++++++- deps/v8/test/js-perf-test/ArraySort/sort.js | 14 +- deps/v8/test/js-perf-test/DataView/dataviewtest.js | 60 +++++ deps/v8/test/js-perf-test/Inspector/debugger.js | 120 ++++----- deps/v8/test/js-perf-test/JSTests.json | 55 +++- deps/v8/test/js-perf-test/RegExp.json | 1 + deps/v8/test/js-perf-test/RegExp/RegExpTests.json | 1 + deps/v8/test/js-perf-test/RegExp/inline_test.js | 17 ++ deps/v8/test/js-perf-test/RegExp/run.js | 2 +- deps/v8/test/js-perf-test/RegExp/test_inl.js | 17 -- deps/v8/test/js-perf-test/Strings/run.js | 1 - .../Strings/string-startsendswith-comp.js | 12 +- .../js-perf-test/Strings/string-stringat-comp.js | 18 +- .../test/js-perf-test/Strings/string-substring.js | 46 ++-- deps/v8/test/js-perf-test/base.js | 10 +- 27 files changed, 775 insertions(+), 454 deletions(-) create mode 100644 deps/v8/test/js-perf-test/Array/slice.js create mode 100644 deps/v8/test/js-perf-test/ArraySort/sort-lengths.js create mode 100644 deps/v8/test/js-perf-test/RegExp/inline_test.js delete mode 100644 deps/v8/test/js-perf-test/RegExp/test_inl.js (limited to 'deps/v8/test/js-perf-test') diff --git a/deps/v8/test/js-perf-test/Array/from.js b/deps/v8/test/js-perf-test/Array/from.js index 2c6bd265bd..06e00a223e 100644 --- a/deps/v8/test/js-perf-test/Array/from.js +++ b/deps/v8/test/js-perf-test/Array/from.js @@ -3,151 +3,152 @@ // found in the LICENSE file. (() => { -benchy('MixedFrom', MixedFrom, MixedFromSetup); -benchy('SmiFrom', SmiFrom, SmiFromSetup); -benchy('SmallSmiFrom', SmallSmiFrom, SmallSmiFromSetup); -benchy('SmiNoMapFrom', SmiNoMapFrom, SmiNoMapFromSetup); -benchy('SmiNoIteratorFrom', SmiNoIteratorFrom, SmiNoIteratorFromSetup); -benchy('TransplantedFrom', TransplantedFrom, TransplantedFromSetup); -benchy('DoubleFrom', DoubleFrom, DoubleFromSetup); -benchy('StringFrom', StringFrom, StringFromSetup); -benchy('StringNoMapFrom', StringNoMapFrom, StringNoMapFromSetup); - -function ArrayLike() {} -ArrayLike.from = Array.from; - -var arg -var result; -var func - -var smi_array = [ - 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20, - 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20, - 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20, - 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20, - 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20, -]; - -var double_array = [ - 1.5,2.5,3.5,4.5,5.5,6.5,7.5,8.5,9.5,10.5, - 11.5,12.5,13.5,14.5,15.5,16.5,17.5,18.5,19.5,20.5, - 1.5,2.5,3.5,4.5,5.5,6.5,7.5,8.5,9.5,10.5, - 11.5,12.5,13.5,14.5,15.5,16.5,17.5,18.5,19.5,20.5, - 1.5,2.5,3.5,4.5,5.5,6.5,7.5,8.5,9.5,10.5, - 11.5,12.5,13.5,14.5,15.5,16.5,17.5,18.5,19.5,20.5, - 1.5,2.5,3.5,4.5,5.5,6.5,7.5,8.5,9.5,10.5, - 11.5,12.5,13.5,14.5,15.5,16.5,17.5,18.5,19.5,20.5, - 1.5,2.5,3.5,4.5,5.5,6.5,7.5,8.5,9.5,10.5, - 11.5,12.5,13.5,14.5,15.5,16.5,17.5,18.5,19.5,20.5, -]; - -var string_array = [ - "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", - "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", - "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", - "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", - "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", - "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", - "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", - "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", - "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", - "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", -]; - -var mixed_array = [ - 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20, - 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20, - 1.5,2.5,3.5,4.5,5.5,6.5,7.5,8.5,9.5,10.5, - 11.5,12.5,13.5,14.5,15.5,16.5,17.5,18.5,19.5,20.5, - 1.5,2.5,3.5,4.5,5.5,6.5,7.5,8.5,9.5,10.5, - 11.5,12.5,13.5,14.5,15.5,16.5,17.5,18.5,19.5,20.5, - "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", - "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", -] - -// Although these functions have the same code, they are separated for -// clean IC feedback. -function SmallSmiFrom() { - result = Array.from(arg, func); -} - -function SmiNoMapFrom() { - result = Array.from(arg); -} - -function SmiFrom() { - result = Array.from(arg, func); -} - -function SmiNoIteratorFrom() { - result = Array.from(arg, func); -} - -function TransplantedFrom() { - result = ArrayLike.from(arg, func); -} - -function DoubleFrom() { - result = Array.from(arg, func); -} - -function StringFrom() { - result = Array.from(arg, func); -} - -function StringNoMapFrom() { - result = Array.from(arg); -} - -function MixedFrom() { - result = Array.from(arg, func); -} - -function SmallSmiFromSetup() { - func = (v,i) => v + i; - arg = [1,2,3]; -} - -function SmiNoMapFromSetup() { - func = undefined; - arg = smi_array; -} - -function SmiFromSetup() { - func = (v,i) => v + i; - arg = smi_array; -} - -function SmiNoIteratorFromSetup() { - func = (v,i) => v + i; - array = smi_array; - arg = {length: array.length} - Object.assign(arg, array); -} - -function TransplantedFromSetup() { - func = (v,i) => v + i; - arg = smi_array; -} - -function DoubleFromSetup() { - func = (v,i) => v + i; - arg = double_array; -} - -function StringFromSetup() { - func = (v,i) => v + i; - arg = string_array; -} - -function StringNoMapFromSetup() { - func = undefined; - arg = string_array; -} - -function MixedFromSetup() { - func = (v,i) => v + i; - arg = mixed_array; -} + createSuite('MixedFrom', 1000, MixedFrom, MixedFromSetup); + createSuite('SmiFrom', 1000, SmiFrom, SmiFromSetup); + createSuite('SmallSmiFrom', 1000, SmallSmiFrom, SmallSmiFromSetup); + createSuite('SmiNoMapFrom', 1000, SmiNoMapFrom, SmiNoMapFromSetup); + createSuite( + 'SmiNoIteratorFrom', 1000, SmiNoIteratorFrom, SmiNoIteratorFromSetup); + createSuite( + 'TransplantedFrom', 1000, TransplantedFrom, TransplantedFromSetup); + createSuite('DoubleFrom', 1000, DoubleFrom, DoubleFromSetup); + createSuite('StringFrom', 1000, StringFrom, StringFromSetup); + createSuite('StringNoMapFrom', 1000, StringNoMapFrom, StringNoMapFromSetup); + + function ArrayLike() {} + ArrayLike.from = Array.from; + + var arg + var result; + var func + + var smi_array = [ + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + ]; + + var double_array = [ + 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, 10.5, // + 11.5, 12.5, 13.5, 14.5, 15.5, 16.5, 17.5, 18.5, 19.5, 20.5, + 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, 10.5, // + 11.5, 12.5, 13.5, 14.5, 15.5, 16.5, 17.5, 18.5, 19.5, 20.5, + 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, 10.5, // + 11.5, 12.5, 13.5, 14.5, 15.5, 16.5, 17.5, 18.5, 19.5, 20.5, + 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, 10.5, // + 11.5, 12.5, 13.5, 14.5, 15.5, 16.5, 17.5, 18.5, 19.5, 20.5, + 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, 10.5, // + 11.5, 12.5, 13.5, 14.5, 15.5, 16.5, 17.5, 18.5, 19.5, 20.5, + ]; + + var string_array = [ + 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'a', 'b', 'c', 'a', 'b', + 'c', 'a', 'b', 'c', 'a', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', + 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'a', 'b', 'c', 'a', 'b', + 'c', 'a', 'b', 'c', 'a', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', + 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'a', 'b', 'c', 'a', 'b', + 'c', 'a', 'b', 'c', 'a', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', + 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', + ]; + + var mixed_array = [ + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, // + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, // + 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, 10.5, + 11.5, 12.5, 13.5, 14.5, 15.5, 16.5, 17.5, 18.5, 19.5, 20.5, // + 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, 10.5, + 11.5, 12.5, 13.5, 14.5, 15.5, 16.5, 17.5, 18.5, 19.5, 20.5, // + 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', + 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', + ]; + + // Although these functions have the same code, they are separated for + // clean IC feedback. + function SmallSmiFrom() { + result = Array.from(arg, func); + } + + function SmiNoMapFrom() { + result = Array.from(arg); + } + + function SmiFrom() { + result = Array.from(arg, func); + } + + function SmiNoIteratorFrom() { + result = Array.from(arg, func); + } + + function TransplantedFrom() { + result = ArrayLike.from(arg, func); + } + + function DoubleFrom() { + result = Array.from(arg, func); + } + + function StringFrom() { + result = Array.from(arg, func); + } + + function StringNoMapFrom() { + result = Array.from(arg); + } + + function MixedFrom() { + result = Array.from(arg, func); + } + + function SmallSmiFromSetup() { + func = (v, i) => v + i; + arg = [1, 2, 3]; + } + + function SmiNoMapFromSetup() { + func = undefined; + arg = smi_array; + } + + function SmiFromSetup() { + func = (v, i) => v + i; + arg = smi_array; + } + + function SmiNoIteratorFromSetup() { + func = (v, i) => v + i; + array = smi_array; + arg = {length: array.length}; + Object.assign(arg, array); + } + + function TransplantedFromSetup() { + func = (v, i) => v + i; + arg = smi_array; + } + + function DoubleFromSetup() { + func = (v, i) => v + i; + arg = double_array; + } + + function StringFromSetup() { + func = (v, i) => v + i; + arg = string_array; + } + + function StringNoMapFromSetup() { + func = undefined; + arg = string_array; + } + + function MixedFromSetup() { + func = (v, i) => v + i; + arg = mixed_array; + } })(); diff --git a/deps/v8/test/js-perf-test/Array/join.js b/deps/v8/test/js-perf-test/Array/join.js index ef9d298421..c9928e791d 100644 --- a/deps/v8/test/js-perf-test/Array/join.js +++ b/deps/v8/test/js-perf-test/Array/join.js @@ -11,10 +11,10 @@ function make_join() { return new Function('result = array.join();'); } -benchy('SmiJoin', make_join(), SmiJoinSetup); -benchy('StringJoin', make_join(), StringJoinSetup); -benchy('SparseSmiJoin', make_join(), SparseSmiJoinSetup); -benchy('SparseStringJoin', make_join(), SparseStringJoinSetup); +createSuite('SmiJoin', 1000, make_join(), SmiJoinSetup); +createSuite('StringJoin', 1000, make_join(), StringJoinSetup); +createSuite('SparseSmiJoin', 1000, make_join(), SparseSmiJoinSetup); +createSuite('SparseStringJoin', 1000, make_join(), SparseStringJoinSetup); function SmiJoinSetup() { array = new Array(); diff --git a/deps/v8/test/js-perf-test/Array/of.js b/deps/v8/test/js-perf-test/Array/of.js index bfd471245c..f876ce6f61 100644 --- a/deps/v8/test/js-perf-test/Array/of.js +++ b/deps/v8/test/js-perf-test/Array/of.js @@ -3,115 +3,119 @@ // found in the LICENSE file. (() => { -benchy('EmptyArrayOf', EmptyArrayOf, EmptyArrayOfSetup); -benchy('SmallTransplantedArrayOf', SmallTransplantedArrayOf, - SmallTransplantedArrayOfSetup); -benchy('SmallSmiArrayOf', SmallSmiArrayOf, SmallSmiArrayOfSetup); -benchy('LargeSmiArrayOf', LargeSmiArrayOf, LargeSmiArrayOfSetup); -benchy('SmallDoubleArrayOf', SmallDoubleArrayOf, SmallDoubleArrayOfSetup); -benchy('SmallStringArrayOf', SmallStringArrayOf, SmallStringArrayOfSetup); -benchy('SmallMixedArrayOf', SmallMixedArrayOf, SmallMixedArrayOfSetup); - -function ArrayLike() {} -ArrayLike.of = Array.of; - -var arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10 -var arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19, arg20 -var result; - -function EmptyArrayOf() { - result = Array.of(); -} - -function BaselineArray() { - result = [arg1, arg2, arg3]; -} - -function SmallSmiArrayOf() { - result = Array.of(arg1, arg2, arg3); -} - -function LargeSmiArrayOf() { - result = Array.of(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, - arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19, arg20); -} - -function SmallTransplantedArrayOf() { - result = ArrayLike.of(arg1, arg2, arg3); -} - -function SmallDoubleArrayOf() { - result = Array.of(arg1, arg2, arg3); -} - -function SmallStringArrayOf() { - result = Array.of(arg1, arg2, arg3); -} - -function SmallMixedArrayOf() { - result = Array.of(arg1, arg2, arg3); -} - -function EmptyArrayOfSetup() { -} - -function BaselineArraySetup() { - arg1 = 1; - arg2 = 2; - arg3 = 3; -} - -function SmallSmiArrayOfSetup() { - arg1 = 1; - arg2 = 2; - arg3 = 3; -} - -function SmallTransplantedArrayOfSetup() { - arg1 = 1; - arg2 = 2; - arg3 = 3; -} - -function SmallDoubleArrayOfSetup() { - arg1 = 1.5; - arg2 = 2.5; - arg3 = 3.5; -} - -function SmallStringArrayOfSetup() { - arg1 = "cat"; - arg2 = "dog"; - arg3 = "giraffe"; -} - -function SmallMixedArrayOfSetup() { - arg1 = 1; - arg2 = 2.5; - arg3 = "giraffe"; -} - -function LargeSmiArrayOfSetup() { - arg1 = 1; - arg2 = 2; - arg3 = 3; - arg4 = 4; - arg5 = 5; - arg6 = 6; - arg7 = 7; - arg8 = 8; - arg9 = 9; - arg10 = 10; - arg11 = 11; - arg12 = 12; - arg13 = 13; - arg14 = 14; - arg15 = 15; - arg16 = 16; - arg17 = 17; - arg18 = 18; - arg19 = 19; - arg20 = 20; -} + createSuite('EmptyArrayOf', 1000, EmptyArrayOf, EmptyArrayOfSetup); + createSuite( + 'SmallTransplantedArrayOf', 1000, SmallTransplantedArrayOf, + SmallTransplantedArrayOfSetup); + createSuite('SmallSmiArrayOf', 1000, SmallSmiArrayOf, SmallSmiArrayOfSetup); + createSuite('LargeSmiArrayOf', 1000, LargeSmiArrayOf, LargeSmiArrayOfSetup); + createSuite( + 'SmallDoubleArrayOf', 1000, SmallDoubleArrayOf, SmallDoubleArrayOfSetup); + createSuite( + 'SmallStringArrayOf', 1000, SmallStringArrayOf, SmallStringArrayOfSetup); + createSuite( + 'SmallMixedArrayOf', 1000, SmallMixedArrayOf, SmallMixedArrayOfSetup); + + function ArrayLike() {} + ArrayLike.of = Array.of; + + var arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10 + var arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19, arg20 + var result; + + function EmptyArrayOf() { + result = Array.of(); + } + + function BaselineArray() { + result = [arg1, arg2, arg3]; + } + + function SmallSmiArrayOf() { + result = Array.of(arg1, arg2, arg3); + } + + function LargeSmiArrayOf() { + result = Array.of( + arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, + arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19, arg20); + } + + function SmallTransplantedArrayOf() { + result = ArrayLike.of(arg1, arg2, arg3); + } + + function SmallDoubleArrayOf() { + result = Array.of(arg1, arg2, arg3); + } + + function SmallStringArrayOf() { + result = Array.of(arg1, arg2, arg3); + } + + function SmallMixedArrayOf() { + result = Array.of(arg1, arg2, arg3); + } + + function EmptyArrayOfSetup() {} + + function BaselineArraySetup() { + arg1 = 1; + arg2 = 2; + arg3 = 3; + } + + function SmallSmiArrayOfSetup() { + arg1 = 1; + arg2 = 2; + arg3 = 3; + } + + function SmallTransplantedArrayOfSetup() { + arg1 = 1; + arg2 = 2; + arg3 = 3; + } + + function SmallDoubleArrayOfSetup() { + arg1 = 1.5; + arg2 = 2.5; + arg3 = 3.5; + } + + function SmallStringArrayOfSetup() { + arg1 = 'cat'; + arg2 = 'dog'; + arg3 = 'giraffe'; + } + + function SmallMixedArrayOfSetup() { + arg1 = 1; + arg2 = 2.5; + arg3 = 'giraffe'; + } + + function LargeSmiArrayOfSetup() { + arg1 = 1; + arg2 = 2; + arg3 = 3; + arg4 = 4; + arg5 = 5; + arg6 = 6; + arg7 = 7; + arg8 = 8; + arg9 = 9; + arg10 = 10; + arg11 = 11; + arg12 = 12; + arg13 = 13; + arg14 = 14; + arg15 = 15; + arg16 = 16; + arg17 = 17; + arg18 = 18; + arg19 = 19; + arg20 = 20; + } })(); diff --git a/deps/v8/test/js-perf-test/Array/run.js b/deps/v8/test/js-perf-test/Array/run.js index 623047678a..52de9c3809 100644 --- a/deps/v8/test/js-perf-test/Array/run.js +++ b/deps/v8/test/js-perf-test/Array/run.js @@ -24,13 +24,6 @@ function mc(name, generic = false) { return new Function(`result = array.${name}(func, this_arg);`); } -function benchy(name, test, testSetup) { - new BenchmarkSuite(name, [1000], - [ - new Benchmark(name, false, false, 0, test, testSetup, ()=>{}) - ]); -} - function SmiSetup() { array = Array.from({ length: array_size }, (_, i) => i); } @@ -63,7 +56,7 @@ function DefineHigherOrderTests(tests) { this_arg = undefined; setupFunc(); }; - benchy(name, testFunc, setupFuncWrapper); + createSuite(name, 1000, testFunc, setupFuncWrapper); } } @@ -83,6 +76,7 @@ load('from.js'); load('of.js'); load('join.js'); load('to-string.js'); +load('slice.js'); var success = true; diff --git a/deps/v8/test/js-perf-test/Array/slice.js b/deps/v8/test/js-perf-test/Array/slice.js new file mode 100644 index 0000000000..c9e60930f3 --- /dev/null +++ b/deps/v8/test/js-perf-test/Array/slice.js @@ -0,0 +1,83 @@ +// Copyright 2018 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. +(() => { + + const A = new Array(1000); + + for (let i = 0; i < A.length; i++) { + A[i] = i; + } + + function testArraySlice500() { + return A.slice(500); + } + + function testArraySlice500_999() { + return A.slice(500, 999); + } + + function testArraySliceN500() { + return A.slice(-500); + } + + function testArraySlice200_700() { + return A.slice(200, 700); + } + + function testArraySlice200_N300() { + return A.slice(200, -300); + } + + function testArraySlice4_1() { + return A.slice(200, -300); + } + + createSuiteWithWarmup("Array.slice(500)", 1, testArraySlice500); + createSuiteWithWarmup("Array.slice(500,999)", 1, testArraySlice500_999); + createSuiteWithWarmup("Array.slice(-500)", 1, testArraySliceN500); + createSuiteWithWarmup("Array.slice(200,700)", 1, testArraySlice200_700); + createSuiteWithWarmup("Array.slice(200,-300)", 1, testArraySlice200_N300); + createSuiteWithWarmup("Array.slice(4,1)", 1, testArraySlice4_1); + +})(); + +(() => { + + function assert(condition, message) { + if (!condition) { + throw Error(message); + } + } + + const A = new Array(1000); + + for (let i = 0; i < A.length; i++) { + A[i] = i; + } + + A[100000] = 255; + assert(%HasDictionaryElements(A), "A should be in dictionary mode for this test"); + + function testArraySlice500_999() { + return A.slice(500, 999); + } + + function testArraySlice200_700() { + return A.slice(200, 700); + } + + function testArraySlice200_N300() { + return A.slice(200, -300); + } + + function testArraySlice4_1() { + return A.slice(200, -300); + } + + createSuiteWithWarmup("Array.slice(500,999)-dict", 1, testArraySlice500_999); + createSuiteWithWarmup("Array.slice(200,700)-dict", 1, testArraySlice200_700); + createSuiteWithWarmup("Array.slice(200,-300)-dict", 1, testArraySlice200_N300); + createSuiteWithWarmup("Array.slice(4,1)-dict", 1, testArraySlice4_1); + +})(); diff --git a/deps/v8/test/js-perf-test/Array/to-string.js b/deps/v8/test/js-perf-test/Array/to-string.js index 1b6dd36eaa..c97a8c173f 100644 --- a/deps/v8/test/js-perf-test/Array/to-string.js +++ b/deps/v8/test/js-perf-test/Array/to-string.js @@ -7,10 +7,11 @@ function make_tostring() { return new Function("result = array.toString();"); } -benchy('SmiToString', make_tostring(), SmiToStringSetup); -benchy('StringToString', make_tostring(), StringToStringSetup); -benchy('SparseSmiToString', make_tostring(), SparseSmiToStringSetup); -benchy('SparseStringToString', make_tostring(), SparseStringToStringSetup); +createSuite('SmiToString', 1000, make_tostring(), SmiToStringSetup); +createSuite('StringToString', 1000, make_tostring(), StringToStringSetup); +createSuite('SparseSmiToString', 1000, make_tostring(), SparseSmiToStringSetup); +createSuite( + 'SparseStringToString', 1000, make_tostring(), SparseStringToStringSetup); var array; var result; diff --git a/deps/v8/test/js-perf-test/ArraySort/run.js b/deps/v8/test/js-perf-test/ArraySort/run.js index 9eb8ac631c..95f64d6450 100644 --- a/deps/v8/test/js-perf-test/ArraySort/run.js +++ b/deps/v8/test/js-perf-test/ArraySort/run.js @@ -5,13 +5,6 @@ load('../base.js'); load(arguments[0] + '.js') -function benchy(name, test, testSetup, testTearDown) { - new BenchmarkSuite(name, [1000], - [ - new Benchmark(name, false, false, 0, test, testSetup, testTearDown) - ]); -} - function PrintResult(name, result) { print(name + '-ArraySort(Score): ' + result); } diff --git a/deps/v8/test/js-perf-test/ArraySort/sort-base.js b/deps/v8/test/js-perf-test/ArraySort/sort-base.js index 8e75879d45..a3301752b2 100644 --- a/deps/v8/test/js-perf-test/ArraySort/sort-base.js +++ b/deps/v8/test/js-perf-test/ArraySort/sort-base.js @@ -74,11 +74,8 @@ function CreatePackedObjectArray() { } function CreateHoleySmiArray() { - array_to_sort = new Array(kArraySize); - for (let i = 0; i < kArraySize; ++i) { - array_to_sort[i] = template_array[i]; - } - + array_to_sort = Array.from(template_array); + delete array_to_sort[0]; AssertHoleySmiElements(); } @@ -126,3 +123,23 @@ function cmp_smaller(a, b) { } function cmp_greater(a, b) { return cmp_smaller(b, a); } + +// The counter is used in some benchmarks to trigger actions during sorting. +// To keep benchmarks deterministic, the counter needs to be reset for each +// iteration. +let counter = 0; + +// Sorting benchmarks need to execute setup and tearDown for each iteration. +// Otherwise the benchmarks would mainly measure sorting already sorted arrays +// which, depending on the strategy, is either the worst- or best case. +function createSortSuite(name, reference, run, setup, tearDown = () => {}) { + let run_fn = () => { + counter = 0; + + setup(); + run(); + tearDown(); + }; + + return createSuite(name, reference, run_fn); +} diff --git a/deps/v8/test/js-perf-test/ArraySort/sort-cmpfn-kindchange.js b/deps/v8/test/js-perf-test/ArraySort/sort-cmpfn-kindchange.js index 83cffdbe08..8ff1a02599 100644 --- a/deps/v8/test/js-perf-test/ArraySort/sort-cmpfn-kindchange.js +++ b/deps/v8/test/js-perf-test/ArraySort/sort-cmpfn-kindchange.js @@ -8,7 +8,6 @@ load('sort-base.js'); // after a set amount of comparisons. The transform function should cause the // element kind of the array to change. function CreateCompareFn(transformfn) { - let counter = 0; return (a, b) => { ++counter; if (counter == kArraySize/2) { @@ -23,17 +22,22 @@ let cmp_packed_smi_to_double = CreateCompareFn(() => array_to_sort.push(0.1)); let cmp_holey_smi_to_double = CreateCompareFn(() => array_to_sort.push(0.1)); let cmp_double_to_double = CreateCompareFn(() => array_to_sort.length *= 2); -benchy('PackedSmiToPackedDouble', CreateSortFn([cmp_packed_smi_to_double]), - CreatePackedSmiArray, AssertPackedDoubleElements); -benchy('HoleySmiToHoleyDouble', CreateSortFn([cmp_holey_smi_to_double]), - CreateHoleySmiArray, AssertHoleyDoubleElements); -benchy('PackedDoubleToHoleyDouble', CreateSortFn([cmp_double_to_double]), - CreatePackedDoubleArray, AssertHoleyDoubleElements); +createSortSuite( + 'PackedSmiToPackedDouble', 1000, CreateSortFn([cmp_packed_smi_to_double]), + CreatePackedSmiArray, AssertPackedDoubleElements); +createSortSuite( + 'HoleySmiToHoleyDouble', 1000, CreateSortFn([cmp_holey_smi_to_double]), + CreateHoleySmiArray, AssertHoleyDoubleElements); +createSortSuite( + 'PackedDoubleToHoleyDouble', 1000, CreateSortFn([cmp_double_to_double]), + CreatePackedDoubleArray, AssertHoleyDoubleElements); let cmp_packed_to_dict = CreateCompareFn(() => array_to_sort[%MaxSmi()] = 42); let cmp_holey_to_dict = CreateCompareFn(() => array_to_sort[%MaxSmi()] = 42); -benchy('PackedElementToDictionary', CreateSortFn([cmp_packed_to_dict]), - CreatePackedObjectArray, AssertDictionaryElements); -benchy('HoleyElementToDictionary', CreateSortFn([cmp_holey_to_dict]), - CreateHoleyObjectArray, AssertDictionaryElements); +createSortSuite( + 'PackedElementToDictionary', 1000, CreateSortFn([cmp_packed_to_dict]), + CreatePackedObjectArray, AssertDictionaryElements); +createSortSuite( + 'HoleyElementToDictionary', 1000, CreateSortFn([cmp_holey_to_dict]), + CreateHoleyObjectArray, AssertDictionaryElements); diff --git a/deps/v8/test/js-perf-test/ArraySort/sort-cmpfn.js b/deps/v8/test/js-perf-test/ArraySort/sort-cmpfn.js index 74a5055567..9675f5ce9e 100644 --- a/deps/v8/test/js-perf-test/ArraySort/sort-cmpfn.js +++ b/deps/v8/test/js-perf-test/ArraySort/sort-cmpfn.js @@ -7,15 +7,14 @@ load('sort-base.js'); // Each benchmark calls sort with multiple different comparison functions // to create polyomorphic call sites. Most/all of the // other sort benchmarks have monomorphic call sites. - let sortfn = CreateSortFn([cmp_smaller, cmp_greater]); -benchy('PackedSmi', sortfn, CreatePackedSmiArray); -benchy('PackedDouble', sortfn, CreatePackedDoubleArray); -benchy('PackedElement', sortfn, CreatePackedObjectArray); +createSortSuite('PackedSmi', 1000, sortfn, CreatePackedSmiArray); +createSortSuite('PackedDouble', 1000, sortfn, CreatePackedDoubleArray); +createSortSuite('PackedElement', 1000, sortfn, CreatePackedObjectArray); -benchy('HoleySmi', sortfn, CreateHoleySmiArray); -benchy('HoleyDouble', sortfn, CreateHoleyDoubleArray); -benchy('HoleyElement', sortfn, CreateHoleyObjectArray); +createSortSuite('HoleySmi', 1000, sortfn, CreateHoleySmiArray); +createSortSuite('HoleyDouble', 1000, sortfn, CreateHoleyDoubleArray); +createSortSuite('HoleyElement', 1000, sortfn, CreateHoleyObjectArray); -benchy('Dictionary', sortfn, CreateDictionaryArray); +createSortSuite('Dictionary', 1000, sortfn, CreateDictionaryArray); diff --git a/deps/v8/test/js-perf-test/ArraySort/sort-lengths.js b/deps/v8/test/js-perf-test/ArraySort/sort-lengths.js new file mode 100644 index 0000000000..aa681295c1 --- /dev/null +++ b/deps/v8/test/js-perf-test/ArraySort/sort-lengths.js @@ -0,0 +1,40 @@ +// Copyright 2018 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('sort-base.js'); + +function SortAsc() { + array_to_sort.sort(cmp_smaller); +} + +function Random(length) { + for (let i = 0; i < length; ++i) { + array_to_sort.push(Math.floor(Math.random()) * length); + } + AssertPackedSmiElements(); +} + +function Sorted(length) { + for (let i = 0; i < length; ++i) { + array_to_sort.push(i); + } + AssertPackedSmiElements(); +} + +function TearDown() { + array_to_sort = []; +} + +function CreateSortSuitesForLength(length) { + createSortSuite( + 'Random' + length, 1000, SortAsc, () => Random(length), TearDown); + createSortSuite( + 'Sorted' + length, 1000, SortAsc, () => Sorted(length), TearDown); +} + +CreateSortSuitesForLength(10); +CreateSortSuitesForLength(100); +CreateSortSuitesForLength(1000); +CreateSortSuitesForLength(10000); +CreateSortSuitesForLength(100000); diff --git a/deps/v8/test/js-perf-test/ArraySort/sort-megamorphic.js b/deps/v8/test/js-perf-test/ArraySort/sort-megamorphic.js index 7f627e6c73..4f71031358 100644 --- a/deps/v8/test/js-perf-test/ArraySort/sort-megamorphic.js +++ b/deps/v8/test/js-perf-test/ArraySort/sort-megamorphic.js @@ -15,6 +15,6 @@ function SetupMegamorphic() { Array.prototype.sort.call({}); } -benchy('Base', Sort, SetupMegamorphic); -benchy('MultipleCompareFns', CreateSortFn([cmp_smaller, cmp_greater]), - SetupMegamorphic); +createSortSuite('Base', 1000, Sort, SetupMegamorphic); +createSortSuite('MultipleCompareFns', 1000, + CreateSortFn([cmp_smaller, cmp_greater]), SetupMegamorphic); diff --git a/deps/v8/test/js-perf-test/ArraySort/sort-presorted.js b/deps/v8/test/js-perf-test/ArraySort/sort-presorted.js index a0a55023a1..50786411bb 100644 --- a/deps/v8/test/js-perf-test/ArraySort/sort-presorted.js +++ b/deps/v8/test/js-perf-test/ArraySort/sort-presorted.js @@ -4,16 +4,105 @@ load('sort-base.js'); -function SetupPreSorted() { - CreatePackedSmiArray(); - array_to_sort.sort(); +const kLength = 2e4; +const kLengthHalf = kLength >>> 1; + +function SortAsc() { + array_to_sort.sort(cmp_smaller); +} + +function Up(a, length) { + for (let i = 0; i < length; ++i) { + a.push(i); + } +} + +function Down(a, length) { + for (let i = 0; i < length; ++i) { + a.push(length - i); + } +} + +function SawSeq(a, tooth, length) { + let count = 0; + while (true) { + for (let i = 0; i < tooth; ++i) { + a.push(i); + if (++count >= length) return; + } + } +} + +function SawSeq2(a, tooth, length) { + let count = 0; + while (true) { + for (let i = 0; i < tooth; ++i) { + a.push(i); + if (++count >= length) return; + } + for (let i = 0; i < tooth; ++i) { + a.push(tooth - i); + if (++count >= length) return; + } + } } -function SetupPreSortedReversed() { - CreatePackedSmiArray(); - array_to_sort.sort(); - array_to_sort.reverse(); +function SawSeq3(a, tooth, length) { + let count = 0; + while (true) { + for (let i = 0; i < tooth; ++i) { + a.push(tooth - i); + if (++count >= length) return; + } + } } -benchy('PackedSmiPreSorted', Sort, SetupPreSorted); -benchy('PackedSmiPreSortedReversed', Sort, SetupPreSortedReversed); +function Random(a, length) { + for (let i = 0; i < length; ++i) { + a.push(Math.floor(Math.random() * length)); + } +} + +function TearDown() { + // Sanity check that the array is sorted. + let length = array_to_sort.length - 1; + for (let i = 0; i < length; ++i) { + if (array_to_sort[i] > array_to_sort[i + 1]) { + throw "Not sorted correctly: i = " + i; + } + } + array_to_sort = []; +} + +let SetupSaw1000 = () => SawSeq(array_to_sort, 1000, kLength); +let SetupSaw500 = () => SawSeq(array_to_sort, 500, kLength); +let SetupSaw200 = () => SawSeq(array_to_sort, 200, kLength); +let SetupSaw200Sym = () => SawSeq2(array_to_sort, 200, kLength); +let SetupSaw200Down = () => SawSeq3(array_to_sort, 200, kLength); + +function SetupPreSortedHalfs(firstfn, secondfn) { + array_to_sort = []; + firstfn(array_to_sort, kLengthHalf); + secondfn(array_to_sort, kLengthHalf); +} + +let SetupUpDown = () => SetupPreSortedHalfs(Up, Down); +let SetupUpUp = () => SetupPreSortedHalfs(Up, Up); +let SetupDownDown = () => SetupPreSortedHalfs(Down, Down); +let SetupDownUp = () => SetupPreSortedHalfs(Down, Up); + +createSortSuite( + 'Random', 1000, SortAsc, () => Random(array_to_sort, kLength), TearDown); +createSortSuite( + 'Up', 1000, SortAsc, () => Up(array_to_sort, kLength), TearDown); +createSortSuite( + 'Down', 1000, SortAsc, () => Down(array_to_sort, kLength), TearDown); +createSortSuite('Saw1000', 1000, SortAsc, SetupSaw1000, TearDown); +createSortSuite('Saw500', 1000, SortAsc, SetupSaw500, TearDown); +createSortSuite('Saw200', 1000, SortAsc, SetupSaw200, TearDown); +createSortSuite('Saw200Symmetric', 1000, SortAsc, SetupSaw200Sym, TearDown); +createSortSuite('Saw200Down', 1000, SortAsc, SetupSaw200Down, TearDown); +createSortSuite('UpDown', 1000, SortAsc, SetupUpDown, TearDown); +createSortSuite('UpUp', 1000, SortAsc, SetupUpUp, TearDown); +createSortSuite('DownDown', 1000, SortAsc, SetupDownDown, TearDown); +createSortSuite('DownUp', 1000, SortAsc, SetupDownUp, TearDown); diff --git a/deps/v8/test/js-perf-test/ArraySort/sort.js b/deps/v8/test/js-perf-test/ArraySort/sort.js index f28e9720dc..cc77e5884d 100644 --- a/deps/v8/test/js-perf-test/ArraySort/sort.js +++ b/deps/v8/test/js-perf-test/ArraySort/sort.js @@ -4,12 +4,12 @@ load('sort-base.js'); -benchy('PackedSmi', Sort, CreatePackedSmiArray); -benchy('PackedDouble', Sort, CreatePackedDoubleArray); -benchy('PackedElement', Sort, CreatePackedObjectArray); +createSortSuite('PackedSmi', 1000, Sort, CreatePackedSmiArray); +createSortSuite('PackedDouble', 1000, Sort, CreatePackedDoubleArray); +createSortSuite('PackedElement', 1000, Sort, CreatePackedObjectArray); -benchy('HoleySmi', Sort, CreateHoleySmiArray); -benchy('HoleyDouble', Sort, CreateHoleyDoubleArray); -benchy('HoleyElement', Sort, CreateHoleyObjectArray); +createSortSuite('HoleySmi', 1000, Sort, CreateHoleySmiArray); +createSortSuite('HoleyDouble', 1000, Sort, CreateHoleyDoubleArray); +createSortSuite('HoleyElement', 1000, Sort, CreateHoleyObjectArray); -benchy('Dictionary', Sort, CreateDictionaryArray); +createSortSuite('Dictionary', 1000, Sort, CreateDictionaryArray); diff --git a/deps/v8/test/js-perf-test/DataView/dataviewtest.js b/deps/v8/test/js-perf-test/DataView/dataviewtest.js index b94d5744fe..e8de3a2a9b 100644 --- a/deps/v8/test/js-perf-test/DataView/dataviewtest.js +++ b/deps/v8/test/js-perf-test/DataView/dataviewtest.js @@ -10,6 +10,10 @@ new BenchmarkSuite('DataViewTest-DataView-LittleEndian', [1000], [ new Benchmark('DataViewTest-DataView-LittleEndian', false, false, 0, doTestDataViewLittleEndian), ]); +new BenchmarkSuite('DataViewTest-DataView-Floats', [1000], [ + new Benchmark('DataViewTest-DataView-Floats', false, false, 0, doTestDataViewFloats), +]); + new BenchmarkSuite('DataViewTest-TypedArray-BigEndian', [1000], [ new Benchmark('DataViewTest-TypedArray-BigEndian', false, false, 0, doTestTypedArrayBigEndian), ]); @@ -18,6 +22,10 @@ new BenchmarkSuite('DataViewTest-TypedArray-LittleEndian', [1000], [ new Benchmark('DataViewTest-TypedArray-LittleEndian', false, false, 0, doTestTypedArrayLittleEndian), ]); +new BenchmarkSuite('DataViewTest-TypedArray-Floats', [1000], [ + new Benchmark('DataViewTest-TypedArray-Floats', false, false, 0, doTestTypedArrayFloats), +]); + function doTestDataViewBigEndian() { doIterations(false, true); } @@ -34,6 +42,14 @@ function doTestTypedArrayLittleEndian() { doIterations(true, false); } +function doTestDataViewFloats() { + doFloatIterations(true); +} + +function doTestTypedArrayFloats() { + doFloatIterations(false); +} + function doIterations(littleEndian, dataView) { var buffer = makeBuffer(1000, littleEndian); var iterations = 10; @@ -91,6 +107,50 @@ function doOneIterationJS(buffer, littleEndian) { } } +function doFloatIterations(dataView) { + var buffer = makeFloatBuffer(1000); + var iterations = 10; + if (dataView) { + for (var i = 0; i < iterations; i++) + doOneFloatIterationDV(buffer); + } else { + for (var i = 0; i < iterations; i++) + doOneFloatIterationJS(buffer); + } +} + +function makeFloatBuffer(size) { + var buffer = new ArrayBuffer(size * 16); + var view = new DataView(buffer); + for (var i = 0; i < size; i++) { + view.setFloat64(i * 16, Math.log10(i + 1)); + view.setFloat32(i * 16 + 8, Math.sqrt(i)); + view.setFloat32(i * 16 + 12, Math.cos(i)); + } + return buffer; +} + +function doOneFloatIterationDV(buffer) { + var sum = 0; + var view = new DataView(buffer); + for (var i = 0; i < view.byteLength; i += 16) { + sum += view.getFloat64(i); + sum += view.getFloat32(i + 8); + sum += view.getFloat32(i + 12); + } +} + +function doOneFloatIterationJS(buffer) { + var sum = 0; + var float32array = new Float32Array(buffer); + var float64array = new Float64Array(buffer); + for (var i = 0; i < buffer.byteLength; i += 16) { + sum += float64array[i/8]; + sum += float32array[i/4 + 2]; + sum += float32array[i/4 + 3]; + } +} + function BigEndian(buffer, opt_byteOffset) { this.uint8View_ = new Uint8Array(buffer, opt_byteOffset || 0); this.int8View_ = new Int8Array(buffer, opt_byteOffset || 0); diff --git a/deps/v8/test/js-perf-test/Inspector/debugger.js b/deps/v8/test/js-perf-test/Inspector/debugger.js index c2ec6d993d..8e44aa7710 100644 --- a/deps/v8/test/js-perf-test/Inspector/debugger.js +++ b/deps/v8/test/js-perf-test/Inspector/debugger.js @@ -3,77 +3,73 @@ // found in the LICENSE file. (function() { - function benchy(name, test, testSetup) { - new BenchmarkSuite(name, [10000], [ - new Benchmark(name, false, false, 0, test, testSetup, TearDown) - ]); - } - benchy('Debugger.paused', DebuggerPaused, Setup); - benchy('Debugger.getPossibleBreakpoints', - DebuggerGetPossibleBreakpoints, - SetupGetPossibleBreakpoints); - benchy('AsyncStacksInstrumentation', - AsyncStacksInstrumentation, - SetupAsyncStacksInstrumentation); +createSuite('Debugger.paused', 10000, DebuggerPaused, Setup, TearDown); +createSuite( + 'Debugger.getPossibleBreakpoints', 10000, DebuggerGetPossibleBreakpoints, + SetupGetPossibleBreakpoints, TearDown); +createSuite( + 'AsyncStacksInstrumentation', 10000, AsyncStacksInstrumentation, + SetupAsyncStacksInstrumentation, TearDown); - function Setup() { - SendMessage('Debugger.enable'); - // Force lazy compilation of inspector related scripts. - SendMessage('Runtime.evaluate', {expression: ''}); - } +function Setup() { + SendMessage('Debugger.enable'); + // Force lazy compilation of inspector related scripts. + SendMessage('Runtime.evaluate', {expression: ''}); +} - function TearDown() { - SendMessage('Debugger.disable'); - } +function TearDown() { + SendMessage('Debugger.disable'); +} - function DebuggerPaused() { - for (var i = 0; i < 10; ++i) { - debugger; - } +function DebuggerPaused() { + for (var i = 0; i < 10; ++i) { + debugger; } +} - let scriptId; - function SetupGetPossibleBreakpoints() { - Setup(); - let expression = ''; - for (let i = 0; i < 20; ++i) { - expression += `function foo${i}(){ - if (a) { - return true; - } else { - return false; - } -}\n`; - } - listener = function(msg) { - if (msg.method === "Debugger.scriptParsed") { - scriptId = msg.params.scriptId; - listener = null; - } +let scriptId; +function SetupGetPossibleBreakpoints() { + Setup(); + let expression = ''; + for (let i = 0; i < 20; ++i) { + expression += `function foo${i}(){ + if (a) { + return true; + } else { + return false; + } + }\n`; + }; + listener = function(msg) { + if (msg.method === 'Debugger.scriptParsed') { + scriptId = msg.params.scriptId; + listener = null; } - SendMessage('Runtime.evaluate', {expression}); - } + }; + SendMessage('Runtime.evaluate', {expression}); +} - function DebuggerGetPossibleBreakpoints() { - SendMessage('Debugger.getPossibleBreakpoints', { - start: {lineNumber: 0, columnNumber: 0, scriptId: scriptId} - }); - } +function DebuggerGetPossibleBreakpoints() { + SendMessage( + 'Debugger.getPossibleBreakpoints', + {start: {lineNumber: 0, columnNumber: 0, scriptId: scriptId}}); +} - function SetupAsyncStacksInstrumentation() { - Setup(); - SendMessage('Debugger.setAsyncCallStackDepth', {maxDepth: 1024}); - } +function SetupAsyncStacksInstrumentation() { + Setup(); + SendMessage('Debugger.setAsyncCallStackDepth', {maxDepth: 1024}); +} - function AsyncStacksInstrumentation() { - var p = Promise.resolve(); - var nopCallback = () => undefined; - var done = false; - for (let i = 0; i < 1000; ++i) { - p = p.then(nopCallback); - } - p = p.then(() => done = true); - while (!done) %RunMicrotasks(); +function AsyncStacksInstrumentation() { + var p = Promise.resolve(); + var nopCallback = () => undefined; + var done = false; + for (let i = 0; i < 1000; ++i) { + p = p.then(nopCallback); } + p = p.then(() => done = true); + while (!done) %RunMicrotasks(); +} + })(); diff --git a/deps/v8/test/js-perf-test/JSTests.json b/deps/v8/test/js-perf-test/JSTests.json index 9c6c791b7f..ce7e102b62 100644 --- a/deps/v8/test/js-perf-test/JSTests.json +++ b/deps/v8/test/js-perf-test/JSTests.json @@ -488,8 +488,10 @@ "tests": [ {"name": "DataViewTest-DataView-BigEndian"}, {"name": "DataViewTest-DataView-LittleEndian"}, + {"name": "DataViewTest-DataView-Floats"}, {"name": "DataViewTest-TypedArray-BigEndian"}, - {"name": "DataViewTest-TypedArray-LittleEndian"} + {"name": "DataViewTest-TypedArray-LittleEndian"}, + {"name": "DataViewTest-TypedArray-Floats"} ] }, { @@ -614,7 +616,7 @@ "resources": [ "filter.js", "map.js", "every.js", "join.js", "some.js", "reduce.js", "reduce-right.js", "to-string.js", "find.js", - "find-index.js", "from.js", "of.js", "for-each.js" + "find-index.js", "from.js", "of.js", "for-each.js", "slice.js" ], "flags": [ "--allow-natives-syntax" @@ -699,7 +701,17 @@ {"name": "DoubleFrom"}, {"name": "StringFrom"}, {"name": "StringNoMapFrom"}, - {"name": "MixedFrom"} + {"name": "MixedFrom"}, + {"name": "Array.slice(500)"}, + {"name": "Array.slice(500,999)"}, + {"name": "Array.slice(-500)"}, + {"name": "Array.slice(200,700)"}, + {"name": "Array.slice(200,-300)"}, + {"name": "Array.slice(4,1)"}, + {"name": "Array.slice(500,999)-dict"}, + {"name": "Array.slice(200,700)-dict"}, + {"name": "Array.slice(200,-300)-dict"}, + {"name": "Array.slice(4,1)-dict"} ] }, { @@ -771,8 +783,18 @@ "--allow-natives-syntax" ], "tests": [ - {"name": "PackedSmiPreSorted"}, - {"name": "PackedSmiPreSortedReversed"} + {"name": "Random"}, + {"name": "Up"}, + {"name": "Down"}, + {"name": "Saw1000"}, + {"name": "Saw500"}, + {"name": "Saw200"}, + {"name": "Saw200Symmetric"}, + {"name": "Saw200Down"}, + {"name": "UpDown"}, + {"name": "UpUp"}, + {"name": "DownDown"}, + {"name": "DownUp"} ] }, { @@ -790,6 +812,29 @@ {"name": "MultipleCompareFns"} ] }, + { + "name": "ArraySortDifferentLengths", + "path": ["ArraySort"], + "main": "run.js", + "resources": ["sort-base.js", "sort-lengths.js"], + "test_flags": ["sort-lengths"], + "results_regexp": "^%s\\-ArraySort\\(Score\\): (.+)$", + "flags": [ + "--allow-natives-syntax" + ], + "tests": [ + {"name": "Random10"}, + {"name": "Sorted10"}, + {"name": "Random100"}, + {"name": "Sorted100"}, + {"name": "Random1000"}, + {"name": "Sorted1000"}, + {"name": "Random10000"}, + {"name": "Sorted10000"}, + {"name": "Random100000"}, + {"name": "Sorted100000"} + ] + }, { "name": "ForLoops", "path": ["ForLoops"], diff --git a/deps/v8/test/js-perf-test/RegExp.json b/deps/v8/test/js-perf-test/RegExp.json index 2e981f36fb..0db1f4e0be 100644 --- a/deps/v8/test/js-perf-test/RegExp.json +++ b/deps/v8/test/js-perf-test/RegExp.json @@ -26,6 +26,7 @@ "ctor.js", "exec.js", "flags.js", + "inline_test.js", "match.js", "replace.js", "search.js", diff --git a/deps/v8/test/js-perf-test/RegExp/RegExpTests.json b/deps/v8/test/js-perf-test/RegExp/RegExpTests.json index 88724e52e6..9d97875aa4 100644 --- a/deps/v8/test/js-perf-test/RegExp/RegExpTests.json +++ b/deps/v8/test/js-perf-test/RegExp/RegExpTests.json @@ -25,6 +25,7 @@ "ctor.js", "exec.js", "flags.js", + "inline_test.js", "match.js", "replace.js", "search.js", diff --git a/deps/v8/test/js-perf-test/RegExp/inline_test.js b/deps/v8/test/js-perf-test/RegExp/inline_test.js new file mode 100644 index 0000000000..09998ad4ac --- /dev/null +++ b/deps/v8/test/js-perf-test/RegExp/inline_test.js @@ -0,0 +1,17 @@ +// Copyright 2018 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 ConstTest() { + /[Cz]/.test("abCdefgzabCdefgzabCdefgzabCdefgzabCdefgzabCdefgzabCdefgzabCdefgz"); +} + +const cre = /[Cz]/; +function GlobalConstTest() { + cre.test("abCdefgzabCdefgzabCdefgzabCdefgzabCdefgzabCdefgzabCdefgzabCdefgz"); +} + +var benchmarks = [ [ConstTest, () => {}], + [GlobalConstTest, () => {}], + ]; +createBenchmarkSuite("InlineTest"); diff --git a/deps/v8/test/js-perf-test/RegExp/run.js b/deps/v8/test/js-perf-test/RegExp/run.js index 9d267c22e1..0d4097451f 100644 --- a/deps/v8/test/js-perf-test/RegExp/run.js +++ b/deps/v8/test/js-perf-test/RegExp/run.js @@ -8,6 +8,7 @@ load('../base.js'); load('ctor.js'); load('exec.js'); load('flags.js'); +load('inline_test.js') load('match.js'); load('replace.js'); load('search.js'); @@ -20,7 +21,6 @@ load('slow_replace.js'); load('slow_search.js'); load('slow_split.js'); load('slow_test.js'); -load('test_inl.js') var success = true; diff --git a/deps/v8/test/js-perf-test/RegExp/test_inl.js b/deps/v8/test/js-perf-test/RegExp/test_inl.js deleted file mode 100644 index 09998ad4ac..0000000000 --- a/deps/v8/test/js-perf-test/RegExp/test_inl.js +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2018 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 ConstTest() { - /[Cz]/.test("abCdefgzabCdefgzabCdefgzabCdefgzabCdefgzabCdefgzabCdefgzabCdefgz"); -} - -const cre = /[Cz]/; -function GlobalConstTest() { - cre.test("abCdefgzabCdefgzabCdefgzabCdefgzabCdefgzabCdefgzabCdefgzabCdefgz"); -} - -var benchmarks = [ [ConstTest, () => {}], - [GlobalConstTest, () => {}], - ]; -createBenchmarkSuite("InlineTest"); diff --git a/deps/v8/test/js-perf-test/Strings/run.js b/deps/v8/test/js-perf-test/Strings/run.js index 8f3f383240..b94f14fb06 100644 --- a/deps/v8/test/js-perf-test/Strings/run.js +++ b/deps/v8/test/js-perf-test/Strings/run.js @@ -18,7 +18,6 @@ function PrintError(name, error) { success = false; } - BenchmarkSuite.config.doWarmup = undefined; BenchmarkSuite.config.doDeterministic = undefined; diff --git a/deps/v8/test/js-perf-test/Strings/string-startsendswith-comp.js b/deps/v8/test/js-perf-test/Strings/string-startsendswith-comp.js index acf16c5811..71484d25b1 100644 --- a/deps/v8/test/js-perf-test/Strings/string-startsendswith-comp.js +++ b/deps/v8/test/js-perf-test/Strings/string-startsendswith-comp.js @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -function benchy(fn, name) { - new BenchmarkSuite(name, [1], [ +function createSuiteWithWarmup( name, count, fn) { + new BenchmarkSuite(name, [count], [ new Benchmark(name, true, false, 0, fn), ]); } @@ -41,7 +41,7 @@ function endsIndex(string) { return string[string.length - 1] === first; } -benchy(() => helper(startsWith), 'startsWith'); -benchy(() => helper(startsIndex), 'startsIndex'); -benchy(() => helper(endsWith), 'endsWith'); -benchy(() => helper(endsIndex), 'endsIndex'); +createSuiteWithWarmup('startsWith', 1, () => helper(startsWith)); +createSuiteWithWarmup('startsIndex', 1, () => helper(startsIndex)); +createSuiteWithWarmup('endsWith', 1, () => helper(endsWith)); +createSuiteWithWarmup('endsIndex', 1, () => helper(endsIndex)); diff --git a/deps/v8/test/js-perf-test/Strings/string-stringat-comp.js b/deps/v8/test/js-perf-test/Strings/string-stringat-comp.js index 37c5e1eabd..deb95e1ef8 100644 --- a/deps/v8/test/js-perf-test/Strings/string-stringat-comp.js +++ b/deps/v8/test/js-perf-test/Strings/string-stringat-comp.js @@ -2,12 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -function benchy(f, name) { - new BenchmarkSuite(name, [1], [ - new Benchmark(name, true, false, 0, f), - ]); -} - const input = 'äϠ�𝌆 Lorem ipsum test test'; function helper(fn) { @@ -42,9 +36,9 @@ function stringIndex(str, i) { return str[i] === 't'; } -benchy(() => helper(charCodeAt), "charCodeAt_const"); -benchy(() => helper(charCodeAtBoth), "charCodeAt_both"); -benchy(() => helper(charAt), "charAt_const"); -benchy(() => helper(charAtNever), "charAt_never"); -benchy(() => helper(charAtBoth), "charAt_both"); -benchy(() => helper(stringIndex), "stringIndex_const"); +createSuiteWithWarmup('charCodeAt_const', 1, () => helper(charCodeAt)); +createSuiteWithWarmup('charCodeAt_both', 1, () => helper(charCodeAtBoth)); +createSuiteWithWarmup('charAt_const', 1, () => helper(charAt)); +createSuiteWithWarmup('charAt_never', 1, () => helper(charAtNever)); +createSuiteWithWarmup('charAt_both', 1, () => helper(charAtBoth)); +createSuiteWithWarmup('stringIndex_const', 1, () => helper(stringIndex)); diff --git a/deps/v8/test/js-perf-test/Strings/string-substring.js b/deps/v8/test/js-perf-test/Strings/string-substring.js index 865c709bec..cde6fe6838 100644 --- a/deps/v8/test/js-perf-test/Strings/string-substring.js +++ b/deps/v8/test/js-perf-test/Strings/string-substring.js @@ -2,14 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -function benchy (f, name) { - new BenchmarkSuite(name, [5], [ - new Benchmark(name, true, false, 0, - f), - ]); -} - -const subjects = ['abcde', '123456', 'aqwsde', "nbvveqxu", "f03ks-120-3;jfkm;ajp3f", "sd-93u498thikefnow8y3-0rh1nalksfnwo8y3t19-3r8hoiefnw"]; +const subjects = [ + 'abcde', '123456', 'aqwsde', 'nbvveqxu', 'f03ks-120-3;jfkm;ajp3f', + 'sd-93u498thikefnow8y3-0rh1nalksfnwo8y3t19-3r8hoiefnw' +]; // Drop first element. @@ -23,7 +19,7 @@ function StringDropFirstSlice() { return sum; } -benchy(StringDropFirstSlice, "StringDropFirstSlice"); +createSuiteWithWarmup('StringDropFirstSlice', 5, StringDropFirstSlice); function StringDropFirstSubstr() { var sum = ""; @@ -35,7 +31,7 @@ function StringDropFirstSubstr() { return sum; } -benchy(StringDropFirstSubstr, "StringDropFirstSubstr"); +createSuiteWithWarmup('StringDropFirstSubstr', 5, StringDropFirstSubstr); function StringDropFirstSubstring() { var sum = ""; @@ -47,8 +43,7 @@ function StringDropFirstSubstring() { return sum; } -benchy(StringDropFirstSubstring, "StringDropFirstSubstring"); - +createSuiteWithWarmup('StringDropFirstSubstring', 5, StringDropFirstSubstring); // Take first element. @@ -62,7 +57,7 @@ function StringTakeFirstSlice() { return sum; } -benchy(StringTakeFirstSlice, "StringTakeFirstSlice"); +createSuiteWithWarmup('StringTakeFirstSlice', 5, StringTakeFirstSlice); function StringTakeFirstSubstr() { var sum = ""; @@ -74,7 +69,7 @@ function StringTakeFirstSubstr() { return sum; } -benchy(StringTakeFirstSubstr, "StringTakeFirstSubstr"); +createSuiteWithWarmup('StringTakeFirstSubstr', 5, StringTakeFirstSubstr); function StringTakeFirstSubstring() { var sum = ""; @@ -86,8 +81,7 @@ function StringTakeFirstSubstring() { return sum; } -benchy(StringTakeFirstSubstring, "StringTakeFirstSubstring"); - +createSuiteWithWarmup('StringTakeFirstSubstring', 5, StringTakeFirstSubstring); // Drop last element. @@ -101,7 +95,7 @@ function StringDropLastSlice() { return sum; } -benchy(StringDropLastSlice, "StringDropLastSlice"); +createSuiteWithWarmup('StringDropLastSlice', 5, StringDropLastSlice); function StringDropLastSubstr() { var sum = ""; @@ -113,7 +107,7 @@ function StringDropLastSubstr() { return sum; } -benchy(StringDropLastSubstr, "StringDropLastSubstr"); +createSuiteWithWarmup('StringDropLastSubstr', 5, StringDropLastSubstr); function StringDropLastSubstring() { var sum = ""; @@ -125,8 +119,7 @@ function StringDropLastSubstring() { return sum; } -benchy(StringDropLastSubstring, "StringDropLastSubstring"); - +createSuiteWithWarmup('StringDropLastSubstring', 5, StringDropLastSubstring); // Take last element. @@ -140,7 +133,7 @@ function StringTakeLastSlice() { return sum; } -benchy(StringTakeLastSlice, "StringTakeLastSlice"); +createSuiteWithWarmup('StringTakeLastSlice', 5, StringTakeLastSlice); function StringTakeLastSubstr() { var sum = ""; @@ -152,7 +145,7 @@ function StringTakeLastSubstr() { return sum; } -benchy(StringTakeLastSubstr, "StringTakeLastSubstr"); +createSuiteWithWarmup('StringTakeLastSubstr', 5, StringTakeLastSubstr); function StringTakeLastSubstring() { var sum = ""; @@ -164,8 +157,7 @@ function StringTakeLastSubstring() { return sum; } -benchy(StringTakeLastSubstring, "StringTakeLastSubstring"); - +createSuiteWithWarmup('StringTakeLastSubstring', 5, StringTakeLastSubstring); // Drop first and last. @@ -179,7 +171,7 @@ function StringDropFirstSlice() { return sum; } -benchy(StringDropFirstSlice, "StringDropFirstSlice"); +createSuiteWithWarmup('StringDropFirstSlice', 5, StringDropFirstSlice); function StringDropFirstSubstr() { var sum = ""; @@ -191,7 +183,7 @@ function StringDropFirstSubstr() { return sum; } -benchy(StringDropFirstSubstr, "StringDropFirstSubstr"); +createSuiteWithWarmup('StringDropFirstSubstr', 5, StringDropFirstSubstr); function StringDropFirstSubstring() { var sum = ""; @@ -203,4 +195,4 @@ function StringDropFirstSubstring() { return sum; } -benchy(StringDropFirstSubstring, "StringDropFirstSubstring"); +createSuiteWithWarmup('StringDropFirstSubstring', 5, StringDropFirstSubstring); diff --git a/deps/v8/test/js-perf-test/base.js b/deps/v8/test/js-perf-test/base.js index cef2867f2b..61089f039f 100644 --- a/deps/v8/test/js-perf-test/base.js +++ b/deps/v8/test/js-perf-test/base.js @@ -54,7 +54,6 @@ BenchmarkResult.prototype.valueOf = function() { return this.time; } - // Suites of benchmarks consist of a name and the set of benchmarks in // addition to the reference timing that the final score will be based // on. This way, all scores are relative to a reference run and higher @@ -66,6 +65,15 @@ function BenchmarkSuite(name, reference, benchmarks) { BenchmarkSuite.suites.push(this); } +function createSuite(name, reference, run, setup, tearDown) { + return new BenchmarkSuite(name, [reference], [ + new Benchmark(name, false, false, 0, run, setup, tearDown)]); +} + +function createSuiteWithWarmup(name, reference, run, setup, tearDown) { + return new BenchmarkSuite(name, [reference], [ + new Benchmark(name, true, false, 0, run, setup, tearDown)]); +} // Keep track of all declared benchmark suites. BenchmarkSuite.suites = []; -- cgit v1.2.3