Import Cobalt 20.master.0.234144
Includes the following patches:
https://cobalt-review.googlesource.com/c/cobalt/+/5590
by n1214.hwang@samsung.com
https://cobalt-review.googlesource.com/c/cobalt/+/5530
by errong.leng@samsung.com
https://cobalt-review.googlesource.com/c/cobalt/+/5570
by devin.cai@mediatek.com
diff --git a/src/v8/test/js-perf-test/Array/copy-within.js b/src/v8/test/js-perf-test/Array/copy-within.js
new file mode 100644
index 0000000..c3cf33b
--- /dev/null
+++ b/src/v8/test/js-perf-test/Array/copy-within.js
@@ -0,0 +1,43 @@
+// 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 kArraySize = 1000;
+const kQuarterSize = kArraySize / 4;
+
+let array = [];
+
+// Copy a quarter of the elements from the middle to the front.
+function CopyWithin() {
+ return new Function(
+ 'array.copyWithin(0, kQuarterSize * 2, kQuarterSize * 3);');
+}
+
+createSuite('SmiCopyWithin', 1000, CopyWithin, SmiCopyWithinSetup);
+createSuite('StringCopyWithin', 1000, CopyWithin, StringCopyWithinSetup);
+createSuite('SparseSmiCopyWithin', 1000, CopyWithin, SparseSmiCopyWithinSetup);
+createSuite(
+ 'SparseStringCopyWithin', 1000, CopyWithin, SparseStringCopyWithinSetup);
+
+function SmiCopyWithinSetup() {
+ array = [];
+ for (let i = 0; i < kArraySize; ++i) array[i] = i;
+}
+
+function StringCopyWithinSetup() {
+ array = [];
+ for (let i = 0; i < kArraySize; ++i) array[i] = `Item no. ${i}`;
+}
+
+function SparseSmiCopyWithinSetup() {
+ array = [];
+ for (let i = 0; i < kArraySize; i += 10) array[i] = i;
+}
+
+function SparseStringCopyWithinSetup() {
+ array = [];
+ for (let i = 0; i < kArraySize; i += 10) array[i] = `Item no. ${i}`;
+}
+
+})();
diff --git a/src/v8/test/js-perf-test/Array/every.js b/src/v8/test/js-perf-test/Array/every.js
index 5a29f44..6e94255 100644
--- a/src/v8/test/js-perf-test/Array/every.js
+++ b/src/v8/test/js-perf-test/Array/every.js
@@ -27,11 +27,11 @@
DefineHigherOrderTests([
// name, test function, setup function, user callback
- "DoubleEvery", mc("every"), DoubleSetup, v => v > 0.0,
- "SmiEvery", mc("every"), SmiSetup, v => v != 34343,
- "FastEvery", mc("every"), FastSetup, v => v !== 'hi',
- "OptFastEvery", OptFastEvery, FastSetup, v => true,
- "OptUnreliableEvery", OptUnreliableEvery, FastSetup, v => true
+ ['DoubleEvery', newClosure('every'), DoubleSetup, v => v > 0.0],
+ ['SmiEvery', newClosure('every'), SmiSetup, v => v != 34343],
+ ['FastEvery', newClosure('every'), FastSetup, v => v !== 'hi'],
+ ['OptFastEvery', OptFastEvery, FastSetup, v => true],
+ ['OptUnreliableEvery', OptUnreliableEvery, FastSetup, v => true]
]);
})();
diff --git a/src/v8/test/js-perf-test/Array/filter.js b/src/v8/test/js-perf-test/Array/filter.js
index e0d4327..4ceaf5c 100644
--- a/src/v8/test/js-perf-test/Array/filter.js
+++ b/src/v8/test/js-perf-test/Array/filter.js
@@ -54,13 +54,19 @@
DefineHigherOrderTests([
// name, test function, setup function, user callback
- "NaiveFilterReplacement", NaiveFilter, NaiveFilterSetup, v => true,
- "DoubleFilter", mc("filter"), DoubleSetup, v => Math.floor(v) % 2 === 0,
- "SmiFilter", mc("filter"), SmiSetup, v => v % 2 === 0,
- "FastFilter", mc("filter"), FastSetup, (_, i) => i % 2 === 0,
- "GenericFilter", mc("filter", true), ObjectSetup, (_, i) => i % 2 === 0,
- "OptFastFilter", OptFastFilter, FastSetup, undefined,
- "OptUnreliableFilter", OptUnreliableFilter, FastSetup, v => true
+ ['NaiveFilterReplacement', NaiveFilter, NaiveFilterSetup, v => true],
+ [
+ 'DoubleFilter', newClosure('filter'), DoubleSetup,
+ v => Math.floor(v) % 2 === 0
+ ],
+ ['SmiFilter', newClosure('filter'), SmiSetup, v => v % 2 === 0],
+ ['FastFilter', newClosure('filter'), FastSetup, (_, i) => i % 2 === 0],
+ [
+ 'GenericFilter', newClosure('filter', true), ObjectSetup,
+ (_, i) => i % 2 === 0
+ ],
+ ['OptFastFilter', OptFastFilter, FastSetup, undefined],
+ ['OptUnreliableFilter', OptUnreliableFilter, FastSetup, v => true]
]);
})();
diff --git a/src/v8/test/js-perf-test/Array/find-index.js b/src/v8/test/js-perf-test/Array/find-index.js
index 716aa71..1029b26 100644
--- a/src/v8/test/js-perf-test/Array/find-index.js
+++ b/src/v8/test/js-perf-test/Array/find-index.js
@@ -51,13 +51,22 @@
DefineHigherOrderTests([
// name, test function, setup function, user callback
- "NaiveFindIndexReplacement", Naive, NaiveSetup, v => v === max_index,
- "DoubleFindIndex", mc("findIndex"), DoubleSetup, v => v === max_index + 0.5,
- "SmiFindIndex", mc("findIndex"), SmiSetup, v => v === max_index,
- "FastFindIndex", mc("findIndex"), FastSetup, v => v === `value ${max_index}`,
- "GenericFindIndex", mc("findIndex", true), ObjectSetup, v => v === max_index,
- "OptFastFindIndex", OptFast, FastSetup, undefined,
- "OptUnreliableFindIndex", OptUnreliable, FastSetup, v => v === max_index
+ ['NaiveFindIndexReplacement', Naive, NaiveSetup, v => v === max_index],
+ [
+ 'DoubleFindIndex', newClosure('findIndex'), DoubleSetup,
+ v => v === max_index + 0.5
+ ],
+ ['SmiFindIndex', newClosure('findIndex'), SmiSetup, v => v === max_index],
+ [
+ 'FastFindIndex', newClosure('findIndex'), FastSetup,
+ v => v === `value ${max_index}`
+ ],
+ [
+ 'GenericFindIndex', newClosure('findIndex', true), ObjectSetup,
+ v => v === max_index
+ ],
+ ['OptFastFindIndex', OptFast, FastSetup, undefined],
+ ['OptUnreliableFindIndex', OptUnreliable, FastSetup, v => v === max_index]
]);
})();
diff --git a/src/v8/test/js-perf-test/Array/find.js b/src/v8/test/js-perf-test/Array/find.js
index 9b9a19f..580d646 100644
--- a/src/v8/test/js-perf-test/Array/find.js
+++ b/src/v8/test/js-perf-test/Array/find.js
@@ -51,13 +51,13 @@
DefineHigherOrderTests([
// name, test function, setup function, user callback
- "NaiveFindReplacement", Naive, NaiveSetup, v => v === max_index,
- "DoubleFind", mc("find"), DoubleSetup, v => v === max_index + 0.5,
- "SmiFind", mc("find"), SmiSetup, v => v === max_index,
- "FastFind", mc("find"), FastSetup, v => v === `value ${max_index}`,
- "GenericFind", mc("find", true), ObjectSetup, v => v === max_index,
- "OptFastFind", OptFast, FastSetup, undefined,
- "OptUnreliableFind", OptUnreliable, FastSetup, v => v === max_index
+ ['NaiveFindReplacement', Naive, NaiveSetup, v => v === max_index],
+ ['DoubleFind', newClosure('find'), DoubleSetup, v => v === max_index + 0.5],
+ ['SmiFind', newClosure('find'), SmiSetup, v => v === max_index],
+ ['FastFind', newClosure('find'), FastSetup, v => v === `value ${max_index}`],
+ ['GenericFind', newClosure('find', true), ObjectSetup, v => v === max_index],
+ ['OptFastFind', OptFast, FastSetup, undefined],
+ ['OptUnreliableFind', OptUnreliable, FastSetup, v => v === max_index]
]);
})();
diff --git a/src/v8/test/js-perf-test/Array/for-each.js b/src/v8/test/js-perf-test/Array/for-each.js
index 79d2798..c87d540 100644
--- a/src/v8/test/js-perf-test/Array/for-each.js
+++ b/src/v8/test/js-perf-test/Array/for-each.js
@@ -50,13 +50,25 @@
}
DefineHigherOrderTests([
- "NaiveForEachReplacement", Naive, NaiveSetup, v => v === max_index,
- "DoubleForEach", mc("forEach"), DoubleSetup, v => v === max_index + 0.5,
- "SmiForEach", mc("forEach"), SmiSetup, v => v === max_index,
- "FastForEach", mc("forEach"), FastSetup, v => v === `value ${max_index}`,
- "GenericForEach", mc("forEach", true), ObjectSetup, v => v === max_index,
- "OptFastForEach", OptFast, FastSetup, undefined,
- "OptUnreliableForEach", OptUnreliable, FastSetup, v => v === `value ${max_index}`
+ ['NaiveForEachReplacement', Naive, NaiveSetup, v => v === max_index],
+ [
+ 'DoubleForEach', newClosure('forEach'), DoubleSetup,
+ v => v === max_index + 0.5
+ ],
+ ['SmiForEach', newClosure('forEach'), SmiSetup, v => v === max_index],
+ [
+ 'FastForEach', newClosure('forEach'), FastSetup,
+ v => v === `value ${max_index}`
+ ],
+ [
+ 'GenericForEach', newClosure('forEach', true), ObjectSetup,
+ v => v === max_index
+ ],
+ ['OptFastForEach', OptFast, FastSetup, undefined],
+ [
+ 'OptUnreliableForEach', OptUnreliable, FastSetup,
+ v => v === `value ${max_index}`
+ ]
]);
})();
diff --git a/src/v8/test/js-perf-test/Array/from.js b/src/v8/test/js-perf-test/Array/from.js
new file mode 100644
index 0000000..d173c5a
--- /dev/null
+++ b/src/v8/test/js-perf-test/Array/from.js
@@ -0,0 +1,225 @@
+// 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.
+(() => {
+
+ createSuite('MixedFrom', 1000, MixedFrom, MixedFromSetup);
+ createSuite(
+ 'MixedCowNoMapFrom', 1000, MixedCowNoMapFrom, MixedCowNoMapFromSetup);
+ createSuite('MixedNonCowNoMapFrom', 1000, MixedNonCowNoMapFrom,
+ MixedNonCowNoMapFromSetup);
+ createSuite('SmiFrom', 1000, SmiFrom, SmiFromSetup);
+ createSuite('SmallSmiFrom', 1000, SmallSmiFrom, SmallSmiFromSetup);
+ createSuite('SmiCowNoMapFrom', 1000, SmiCowNoMapFrom, SmiCowNoMapFromSetup);
+ createSuite(
+ 'SmiNonCowNoMapFrom', 1000, SmiNonCowNoMapFrom, SmiNonCowNoMapFromSetup);
+ createSuite(
+ 'SmiNoIteratorFrom', 1000, SmiNoIteratorFrom, SmiNoIteratorFromSetup);
+ createSuite(
+ 'TransplantedFrom', 1000, TransplantedFrom, TransplantedFromSetup);
+ createSuite('DoubleFrom', 1000, DoubleFrom, DoubleFromSetup);
+ createSuite('DoubleNoMapFrom', 1000, DoubleNoMapFrom, DoubleNoMapFromSetup);
+ createSuite('StringFrom', 1000, StringFrom, StringFromSetup);
+ createSuite(
+ 'StringCowNoMapFrom', 1000, StringCowNoMapFrom, StringCowNoMapFromSetup);
+ createSuite('StringNonCowNoMapFrom', 1000, StringNonCowNoMapFrom,
+ StringNonCowNoMapFromSetup);
+
+ function ArrayLike() {}
+ ArrayLike.from = Array.from;
+
+ var arg
+ var result;
+ var func
+
+ // This creates a COW array of smis. COWness does not affect the performance
+ // of Array.from calls with a callback function.
+ var smi_array_Cow = [
+ 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,
+ ];
+
+ // This creates a non-COW array.
+ var smi_array = Array.from(smi_array_Cow);
+ smi_array[0] = 1;
+
+ // This creates an array of doubles. There is no COW array for doubles.
+ 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,
+ ];
+
+ // This creates a COW array of objects.
+ var string_array_Cow = [
+ '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',
+ ];
+
+ // This creates a non-COW array.
+ var string_array = Array.from(string_array_Cow);
+ string_array[0] = 'a';
+
+ // This creates a COW array of objects.
+ var mixed_array_Cow = [
+ 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',
+ ];
+
+ // This creates a non-COW array.
+ var mixed_array = Array.from(mixed_array_Cow);
+ mixed_array[0] = 1;
+
+ // Although these functions have the same code, they are separated for
+ // clean IC feedback.
+ function SmallSmiFrom() {
+ result = Array.from(arg, func);
+ }
+
+ function SmiCowNoMapFrom() {
+ result = Array.from(arg);
+ }
+
+ function SmiNonCowNoMapFrom() {
+ 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 DoubleNoMapFrom() {
+ result = Array.from(arg);
+ }
+
+ function StringFrom() {
+ result = Array.from(arg, func);
+ }
+
+ function StringCowNoMapFrom() {
+ result = Array.from(arg);
+ }
+
+ function StringNonCowNoMapFrom() {
+ result = Array.from(arg);
+ }
+
+ function MixedFrom() {
+ result = Array.from(arg, func);
+ }
+
+ function MixedCowNoMapFrom() {
+ result = Array.from(arg);
+ }
+
+ function MixedNonCowNoMapFrom() {
+ result = Array.from(arg);
+ }
+
+ function SmallSmiFromSetup() {
+ func = (v, i) => v + i;
+ arg = [1, 2, 3];
+ }
+
+ function SmiCowNoMapFromSetup() {
+ func = undefined;
+ arg = smi_array_Cow;
+ }
+
+ function SmiNonCowNoMapFromSetup() {
+ func = undefined;
+ arg = smi_array;
+ }
+
+ function SmiFromSetup() {
+ func = (v, i) => v + i;
+ arg = smi_array_Cow;
+ }
+
+ function SmiNoIteratorFromSetup() {
+ func = (v, i) => v + i;
+ array = smi_array_Cow;
+ arg = {length: array.length};
+ Object.assign(arg, array);
+ }
+
+ function TransplantedFromSetup() {
+ func = (v, i) => v + i;
+ arg = smi_array_Cow;
+ }
+
+ function DoubleFromSetup() {
+ func = (v, i) => v + i;
+ arg = double_array;
+ }
+
+ function DoubleNoMapFromSetup() {
+ func = undefined;
+ arg = double_array;
+ }
+
+ function StringFromSetup() {
+ func = (v, i) => v + i;
+ arg = string_array_Cow;
+ }
+
+ function StringCowNoMapFromSetup() {
+ func = undefined;
+ arg = string_array_Cow;
+ }
+
+ function StringNonCowNoMapFromSetup() {
+ func = undefined;
+ arg = string_array;
+ }
+
+ function MixedFromSetup() {
+ func = (v, i) => v + i;
+ arg = mixed_array_Cow;
+ }
+
+ function MixedCowNoMapFromSetup() {
+ func = undefined;
+ arg = mixed_array_Cow;
+ }
+
+ function MixedNonCowNoMapFromSetup() {
+ func = undefined;
+ arg = mixed_array;
+ }
+})();
diff --git a/src/v8/test/js-perf-test/Array/join.js b/src/v8/test/js-perf-test/Array/join.js
index ef9d298..c9928e7 100644
--- a/src/v8/test/js-perf-test/Array/join.js
+++ b/src/v8/test/js-perf-test/Array/join.js
@@ -11,10 +11,10 @@
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/src/v8/test/js-perf-test/Array/map.js b/src/v8/test/js-perf-test/Array/map.js
index 9179aa3..4b278b8 100644
--- a/src/v8/test/js-perf-test/Array/map.js
+++ b/src/v8/test/js-perf-test/Array/map.js
@@ -49,15 +49,15 @@
DefineHigherOrderTests([
// name, test function, setup function, user callback
- "NaiveMapReplacement", NaiveMap, NaiveMapSetup, v => v,
- "SmiMap", mc("map"), SmiSetup, v => v,
- "DoubleMap", mc("map"), DoubleSetup, v => v,
- "FastMap", mc("map"), FastSetup, v => v,
- "SmallSmiToDoubleMap", mc("map"), SmiSetup, v => v + 0.5,
- "SmallSmiToFastMap", mc("map"), SmiSetup, v => "hi" + v,
- "GenericMap", mc("map", true), ObjectSetup, v => v,
- "OptFastMap", OptFastMap, FastSetup, undefined,
- "OptUnreliableMap", OptUnreliableMap, FastSetup, v => v
+ ['NaiveMapReplacement', NaiveMap, NaiveMapSetup, v => v],
+ ['SmiMap', newClosure('map'), SmiSetup, v => v],
+ ['DoubleMap', newClosure('map'), DoubleSetup, v => v],
+ ['FastMap', newClosure('map'), FastSetup, v => v],
+ ['SmallSmiToDoubleMap', newClosure('map'), SmiSetup, v => v + 0.5],
+ ['SmallSmiToFastMap', newClosure('map'), SmiSetup, v => 'hi' + v],
+ ['GenericMap', newClosure('map', true), ObjectSetup, v => v],
+ ['OptFastMap', OptFastMap, FastSetup, undefined],
+ ['OptUnreliableMap', OptUnreliableMap, FastSetup, v => v]
]);
})();
diff --git a/src/v8/test/js-perf-test/Array/of.js b/src/v8/test/js-perf-test/Array/of.js
index bfd4712..f876ce6 100644
--- a/src/v8/test/js-perf-test/Array/of.js
+++ b/src/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);
+ 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;
+ 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;
+ 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 EmptyArrayOf() {
+ result = Array.of();
+ }
-function BaselineArray() {
- result = [arg1, arg2, arg3];
-}
+ function BaselineArray() {
+ result = [arg1, arg2, arg3];
+ }
-function SmallSmiArrayOf() {
- result = Array.of(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 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 SmallTransplantedArrayOf() {
+ result = ArrayLike.of(arg1, arg2, arg3);
+ }
-function SmallDoubleArrayOf() {
- result = Array.of(arg1, arg2, arg3);
-}
+ function SmallDoubleArrayOf() {
+ result = Array.of(arg1, arg2, arg3);
+ }
-function SmallStringArrayOf() {
- result = Array.of(arg1, arg2, arg3);
-}
+ function SmallStringArrayOf() {
+ result = Array.of(arg1, arg2, arg3);
+ }
-function SmallMixedArrayOf() {
- result = Array.of(arg1, arg2, arg3);
-}
+ function SmallMixedArrayOf() {
+ result = Array.of(arg1, arg2, arg3);
+ }
-function EmptyArrayOfSetup() {
-}
+ function EmptyArrayOfSetup() {}
-function BaselineArraySetup() {
- arg1 = 1;
- arg2 = 2;
- arg3 = 3;
-}
+ function BaselineArraySetup() {
+ arg1 = 1;
+ arg2 = 2;
+ arg3 = 3;
+ }
-function SmallSmiArrayOfSetup() {
- arg1 = 1;
- arg2 = 2;
- arg3 = 3;
-}
+ function SmallSmiArrayOfSetup() {
+ arg1 = 1;
+ arg2 = 2;
+ arg3 = 3;
+ }
-function SmallTransplantedArrayOfSetup() {
- 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 SmallDoubleArrayOfSetup() {
+ arg1 = 1.5;
+ arg2 = 2.5;
+ arg3 = 3.5;
+ }
-function SmallStringArrayOfSetup() {
- arg1 = "cat";
- arg2 = "dog";
- arg3 = "giraffe";
-}
+ function SmallStringArrayOfSetup() {
+ arg1 = 'cat';
+ arg2 = 'dog';
+ arg3 = 'giraffe';
+ }
-function SmallMixedArrayOfSetup() {
- arg1 = 1;
- arg2 = 2.5;
- 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;
-}
+ 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/src/v8/test/js-perf-test/Array/reduce-right.js b/src/v8/test/js-perf-test/Array/reduce-right.js
index ed00f5a..c643c2b 100644
--- a/src/v8/test/js-perf-test/Array/reduce-right.js
+++ b/src/v8/test/js-perf-test/Array/reduce-right.js
@@ -27,12 +27,22 @@
DefineHigherOrderTests([
// name, test function, setup function, user callback
- "DoubleReduceRight", mc("reduceRight"), DoubleSetup, (p, v, i, o) => p + v,
- "SmiReduceRight", mc("reduceRight"), SmiSetup, (p, v, i, a) => p + 1,
- "FastReduceRight", mc("reduceRight"), FastSetup, (p, v, i, a) => p + v,
- "OptFastReduceRight", OptFastReduceRight, FastSetup, undefined,
- "OptUnreliableReduceRight", OptUnreliableReduceRight, FastSetup,
- (p, v, i, a) => p + v
+ [
+ 'DoubleReduceRight', newClosure('reduceRight'), DoubleSetup,
+ (p, v, i, o) => p + v
+ ],
+ [
+ 'SmiReduceRight', newClosure('reduceRight'), SmiSetup, (p, v, i, a) => p + 1
+ ],
+ [
+ 'FastReduceRight', newClosure('reduceRight'), FastSetup,
+ (p, v, i, a) => p + v
+ ],
+ ['OptFastReduceRight', OptFastReduceRight, FastSetup, undefined],
+ [
+ 'OptUnreliableReduceRight', OptUnreliableReduceRight, FastSetup,
+ (p, v, i, a) => p + v
+ ]
]);
})();
diff --git a/src/v8/test/js-perf-test/Array/reduce.js b/src/v8/test/js-perf-test/Array/reduce.js
index 02d689f..3b07969 100644
--- a/src/v8/test/js-perf-test/Array/reduce.js
+++ b/src/v8/test/js-perf-test/Array/reduce.js
@@ -6,7 +6,7 @@
// Make sure we inline the callback, pick up all possible TurboFan
// optimizations.
function RunOptFastReduce(multiple) {
- // Use of variable multiple in the callback function forces
+ // Use of multiple variables in the callback function forces
// context creation without escape analysis.
//
// Also, the arrow function requires inlining based on
@@ -27,12 +27,13 @@
DefineHigherOrderTests([
// name, test function, setup function, user callback
- "DoubleReduce", mc("reduce"), DoubleSetup, (p, v, i, o) => p + v,
- "SmiReduce", mc("reduce"), SmiSetup, (p, v, i, a) => p + 1,
- "FastReduce", mc("reduce"), FastSetup, (p, v, i, a) => p + v,
- "OptFastReduce", OptFastReduce, FastSetup, undefined,
- "OptUnreliableReduce", OptUnreliableReduce, FastSetup,
- (p, v, i, a) => p = v
+ ['DoubleReduce', newClosure('reduce'), DoubleSetup, (p, v, i, o) => p + v],
+ ['SmiReduce', newClosure('reduce'), SmiSetup, (p, v, i, a) => p + 1],
+ ['FastReduce', newClosure('reduce'), FastSetup, (p, v, i, a) => p + v],
+ ['OptFastReduce', OptFastReduce, FastSetup, undefined],
+ [
+ 'OptUnreliableReduce', OptUnreliableReduce, FastSetup, (p, v, i, a) => p = v
+ ]
]);
})();
diff --git a/src/v8/test/js-perf-test/Array/run.js b/src/v8/test/js-perf-test/Array/run.js
index 15b4da9..e8b6ef0 100644
--- a/src/v8/test/js-perf-test/Array/run.js
+++ b/src/v8/test/js-perf-test/Array/run.js
@@ -13,10 +13,10 @@
const array_size = 100;
const max_index = array_size - 1;
-// mc stands for "Make Closure," it's a handy function to get a fresh
+// newClosure is a handy function to get a fresh
// closure unpolluted by IC feedback for a 2nd-order array builtin
// test.
-function mc(name, generic = false) {
+function newClosure(name, generic = false) {
if (generic) {
return new Function(
`result = Array.prototype.${name}.call(array, func, this_arg);`);
@@ -24,23 +24,55 @@
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 MakeHoley(array) {
+ for (let i =0; i < array.length; i+=2) {
+ delete array[i];
+ }
+ assert(%HasHoleyElements(array));
}
function SmiSetup() {
array = Array.from({ length: array_size }, (_, i) => i);
+ assert(%HasSmiElements(array));
+}
+
+function HoleySmiSetup() {
+ SmiSetup();
+ MakeHoley(array);
+ assert(%HasSmiElements(array));
}
function DoubleSetup() {
array = Array.from({ length: array_size }, (_, i) => i + 0.5);
+ assert(%HasDoubleElements(array));
+}
+
+function HoleyDoubleSetup() {
+ DoubleSetup();
+ MakeHoley(array);
+ assert(%HasDoubleElements(array));
}
function FastSetup() {
array = Array.from({ length: array_size }, (_, i) => `value ${i}`);
+ assert(%HasObjectElements(array));
+}
+
+function HoleyFastSetup() {
+ FastSetup();
+ MakeHoley(array);
+ assert(%HasObjectElements(array));
+}
+
+function DictionarySetup() {
+ array = [];
+ // Add a large index to force dictionary elements.
+ array[2**30] = 10;
+ // Spread out {array_size} elements.
+ for (var i = 0; i < array_size-1; i++) {
+ array[i*101] = i;
+ }
+ assert(%HasDictionaryElements(array));
}
function ObjectSetup() {
@@ -48,22 +80,32 @@
for (var i = 0; i < array_size; i++) {
array[i] = i;
}
+ assert(%HasObjectElements(array));
+ assert(%HasHoleyElements(array));
+}
+
+
+const ARRAY_SETUP = {
+ PACKED_SMI: SmiSetup,
+ HOLEY_SMI: HoleySmiSetup,
+ PACKED_DOUBLE: DoubleSetup,
+ HOLEY_DOUBLE: HoleyDoubleSetup,
+ PACKED: FastSetup,
+ HOLEY: HoleyFastSetup,
+ DICTIONARY: DictionarySetup,
}
function DefineHigherOrderTests(tests) {
let i = 0;
while (i < tests.length) {
- const name = tests[i++];
- const testFunc = tests[i++];
- const setupFunc = tests[i++];
- const callback = tests[i++];
+ const [name, testFunc, setupFunc, callback] = tests[i++];
let setupFuncWrapper = () => {
func = callback;
this_arg = undefined;
setupFunc();
};
- benchy(name, testFunc, setupFuncWrapper);
+ createSuite(name, 1000, testFunc, setupFuncWrapper);
}
}
@@ -77,11 +119,14 @@
load('reduce-right.js');
load('find.js');
load('find-index.js');
-load('of.js');
// Other Array builtins.
+load('from.js');
+load('of.js');
load('join.js');
load('to-string.js');
+load('slice.js');
+load('copy-within.js');
var success = true;
diff --git a/src/v8/test/js-perf-test/Array/slice.js b/src/v8/test/js-perf-test/Array/slice.js
new file mode 100644
index 0000000..5f72314
--- /dev/null
+++ b/src/v8/test/js-perf-test/Array/slice.js
@@ -0,0 +1,211 @@
+// 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 kArraySize = 1000;
+
+(() => {
+ const A = new Array(kArraySize);
+
+ for (let i = 0; i < A.length; i++) {
+ A[i] = i;
+ }
+
+ assert(%HasSmiElements(A), "A should have SMI elements for this test");
+
+ // Commonly used to copy.
+ function testArraySlice0() {
+ return A.slice(0);
+ }
+
+ 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(0)", 1, testArraySlice0);
+ 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);
+
+})();
+
+(() => {
+ const A = new Array(kArraySize);
+
+ 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 testArraySlice0() {
+ return A.slice(0);
+ }
+
+ 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(0)-dict", 1, testArraySlice0);
+ 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);
+
+})();
+
+(() => {
+ const A = new Array(kArraySize);
+
+ for (let i = 0; i < A.length; i++) {
+ A[i] = i + 0.5;
+ }
+
+ assert(%HasDoubleElements(A), "A should have double elements for this test");
+
+ function testArraySlice0() {
+ return A.slice(0);
+ }
+
+ 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(0)-double", 1, testArraySlice0);
+ createSuiteWithWarmup("Array.slice(500,999)-double", 1, testArraySlice500_999);
+ createSuiteWithWarmup("Array.slice(200,700)-double", 1, testArraySlice200_700);
+ createSuiteWithWarmup("Array.slice(200,-300)-double", 1, testArraySlice200_N300);
+ createSuiteWithWarmup("Array.slice(4,1)-double", 1, testArraySlice4_1);
+
+})();
+
+(() => {
+ const A = new Array(kArraySize);
+
+ for (let i = 0; i < A.length; i++) {
+ A[i] = new Object();
+ }
+
+ assert(%HasObjectElements(A), "A should have object elements for this test");
+
+ function testArraySlice0() {
+ return A.slice(0);
+ }
+
+ 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(0)-object", 1, testArraySlice0);
+ createSuiteWithWarmup("Array.slice(500,999)-object", 1, testArraySlice500_999);
+ createSuiteWithWarmup("Array.slice(200,700)-object", 1, testArraySlice200_700);
+ createSuiteWithWarmup("Array.slice(200,-300)-object", 1, testArraySlice200_N300);
+ createSuiteWithWarmup("Array.slice(4,1)-object", 1, testArraySlice4_1);
+
+})();
+
+(() => {
+ const A = new Array(kArraySize);
+
+ for (let i = 0; i < A.length; i++) {
+ A[i] = i;
+ }
+
+ assert(%HasSmiElements(A), "A should have SMI elements for this test");
+
+ let arguments_array;
+ function sloppy_aliased(a) {
+ arguments_array = arguments;
+ }
+ sloppy_aliased.apply(null, A);
+
+ assert(%HasSloppyArgumentsElements(arguments_array),
+ "arguments_array should have sloppy arguments elements for this test");
+
+ function testArraySlice0() {
+ return Array.prototype.slice.call(arguments_array, 0);
+ }
+
+ function testArraySlice500_999() {
+ return Array.prototype.slice.call(arguments_array, 500, 999);
+ }
+
+ function testArraySlice200_700() {
+ return Array.prototype.slice.call(arguments_array, 200, 700);
+ }
+
+ function testArraySlice200_N300() {
+ return Array.prototype.slice.call(arguments_array, 200, -300);
+ }
+
+ function testArraySlice4_1() {
+ return Array.prototype.slice.call(arguments_array, 200, -300);
+ }
+
+ createSuiteWithWarmup("Array.slice(0)-sloppy-args", 1, testArraySlice0);
+ createSuiteWithWarmup("Array.slice(500,999)-sloppy-args", 1, testArraySlice500_999);
+ createSuiteWithWarmup("Array.slice(200,700)-sloppy-args", 1, testArraySlice200_700);
+ createSuiteWithWarmup("Array.slice(200,-300)-sloppy-args", 1, testArraySlice200_N300);
+ createSuiteWithWarmup("Array.slice(4,1)-sloppy-args", 1, testArraySlice4_1);
+
+})();
diff --git a/src/v8/test/js-perf-test/Array/some.js b/src/v8/test/js-perf-test/Array/some.js
index ea820e9..d7d5efa 100644
--- a/src/v8/test/js-perf-test/Array/some.js
+++ b/src/v8/test/js-perf-test/Array/some.js
@@ -27,11 +27,11 @@
DefineHigherOrderTests([
// name, test function, setup function, user callback
- "DoubleSome", mc("some"), DoubleSetup, v => v < 0.0,
- "SmiSome", mc("some"), SmiSetup, v => v === 34343,
- "FastSome", mc("some"), FastSetup, v => v === 'hi',
- "OptFastSome", OptFastSome, FastSetup, undefined,
- "OptUnreliableSome", OptUnreliableSome, FastSetup, v => v === 'hi'
+ ['DoubleSome', newClosure('some'), DoubleSetup, v => v < 0.0],
+ ['SmiSome', newClosure('some'), SmiSetup, v => v === 34343],
+ ['FastSome', newClosure('some'), FastSetup, v => v === 'hi'],
+ ['OptFastSome', OptFastSome, FastSetup, undefined],
+ ['OptUnreliableSome', OptUnreliableSome, FastSetup, v => v === 'hi']
]);
})();
diff --git a/src/v8/test/js-perf-test/Array/to-string.js b/src/v8/test/js-perf-test/Array/to-string.js
index 1b6dd36..c97a8c1 100644
--- a/src/v8/test/js-perf-test/Array/to-string.js
+++ b/src/v8/test/js-perf-test/Array/to-string.js
@@ -7,10 +7,11 @@
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/src/v8/test/js-perf-test/ArrayInOperator/run.js b/src/v8/test/js-perf-test/ArrayInOperator/run.js
new file mode 100644
index 0000000..db63584
--- /dev/null
+++ b/src/v8/test/js-perf-test/ArrayInOperator/run.js
@@ -0,0 +1,245 @@
+// Copyright 2019 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.
+
+// Compare `in` operator on different types of arrays.
+
+const size = 1e5;
+let packed_smi = [];
+let packed_double = [];
+let packed_elements = [];
+let holey_smi = new Array(size);
+let holey_double = new Array(size);
+let holey_elements = new Array(size);
+let sparse_smi = new Array(size);
+let sparse_double = new Array(size);
+let sparse_elements = new Array(size);
+let typed_uint8 = new Uint8Array(size);
+let typed_int32 = new Int32Array(size);
+let typed_float = new Float64Array(size);
+
+for (let i = 0; i < size; ++i) {
+ packed_smi[i] = i;
+ packed_double[i] = i + 0.1;
+ packed_elements[i] = "" + i;
+ holey_smi[i] = i;
+ holey_double[i] = i + 0.1;
+ holey_elements[i] = "" + i;
+ typed_uint8[i] = i % 0x100;
+ typed_int32[i] = i;
+ typed_float[i] = i + 0.1;
+}
+
+let sparse = 0;
+for (let i = 0; i < size; i += 100) {
+ ++sparse;
+ sparse_smi[i] = i;
+ sparse_double[i] = i + 0.1;
+ sparse_elements[i] = "" + i;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: Packed SMI
+// ----------------------------------------------------------------------------
+
+function PackedSMI() {
+ let cnt = 0;
+ let ary = packed_smi;
+ for (let i = 0; i < ary.length; ++i) {
+ if (i in ary) ++cnt;
+ }
+
+ if (cnt != size) throw 666;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: Packed Double
+// ----------------------------------------------------------------------------
+
+function PackedDouble() {
+ let cnt = 0;
+ let ary = packed_double;
+ for (let i = 0; i < ary.length; ++i) {
+ if (i in ary) ++cnt;
+ }
+
+ if (cnt != size) throw 666;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: Packed Elements
+// ----------------------------------------------------------------------------
+
+function PackedElements() {
+ let cnt = 0;
+ let ary = packed_elements;
+ for (let i = 0; i < ary.length; ++i) {
+ if (i in ary) ++cnt;
+ }
+
+ if (cnt != size) throw 666;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: Holey SMI
+// ----------------------------------------------------------------------------
+
+function HoleySMI() {
+ let cnt = 0;
+ let ary = holey_smi;
+ for (let i = 0; i < ary.length; ++i) {
+ if (i in ary) ++cnt;
+ }
+
+ if (cnt != size) throw 666;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: Holey Double
+// ----------------------------------------------------------------------------
+
+function HoleyDouble() {
+ let cnt = 0;
+ let ary = holey_double;
+ for (let i = 0; i < ary.length; ++i) {
+ if (i in ary) ++cnt;
+ }
+
+ if (cnt != size) throw 666;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: Holey Elements
+// ----------------------------------------------------------------------------
+
+function HoleyElements() {
+ let cnt = 0;
+ let ary = holey_elements;
+ for (let i = 0; i < ary.length; ++i) {
+ if (i in ary) ++cnt;
+ }
+
+ if (cnt != size) throw 666;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: Sparse SMI
+// ----------------------------------------------------------------------------
+
+function SparseSMI() {
+ let cnt = 0;
+ let ary = sparse_smi;
+ for (let i = 0; i < ary.length; ++i) {
+ if (i in ary) ++cnt;
+ }
+
+ if (cnt != sparse) throw 666;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: Sparse Double
+// ----------------------------------------------------------------------------
+
+function SparseDouble() {
+ let cnt = 0;
+ let ary = sparse_double;
+ for (let i = 0; i < ary.length; ++i) {
+ if (i in ary) ++cnt;
+ }
+
+ if (cnt != sparse) throw 666;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: Sparse Elements
+// ----------------------------------------------------------------------------
+
+function SparseElements() {
+ let cnt = 0;
+ let ary = sparse_elements;
+ for (let i = 0; i < ary.length; ++i) {
+ if (i in ary) ++cnt;
+ }
+
+ if (cnt != sparse) throw 666;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: Typed Uint8
+// ----------------------------------------------------------------------------
+
+function TypedUint8() {
+ let cnt = 0;
+ let ary = typed_uint8;
+ for (let i = 0; i < ary.length; ++i) {
+ if (i in ary) ++cnt;
+ }
+
+ if (cnt != size) throw 666;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: Typed Int32
+// ----------------------------------------------------------------------------
+
+function TypedInt32() {
+ let cnt = 0;
+ let ary = typed_int32;
+ for (let i = 0; i < ary.length; ++i) {
+ if (i in ary) ++cnt;
+ }
+
+ if (cnt != size) throw 666;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: Typed Float64
+// ----------------------------------------------------------------------------
+
+function TypedFloat64() {
+ let cnt = 0;
+ let ary = typed_float;
+ for (let i = 0; i < ary.length; ++i) {
+ if (i in ary) ++cnt;
+ }
+
+ if (cnt != size) throw 666;
+}
+
+// ----------------------------------------------------------------------------
+// Setup and Run
+// ----------------------------------------------------------------------------
+
+load('../base.js');
+
+var success = true;
+
+function PrintResult(name, result) {
+ print(name + '-ArrayInOperator(Score): ' + result);
+}
+
+function PrintError(name, error) {
+ PrintResult('Error: ' + name, error);
+ success = false;
+}
+
+function CreateBenchmark(name, f) {
+ new BenchmarkSuite(name, [1000], [ new Benchmark(name, false, false, 5, f) ]);
+}
+
+CreateBenchmark('PackedSMI', PackedSMI);
+CreateBenchmark('PackedDouble', PackedDouble);
+CreateBenchmark('PackedElements', PackedElements);
+CreateBenchmark('HoleySMI', HoleySMI);
+CreateBenchmark('HoleyDouble', HoleyDouble);
+CreateBenchmark('HoleyElements', HoleyElements);
+CreateBenchmark('SparseSMI', SparseSMI);
+CreateBenchmark('SparseDouble', SparseDouble);
+CreateBenchmark('SparseElements', SparseElements);
+CreateBenchmark('TypedUint8', TypedUint8);
+CreateBenchmark('TypedInt32', TypedInt32);
+CreateBenchmark('TypedFloat64', TypedFloat64);
+
+BenchmarkSuite.config.doWarmup = true;
+BenchmarkSuite.config.doDeterministic = true;
+BenchmarkSuite.RunSuites({NotifyResult: PrintResult, NotifyError: PrintError});
diff --git a/src/v8/test/js-perf-test/ArrayIndexOfIncludesPolymorphic/indexof-includes-polymorphic.js b/src/v8/test/js-perf-test/ArrayIndexOfIncludesPolymorphic/indexof-includes-polymorphic.js
new file mode 100644
index 0000000..c79ba71
--- /dev/null
+++ b/src/v8/test/js-perf-test/ArrayIndexOfIncludesPolymorphic/indexof-includes-polymorphic.js
@@ -0,0 +1,41 @@
+// 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 benchy(fn, name) {
+ new BenchmarkSuite(name, [1], [
+ new Benchmark(name, true, false, 0, fn),
+ ]);
+}
+
+function forLoop(array, searchValue) {
+ for (let i = 0; i < array.length; ++i) {
+ if (array[i] === searchValue) return true;
+ }
+ return farraylse;
+}
+
+function indexOf(array, searchValue) {
+ return array.indexOf(searchValue) !== -1;
+}
+
+function includes(array, searchValue) {
+ return array.includes(searchValue);
+}
+
+const PACKED = [
+ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+];
+const HOLEY = new Array(PACKED.length);
+for (let i = 0; i < PACKED.length; ++i)
+ HOLEY[i] = PACKED[i];
+
+function helper(fn) {
+ const SEARCH_VALUE = 15;
+ const result = fn(PACKED, SEARCH_VALUE) && fn(HOLEY, SEARCH_VALUE);
+ return result;
+}
+
+benchy(() => helper(forLoop), 'for loop');
+benchy(() => helper(indexOf), 'Array#indexOf');
+benchy(() => helper(includes), 'Array#includes');
diff --git a/src/v8/test/js-perf-test/ArrayIndexOfIncludesPolymorphic/run.js b/src/v8/test/js-perf-test/ArrayIndexOfIncludesPolymorphic/run.js
new file mode 100644
index 0000000..3ad11b8
--- /dev/null
+++ b/src/v8/test/js-perf-test/ArrayIndexOfIncludesPolymorphic/run.js
@@ -0,0 +1,23 @@
+// 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('../base.js');
+load(arguments[0] + '.js')
+
+function PrintResult(name, result) {
+ print(name + '-ArrayIndexOfIncludesPolymorphic(Score): ' + result);
+}
+
+function PrintStep(name) {}
+
+function PrintError(name, error) {
+ PrintResult(name, error);
+}
+
+BenchmarkSuite.config.doWarmup = undefined;
+BenchmarkSuite.config.doDeterministic = undefined;
+
+BenchmarkSuite.RunSuites({ NotifyResult: PrintResult,
+ NotifyError: PrintError,
+ NotifyStep: PrintStep });
diff --git a/src/v8/test/js-perf-test/ArrayLiteralInitialSpreadLargeDoubleHoley/run.js b/src/v8/test/js-perf-test/ArrayLiteralInitialSpreadLargeDoubleHoley/run.js
new file mode 100644
index 0000000..72b83a3
--- /dev/null
+++ b/src/v8/test/js-perf-test/ArrayLiteralInitialSpreadLargeDoubleHoley/run.js
@@ -0,0 +1,158 @@
+// 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.
+
+// Comparing different copy schemes against spread initial literals.
+// Benchmarks for large holey double arrays.
+
+const largeHoleyArray = new Array(1e5);
+
+for (var i = 0; i < 100; i++) {
+ largeHoleyArray[i] = i + 6.66;
+}
+
+for (var i = 5000; i < 5500; i++) {
+ largeHoleyArray[i] = i + 6.66;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: Spread
+// ----------------------------------------------------------------------------
+
+function SpreadLargeHoley() {
+ var newArr = [...largeHoleyArray];
+ // basic sanity check
+ if (newArr.length != largeHoleyArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ForLength
+// ----------------------------------------------------------------------------
+
+function ForLengthLargeHoley() {
+ var newArr = new Array(largeHoleyArray.length);
+ for (let i = 0; i < largeHoleyArray.length; i++) {
+ newArr[i] = largeHoleyArray[i];
+ }
+ // basic sanity check
+ if (newArr.length != largeHoleyArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ForLengthEmpty
+// ----------------------------------------------------------------------------
+
+function ForLengthEmptyLargeHoley() {
+ var newArr = [];
+ for (let i = 0; i < largeHoleyArray.length; i++) {
+ newArr[i] = largeHoleyArray[i];
+ }
+ // basic sanity check
+ if (newArr.length != largeHoleyArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: Slice
+// ----------------------------------------------------------------------------
+
+function SliceLargeHoley() {
+ var newArr = largeHoleyArray.slice();
+ // basic sanity check
+ if (newArr.length != largeHoleyArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: Slice0
+// ----------------------------------------------------------------------------
+
+function Slice0LargeHoley() {
+ var newArr = largeHoleyArray.slice(0);
+ // basic sanity check
+ if (newArr.length != largeHoleyArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ConcatReceive
+// ----------------------------------------------------------------------------
+
+function ConcatReceiveLargeHoley() {
+ var newArr = largeHoleyArray.concat();
+ // basic sanity check
+ if (newArr.length != largeHoleyArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ConcatArg
+// ----------------------------------------------------------------------------
+
+function ConcatArgLargeHoley() {
+ var newArr = [].concat(largeHoleyArray);
+ // basic sanity check
+ if (newArr.length != largeHoleyArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ForOfPush
+// ----------------------------------------------------------------------------
+
+function ForOfPushLargeHoley() {
+ var newArr = [];
+ for (let x of largeHoleyArray) {
+ newArr.push(x)
+ }
+ // basic sanity check
+ if (newArr.length != largeHoleyArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: MapId
+// ----------------------------------------------------------------------------
+
+function MapIdLargeHoley() {
+ var newArr = largeHoleyArray.map(x => x);
+ // basic sanity check
+ if (newArr.length != largeHoleyArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Setup and Run
+// ----------------------------------------------------------------------------
+
+load('../base.js');
+
+var success = true;
+
+function PrintResult(name, result) {
+ print(name + '-ArrayLiteralInitialSpreadLargeDoubleHoley(Score): ' + result);
+}
+
+function PrintError(name, error) {
+ PrintResult('Error: ' + name, error);
+ success = false;
+}
+
+// Run the benchmark (5 x 100) iterations instead of 1 second.
+function CreateBenchmark(name, f) {
+ new BenchmarkSuite(name, [1000], [ new Benchmark(name, false, false, 5, f) ]);
+}
+
+CreateBenchmark('Spread', SpreadLargeHoley);
+CreateBenchmark('ForLength', ForLengthLargeHoley);
+CreateBenchmark('ForLengthEmpty', ForLengthEmptyLargeHoley);
+CreateBenchmark('Slice', SliceLargeHoley);
+CreateBenchmark('Slice0', Slice0LargeHoley);
+CreateBenchmark('ConcatReceive', ConcatReceiveLargeHoley);
+CreateBenchmark('ConcatArg', ConcatArgLargeHoley);
+
+BenchmarkSuite.config.doWarmup = true;
+BenchmarkSuite.config.doDeterministic = true;
+BenchmarkSuite.RunSuites({NotifyResult: PrintResult, NotifyError: PrintError});
diff --git a/src/v8/test/js-perf-test/ArrayLiteralInitialSpreadLargeDoublePacked/run.js b/src/v8/test/js-perf-test/ArrayLiteralInitialSpreadLargeDoublePacked/run.js
new file mode 100644
index 0000000..9b44984
--- /dev/null
+++ b/src/v8/test/js-perf-test/ArrayLiteralInitialSpreadLargeDoublePacked/run.js
@@ -0,0 +1,155 @@
+// 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.
+
+// Comparing different copy schemes against spread initial literals.
+// Benchmarks for large packed double arrays.
+
+var largeArray = Array.from(Array(1e5).keys());
+// TODO(dhai): we should be able to use Array.prototype.map here, but that
+// implementation is currently creating a HOLEY array.
+for (var i = 0; i < 1e5; i++) {
+ largeArray[i] += 6.66;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: Spread
+// ----------------------------------------------------------------------------
+
+function SpreadLarge() {
+ var newArr = [...largeArray];
+ // basic sanity check
+ if (newArr.length != largeArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ForLength
+// ----------------------------------------------------------------------------
+
+function ForLengthLarge() {
+ var newArr = new Array(largeArray.length);
+ for (let i = 0; i < largeArray.length; i++) {
+ newArr[i] = largeArray[i];
+ }
+ // basic sanity check
+ if (newArr.length != largeArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ForLengthEmpty
+// ----------------------------------------------------------------------------
+
+function ForLengthEmptyLarge() {
+ var newArr = [];
+ for (let i = 0; i < largeArray.length; i++) {
+ newArr[i] = largeArray[i];
+ }
+ // basic sanity check
+ if (newArr.length != largeArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: Slice
+// ----------------------------------------------------------------------------
+
+function SliceLarge() {
+ var newArr = largeArray.slice();
+ // basic sanity check
+ if (newArr.length != largeArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: Slice0
+// ----------------------------------------------------------------------------
+
+function Slice0Large() {
+ var newArr = largeArray.slice(0);
+ // basic sanity check
+ if (newArr.length != largeArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ConcatReceive
+// ----------------------------------------------------------------------------
+
+function ConcatReceiveLarge() {
+ var newArr = largeArray.concat();
+ // basic sanity check
+ if (newArr.length != largeArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ConcatArg
+// ----------------------------------------------------------------------------
+
+function ConcatArgLarge() {
+ var newArr = [].concat(largeArray);
+ // basic sanity check
+ if (newArr.length != largeArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ForOfPush
+// ----------------------------------------------------------------------------
+
+function ForOfPushLarge() {
+ var newArr = [];
+ for (let x of largeArray) {
+ newArr.push(x)
+ }
+ // basic sanity check
+ if (newArr.length != largeArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: MapId
+// ----------------------------------------------------------------------------
+
+function MapIdLarge() {
+ var newArr = largeArray.map(x => x);
+ // basic sanity check
+ if (newArr.length != largeArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Setup and Run
+// ----------------------------------------------------------------------------
+
+load('../base.js');
+
+var success = true;
+
+function PrintResult(name, result) {
+ print(name + '-ArrayLiteralInitialSpreadLargeDoublePacked(Score): ' + result);
+}
+
+function PrintError(name, error) {
+ PrintResult('Error: ' + name, error);
+ success = false;
+}
+
+// Run the benchmark (5 x 100) iterations instead of 1 second.
+function CreateBenchmark(name, f) {
+ new BenchmarkSuite(name, [1000], [ new Benchmark(name, false, false, 5, f) ]);
+}
+
+CreateBenchmark('Spread', SpreadLarge);
+CreateBenchmark('ForLength', ForLengthLarge);
+CreateBenchmark('ForLengthEmpty', ForLengthEmptyLarge);
+CreateBenchmark('Slice', SliceLarge);
+CreateBenchmark('Slice0', Slice0Large);
+CreateBenchmark('ConcatReceive', ConcatReceiveLarge);
+CreateBenchmark('ConcatArg', ConcatArgLarge);
+
+BenchmarkSuite.config.doWarmup = true;
+BenchmarkSuite.config.doDeterministic = true;
+BenchmarkSuite.RunSuites({NotifyResult: PrintResult, NotifyError: PrintError});
diff --git a/src/v8/test/js-perf-test/ArrayLiteralInitialSpreadLargeHoley/run.js b/src/v8/test/js-perf-test/ArrayLiteralInitialSpreadLargeHoley/run.js
new file mode 100644
index 0000000..2a4aff2
--- /dev/null
+++ b/src/v8/test/js-perf-test/ArrayLiteralInitialSpreadLargeHoley/run.js
@@ -0,0 +1,162 @@
+// 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.
+
+// Comparing different copy schemes against spread initial literals.
+// Benchmarks for large holey arrays.
+
+const largeHoleyArray = new Array(1e5);
+
+for (var i = 0; i < 100; i++) {
+ largeHoleyArray[i] = i;
+}
+
+for (var i = 5000; i < 5500; i++) {
+ largeHoleyArray[i] = i;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: Spread
+// ----------------------------------------------------------------------------
+
+function SpreadLargeHoley() {
+ var newArr = [...largeHoleyArray];
+ // basic sanity check
+ if (newArr.length != largeHoleyArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ForLength
+// ----------------------------------------------------------------------------
+
+function ForLengthLargeHoley() {
+ var newArr = new Array(largeHoleyArray.length);
+ for (let i = 0; i < largeHoleyArray.length; i++) {
+ newArr[i] = largeHoleyArray[i];
+ }
+ // basic sanity check
+ if (newArr.length != largeHoleyArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ForLengthEmpty
+// ----------------------------------------------------------------------------
+
+function ForLengthEmptyLargeHoley() {
+ var newArr = [];
+ for (let i = 0; i < largeHoleyArray.length; i++) {
+ newArr[i] = largeHoleyArray[i];
+ }
+ // basic sanity check
+ if (newArr.length != largeHoleyArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: Slice
+// ----------------------------------------------------------------------------
+
+function SliceLargeHoley() {
+ var newArr = largeHoleyArray.slice();
+ // basic sanity check
+ if (newArr.length != largeHoleyArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: Slice0
+// ----------------------------------------------------------------------------
+
+function Slice0LargeHoley() {
+ var newArr = largeHoleyArray.slice(0);
+ // basic sanity check
+ if (newArr.length != largeHoleyArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ConcatReceive
+// ----------------------------------------------------------------------------
+
+function ConcatReceiveLargeHoley() {
+ var newArr = largeHoleyArray.concat();
+ // basic sanity check
+ if (newArr.length != largeHoleyArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ConcatArg
+// ----------------------------------------------------------------------------
+
+function ConcatArgLargeHoley() {
+ var newArr = [].concat(largeHoleyArray);
+ // basic sanity check
+ if (newArr.length != largeHoleyArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ForOfPush
+// ----------------------------------------------------------------------------
+
+function ForOfPushLargeHoley() {
+ var newArr = [];
+ for (let x of largeHoleyArray) {
+ newArr.push(x)
+ }
+ // basic sanity check
+ if (newArr.length != largeHoleyArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: MapId
+// ----------------------------------------------------------------------------
+
+function MapIdLargeHoley() {
+ var newArr = largeHoleyArray.map(x => x);
+ // basic sanity check
+ if (newArr.length != largeHoleyArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Setup and Run
+// ----------------------------------------------------------------------------
+
+load('../base.js');
+
+var success = true;
+
+function PrintResult(name, result) {
+ print(name + '-ArrayLiteralInitialSpreadLargeHoley(Score): ' + result);
+}
+
+function PrintError(name, error) {
+ PrintResult('Error: ' + name, error);
+ success = false;
+}
+
+// Run the benchmark (5 x 100) iterations instead of 1 second.
+function CreateBenchmark(name, f) {
+ new BenchmarkSuite(name, [1000], [ new Benchmark(name, false, false, 5, f) ]);
+}
+
+CreateBenchmark('Spread', SpreadLargeHoley);
+CreateBenchmark('ForLength', ForLengthLargeHoley);
+CreateBenchmark('ForLengthEmpty', ForLengthEmptyLargeHoley);
+CreateBenchmark('Slice', SliceLargeHoley);
+CreateBenchmark('Slice0', Slice0LargeHoley);
+CreateBenchmark('ConcatReceive', ConcatReceiveLargeHoley);
+CreateBenchmark('ConcatArg', ConcatArgLargeHoley);
+// The following benchmarks are so slow that they will time out.
+// CreateBenchmark('ForOfPush', ForOfPushLargeHoley);
+// CreateBenchmark('MapId', MapIdLargeHoley);
+
+
+BenchmarkSuite.config.doWarmup = true;
+BenchmarkSuite.config.doDeterministic = true;
+BenchmarkSuite.RunSuites({NotifyResult: PrintResult, NotifyError: PrintError});
diff --git a/src/v8/test/js-perf-test/ArrayLiteralInitialSpreadLargePacked/run.js b/src/v8/test/js-perf-test/ArrayLiteralInitialSpreadLargePacked/run.js
new file mode 100644
index 0000000..dc27978
--- /dev/null
+++ b/src/v8/test/js-perf-test/ArrayLiteralInitialSpreadLargePacked/run.js
@@ -0,0 +1,153 @@
+// 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.
+
+// Comparing different copy schemes against spread initial literals.
+// Benchmarks for large packed arrays.
+
+const largeArray = Array.from(Array(1e5).keys());
+
+// ----------------------------------------------------------------------------
+// Benchmark: Spread
+// ----------------------------------------------------------------------------
+
+function SpreadLarge() {
+ var newArr = [...largeArray];
+ // basic sanity check
+ if (newArr.length != largeArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ForLength
+// ----------------------------------------------------------------------------
+
+function ForLengthLarge() {
+ var newArr = new Array(largeArray.length);
+ for (let i = 0; i < largeArray.length; i++) {
+ newArr[i] = largeArray[i];
+ }
+ // basic sanity check
+ if (newArr.length != largeArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ForLengthEmpty
+// ----------------------------------------------------------------------------
+
+function ForLengthEmptyLarge() {
+ var newArr = [];
+ for (let i = 0; i < largeArray.length; i++) {
+ newArr[i] = largeArray[i];
+ }
+ // basic sanity check
+ if (newArr.length != largeArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: Slice
+// ----------------------------------------------------------------------------
+
+function SliceLarge() {
+ var newArr = largeArray.slice();
+ // basic sanity check
+ if (newArr.length != largeArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: Slice0
+// ----------------------------------------------------------------------------
+
+function Slice0Large() {
+ var newArr = largeArray.slice(0);
+ // basic sanity check
+ if (newArr.length != largeArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ConcatReceive
+// ----------------------------------------------------------------------------
+
+function ConcatReceiveLarge() {
+ var newArr = largeArray.concat();
+ // basic sanity check
+ if (newArr.length != largeArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ConcatArg
+// ----------------------------------------------------------------------------
+
+function ConcatArgLarge() {
+ var newArr = [].concat(largeArray);
+ // basic sanity check
+ if (newArr.length != largeArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ForOfPush
+// ----------------------------------------------------------------------------
+
+function ForOfPushLarge() {
+ var newArr = [];
+ for (let x of largeArray) {
+ newArr.push(x)
+ }
+ // basic sanity check
+ if (newArr.length != largeArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: MapId
+// ----------------------------------------------------------------------------
+
+function MapIdLarge() {
+ var newArr = largeArray.map(x => x);
+ // basic sanity check
+ if (newArr.length != largeArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Setup and Run
+// ----------------------------------------------------------------------------
+
+load('../base.js');
+
+var success = true;
+
+function PrintResult(name, result) {
+ print(name + '-ArrayLiteralInitialSpreadLargePacked(Score): ' + result);
+}
+
+function PrintError(name, error) {
+ PrintResult('Error: ' + name, error);
+ success = false;
+}
+
+// Run the benchmark (5 x 100) iterations instead of 1 second.
+function CreateBenchmark(name, f) {
+ new BenchmarkSuite(name, [1000], [ new Benchmark(name, false, false, 5, f) ]);
+}
+
+CreateBenchmark('Spread', SpreadLarge);
+CreateBenchmark('ForLength', ForLengthLarge);
+CreateBenchmark('ForLengthEmpty', ForLengthEmptyLarge);
+CreateBenchmark('Slice', SliceLarge);
+CreateBenchmark('Slice0', Slice0Large);
+CreateBenchmark('ConcatReceive', ConcatReceiveLarge);
+CreateBenchmark('ConcatArg', ConcatArgLarge);
+// The following benchmarks are so slow that they will time out.
+// CreateBenchmark('ForOfPush', ForOfPushLarge);
+// CreateBenchmark('MapId', MapIdLarge);
+
+BenchmarkSuite.config.doWarmup = true;
+BenchmarkSuite.config.doDeterministic = true;
+BenchmarkSuite.RunSuites({NotifyResult: PrintResult, NotifyError: PrintError});
diff --git a/src/v8/test/js-perf-test/ArrayLiteralInitialSpreadLargeSmiMap/run.js b/src/v8/test/js-perf-test/ArrayLiteralInitialSpreadLargeSmiMap/run.js
new file mode 100644
index 0000000..2654d53
--- /dev/null
+++ b/src/v8/test/js-perf-test/ArrayLiteralInitialSpreadLargeSmiMap/run.js
@@ -0,0 +1,94 @@
+// 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.
+
+// Comparing different iterating schemes against spread initial literals.
+// Benchmarks for large smi maps.
+
+var keys = Array.from(Array(1e4).keys());
+var keyValuePairs = keys.map((value) => [value, value + 1]);
+var map = new Map(keyValuePairs);
+
+// ----------------------------------------------------------------------------
+// Benchmark: SpreadKeys
+// ----------------------------------------------------------------------------
+
+function SpreadKeys() {
+ var newArr = [...map.keys()];
+ // basic sanity check
+ if (newArr.length != map.size) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: SpreadValues
+// ----------------------------------------------------------------------------
+
+function SpreadValues() {
+ var newArr = [...map.values()];
+ // basic sanity check
+ if (newArr.length != map.size) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ForOfKeys
+// ----------------------------------------------------------------------------
+
+function ForOfKeys() {
+ var newArr = new Array(map.size);
+ var i = 0;
+ for (let x of map.keys()) {
+ newArr[i] = x;
+ i++;
+ }
+ if (newArr.length != map.size) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ForOfValues
+// ----------------------------------------------------------------------------
+
+function ForOfValues() {
+ var newArr = new Array(map.size);
+ var i = 0;
+ for (let x of map.values()) {
+ newArr[i] = x;
+ i++;
+ }
+ if (newArr.length != map.size) throw 666;
+ return newArr;
+}
+
+
+// ----------------------------------------------------------------------------
+// Setup and Run
+// ----------------------------------------------------------------------------
+
+load('../base.js');
+
+var success = true;
+
+function PrintResult(name, result) {
+ print(name + '-ArrayLiteralInitialSpreadLargeSmiMap(Score): ' + result);
+}
+
+function PrintError(name, error) {
+ PrintResult('Error: ' + name, error);
+ success = false;
+}
+
+function CreateBenchmark(name, f) {
+ new BenchmarkSuite(name, [1000], [ new Benchmark(name, false, false, 0, f) ]);
+}
+
+CreateBenchmark('ForOfKeys', ForOfKeys);
+CreateBenchmark('ForOfValues', ForOfValues);
+CreateBenchmark('SpreadKeys', SpreadKeys);
+CreateBenchmark('SpreadValues', SpreadValues);
+
+
+BenchmarkSuite.config.doWarmup = true;
+BenchmarkSuite.config.doDeterministic = false;
+BenchmarkSuite.RunSuites({NotifyResult: PrintResult, NotifyError: PrintError});
diff --git a/src/v8/test/js-perf-test/ArrayLiteralInitialSpreadLargeSmiSet/run.js b/src/v8/test/js-perf-test/ArrayLiteralInitialSpreadLargeSmiSet/run.js
new file mode 100644
index 0000000..30a4a16
--- /dev/null
+++ b/src/v8/test/js-perf-test/ArrayLiteralInitialSpreadLargeSmiSet/run.js
@@ -0,0 +1,121 @@
+// 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.
+
+// Comparing different iterating schemes against spread initial literals.
+// Benchmarks for large smi sets.
+
+var keys = Array.from(Array(1e4).keys());
+var set = new Set(keys);
+
+// ----------------------------------------------------------------------------
+// Benchmark: Spread
+// ----------------------------------------------------------------------------
+
+function Spread() {
+ var newArr = [...set];
+ // basic sanity check
+ if (newArr.length != set.size) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: SpreadKeys
+// ----------------------------------------------------------------------------
+
+function SpreadKeys() {
+ var newArr = [...set.keys()];
+ // basic sanity check
+ if (newArr.length != set.size) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: SpreadValues
+// ----------------------------------------------------------------------------
+
+function SpreadValues() {
+ var newArr = [...set.values()];
+ // basic sanity check
+ if (newArr.length != set.size) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ForOf
+// ----------------------------------------------------------------------------
+
+function ForOf() {
+ var newArr = new Array(set.size);
+ var i = 0;
+ for (let x of set) {
+ newArr[i] = x;
+ i++;
+ }
+ if (newArr.length != set.size) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ForOfKeys
+// ----------------------------------------------------------------------------
+
+function ForOfKeys() {
+ var newArr = new Array(set.size);
+ var i = 0;
+ for (let x of set.keys()) {
+ newArr[i] = x;
+ i++;
+ }
+ if (newArr.length != set.size) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ForOfValues
+// ----------------------------------------------------------------------------
+
+function ForOfValues() {
+ var newArr = new Array(set.size);
+ var i = 0;
+ for (let kv of set.values()) {
+ newArr[i] = kv;
+ i++;
+ }
+ if (newArr.length != set.size) throw 666;
+ return newArr;
+}
+
+
+// ----------------------------------------------------------------------------
+// Setup and Run
+// ----------------------------------------------------------------------------
+
+load('../base.js');
+
+var success = true;
+
+function PrintResult(name, result) {
+ print(name + '-ArrayLiteralInitialSpreadLargeSmiSet(Score): ' + result);
+}
+
+function PrintError(name, error) {
+ PrintResult('Error: ' + name, error);
+ success = false;
+}
+
+function CreateBenchmark(name, f) {
+ new BenchmarkSuite(name, [1000], [ new Benchmark(name, false, false, 0, f) ]);
+}
+
+CreateBenchmark('ForOf', ForOf);
+CreateBenchmark('ForOfKeys', ForOfKeys);
+CreateBenchmark('ForOfValues', ForOfValues);
+CreateBenchmark('Spread', Spread);
+CreateBenchmark('SpreadKeys', SpreadKeys);
+CreateBenchmark('SpreadValues', SpreadValues);
+
+
+BenchmarkSuite.config.doWarmup = true;
+BenchmarkSuite.config.doDeterministic = false;
+BenchmarkSuite.RunSuites({NotifyResult: PrintResult, NotifyError: PrintError});
diff --git a/src/v8/test/js-perf-test/ArrayLiteralInitialSpreadSmallDoubleHoley/run.js b/src/v8/test/js-perf-test/ArrayLiteralInitialSpreadSmallDoubleHoley/run.js
new file mode 100644
index 0000000..19768b7
--- /dev/null
+++ b/src/v8/test/js-perf-test/ArrayLiteralInitialSpreadSmallDoubleHoley/run.js
@@ -0,0 +1,159 @@
+// 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.
+
+// Comparing different copy schemes against spread initial literals.
+// Benchmarks for small holey double arrays.
+
+const smallHoleyArray = Array(100);
+
+for (var i = 0; i < 10; i++) {
+ smallHoleyArray[i] = i + 6.66;
+}
+for (var i = 90; i < 99; i++) {
+ smallHoleyArray[i] = i + 6.66;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: Spread
+// ----------------------------------------------------------------------------
+
+function SpreadSmallHoley() {
+ var newArr = [...smallHoleyArray];
+ // basic sanity check
+ if (newArr.length != smallHoleyArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ForLength
+// ----------------------------------------------------------------------------
+
+function ForLengthSmallHoley() {
+ var newArr = new Array(smallHoleyArray.length);
+ for (let i = 0; i < smallHoleyArray.length; i++) {
+ newArr[i] = smallHoleyArray[i];
+ }
+ // basic sanity check
+ if (newArr.length != smallHoleyArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ForLengthEmpty
+// ----------------------------------------------------------------------------
+
+function ForLengthEmptySmallHoley() {
+ var newArr = [];
+ for (let i = 0; i < smallHoleyArray.length; i++) {
+ newArr[i] = smallHoleyArray[i];
+ }
+ // basic sanity check
+ if (newArr.length != smallHoleyArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: Slice
+// ----------------------------------------------------------------------------
+
+function SliceSmallHoley() {
+ var newArr = smallHoleyArray.slice();
+ // basic sanity check
+ if (newArr.length != smallHoleyArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: Slice0
+// ----------------------------------------------------------------------------
+
+function Slice0SmallHoley() {
+ var newArr = smallHoleyArray.slice(0);
+ // basic sanity check
+ if (newArr.length != smallHoleyArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ConcatReceive
+// ----------------------------------------------------------------------------
+
+function ConcatReceiveSmallHoley() {
+ var newArr = smallHoleyArray.concat();
+ // basic sanity check
+ if (newArr.length != smallHoleyArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ConcatArg
+// ----------------------------------------------------------------------------
+
+function ConcatArgSmallHoley() {
+ var newArr = [].concat(smallHoleyArray);
+ // basic sanity check
+ if (newArr.length != smallHoleyArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ForOfPush
+// ----------------------------------------------------------------------------
+
+function ForOfPushSmallHoley() {
+ var newArr = [];
+ for (let x of smallHoleyArray) {
+ newArr.push(x)
+ }
+ // basic sanity check
+ if (newArr.length != smallHoleyArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: MapId
+// ----------------------------------------------------------------------------
+
+function MapIdSmallHoley() {
+ var newArr = smallHoleyArray.map(x => x);
+ // basic sanity check
+ if (newArr.length != smallHoleyArray.length) throw 666;
+ return newArr;
+}
+
+
+// ----------------------------------------------------------------------------
+// Setup and Run
+// ----------------------------------------------------------------------------
+
+load('../base.js');
+
+var success = true;
+
+function PrintResult(name, result) {
+ print(name + '-ArrayLiteralInitialSpreadSmallDoubleHoley(Score): ' + result);
+}
+
+function PrintError(name, error) {
+ PrintResult('Error: ' + name, error);
+ success = false;
+}
+
+function CreateBenchmark(name, f) {
+ new BenchmarkSuite(name, [1000], [ new Benchmark(name, false, false, 0, f) ]);
+}
+
+CreateBenchmark('Spread', SpreadSmallHoley);
+CreateBenchmark('ForLength', ForLengthSmallHoley);
+CreateBenchmark('ForLengthEmpty', ForLengthEmptySmallHoley);
+CreateBenchmark('Slice', SliceSmallHoley);
+CreateBenchmark('Slice0', Slice0SmallHoley);
+CreateBenchmark('ConcatReceive', ConcatReceiveSmallHoley);
+CreateBenchmark('ConcatArg', ConcatArgSmallHoley);
+CreateBenchmark('ForOfPush', ForOfPushSmallHoley);
+CreateBenchmark('MapId', MapIdSmallHoley);
+
+BenchmarkSuite.config.doWarmup = true;
+BenchmarkSuite.config.doDeterministic = false;
+BenchmarkSuite.RunSuites({NotifyResult: PrintResult, NotifyError: PrintError});
diff --git a/src/v8/test/js-perf-test/ArrayLiteralInitialSpreadSmallDoublePacked/run.js b/src/v8/test/js-perf-test/ArrayLiteralInitialSpreadSmallDoublePacked/run.js
new file mode 100644
index 0000000..88d382c
--- /dev/null
+++ b/src/v8/test/js-perf-test/ArrayLiteralInitialSpreadSmallDoublePacked/run.js
@@ -0,0 +1,158 @@
+// 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.
+
+// Comparing different copy schemes against spread initial literals.
+// Benchmarks for small packed double arrays.
+
+var smallArray = Array.from(Array(100).keys());
+
+for (var i = 0; i < 100; i++) {
+ smallArray[i] += 6.66;
+}
+
+
+// ----------------------------------------------------------------------------
+// Benchmark: Spread
+// ----------------------------------------------------------------------------
+
+function SpreadSmall() {
+ var newArr = [...smallArray];
+ // basic sanity check
+ if (newArr.length != smallArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ForLength
+// ----------------------------------------------------------------------------
+
+function ForLengthSmall() {
+ var newArr = new Array(smallArray.length);
+ for (let i = 0; i < smallArray.length; i++) {
+ newArr[i] = smallArray[i];
+ }
+ // basic sanity check
+ if (newArr.length != smallArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ForLengthEmpty
+// ----------------------------------------------------------------------------
+
+function ForLengthEmptySmall() {
+ var newArr = [];
+ for (let i = 0; i < smallArray.length; i++) {
+ newArr[i] = smallArray[i];
+ }
+ // basic sanity check
+ if (newArr.length != smallArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: Slice
+// ----------------------------------------------------------------------------
+
+function SliceSmall() {
+ var newArr = smallArray.slice();
+ // basic sanity check
+ if (newArr.length != smallArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: Slice0
+// ----------------------------------------------------------------------------
+
+function Slice0Small() {
+ var newArr = smallArray.slice(0);
+ // basic sanity check
+ if (newArr.length != smallArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ConcatReceive
+// ----------------------------------------------------------------------------
+
+function ConcatReceiveSmall() {
+ var newArr = smallArray.concat();
+ // basic sanity check
+ if (newArr.length != smallArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ConcatArg
+// ----------------------------------------------------------------------------
+
+function ConcatArgSmall() {
+ var newArr = [].concat(smallArray);
+ // basic sanity check
+ if (newArr.length != smallArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ForOfPush
+// ----------------------------------------------------------------------------
+
+function ForOfPushSmall() {
+ var newArr = [];
+ for (let x of smallArray) {
+ newArr.push(x)
+ }
+ // basic sanity check
+ if (newArr.length != smallArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: MapId
+// ----------------------------------------------------------------------------
+
+function MapIdSmall() {
+ var newArr = smallArray.map(x => x);
+ // basic sanity check
+ if (newArr.length != smallArray.length) throw 666;
+ return newArr;
+}
+
+
+// ----------------------------------------------------------------------------
+// Setup and Run
+// ----------------------------------------------------------------------------
+
+load('../base.js');
+
+var success = true;
+
+function PrintResult(name, result) {
+ print(name + '-ArrayLiteralInitialSpreadSmallDoublePacked(Score): ' + result);
+}
+
+function PrintError(name, error) {
+ PrintResult('Error: ' + name, error);
+ success = false;
+}
+
+function CreateBenchmark(name, f) {
+ new BenchmarkSuite(name, [1000], [ new Benchmark(name, false, false, 0, f) ]);
+}
+
+CreateBenchmark('Spread', SpreadSmall);
+CreateBenchmark('ForLength', ForLengthSmall);
+CreateBenchmark('ForLengthEmpty', ForLengthEmptySmall);
+CreateBenchmark('Slice', SliceSmall);
+CreateBenchmark('Slice0', Slice0Small);
+CreateBenchmark('ConcatReceive', ConcatReceiveSmall);
+CreateBenchmark('ConcatArg', ConcatArgSmall);
+CreateBenchmark('ForOfPush', ForOfPushSmall);
+CreateBenchmark('MapId', MapIdSmall);
+
+
+BenchmarkSuite.config.doWarmup = true;
+BenchmarkSuite.config.doDeterministic = false;
+BenchmarkSuite.RunSuites({NotifyResult: PrintResult, NotifyError: PrintError});
diff --git a/src/v8/test/js-perf-test/ArrayLiteralInitialSpreadSmallHoley/run.js b/src/v8/test/js-perf-test/ArrayLiteralInitialSpreadSmallHoley/run.js
new file mode 100644
index 0000000..9e7aea2
--- /dev/null
+++ b/src/v8/test/js-perf-test/ArrayLiteralInitialSpreadSmallHoley/run.js
@@ -0,0 +1,159 @@
+// 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.
+
+// Comparing different copy schemes against spread initial literals.
+// Benchmarks for small holey arrays.
+
+const smallHoleyArray = Array(100);
+
+for (var i = 0; i < 10; i++) {
+ smallHoleyArray[i] = i;
+}
+for (var i = 90; i < 99; i++) {
+ smallHoleyArray[i] = i;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: Spread
+// ----------------------------------------------------------------------------
+
+function SpreadSmallHoley() {
+ var newArr = [...smallHoleyArray];
+ // basic sanity check
+ if (newArr.length != smallHoleyArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ForLength
+// ----------------------------------------------------------------------------
+
+function ForLengthSmallHoley() {
+ var newArr = new Array(smallHoleyArray.length);
+ for (let i = 0; i < smallHoleyArray.length; i++) {
+ newArr[i] = smallHoleyArray[i];
+ }
+ // basic sanity check
+ if (newArr.length != smallHoleyArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ForLengthEmpty
+// ----------------------------------------------------------------------------
+
+function ForLengthEmptySmallHoley() {
+ var newArr = [];
+ for (let i = 0; i < smallHoleyArray.length; i++) {
+ newArr[i] = smallHoleyArray[i];
+ }
+ // basic sanity check
+ if (newArr.length != smallHoleyArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: Slice
+// ----------------------------------------------------------------------------
+
+function SliceSmallHoley() {
+ var newArr = smallHoleyArray.slice();
+ // basic sanity check
+ if (newArr.length != smallHoleyArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: Slice0
+// ----------------------------------------------------------------------------
+
+function Slice0SmallHoley() {
+ var newArr = smallHoleyArray.slice(0);
+ // basic sanity check
+ if (newArr.length != smallHoleyArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ConcatReceive
+// ----------------------------------------------------------------------------
+
+function ConcatReceiveSmallHoley() {
+ var newArr = smallHoleyArray.concat();
+ // basic sanity check
+ if (newArr.length != smallHoleyArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ConcatArg
+// ----------------------------------------------------------------------------
+
+function ConcatArgSmallHoley() {
+ var newArr = [].concat(smallHoleyArray);
+ // basic sanity check
+ if (newArr.length != smallHoleyArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ForOfPush
+// ----------------------------------------------------------------------------
+
+function ForOfPushSmallHoley() {
+ var newArr = [];
+ for (let x of smallHoleyArray) {
+ newArr.push(x)
+ }
+ // basic sanity check
+ if (newArr.length != smallHoleyArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: MapId
+// ----------------------------------------------------------------------------
+
+function MapIdSmallHoley() {
+ var newArr = smallHoleyArray.map(x => x);
+ // basic sanity check
+ if (newArr.length != smallHoleyArray.length) throw 666;
+ return newArr;
+}
+
+
+// ----------------------------------------------------------------------------
+// Setup and Run
+// ----------------------------------------------------------------------------
+
+load('../base.js');
+
+var success = true;
+
+function PrintResult(name, result) {
+ print(name + '-ArrayLiteralInitialSpreadSmallHoley(Score): ' + result);
+}
+
+function PrintError(name, error) {
+ PrintResult('Error: ' + name, error);
+ success = false;
+}
+
+function CreateBenchmark(name, f) {
+ new BenchmarkSuite(name, [1000], [ new Benchmark(name, false, false, 0, f) ]);
+}
+
+CreateBenchmark('Spread', SpreadSmallHoley);
+CreateBenchmark('ForLength', ForLengthSmallHoley);
+CreateBenchmark('ForLengthEmpty', ForLengthEmptySmallHoley);
+CreateBenchmark('Slice', SliceSmallHoley);
+CreateBenchmark('Slice0', Slice0SmallHoley);
+CreateBenchmark('ConcatReceive', ConcatReceiveSmallHoley);
+CreateBenchmark('ConcatArg', ConcatArgSmallHoley);
+CreateBenchmark('ForOfPush', ForOfPushSmallHoley);
+CreateBenchmark('MapId', MapIdSmallHoley);
+
+BenchmarkSuite.config.doWarmup = true;
+BenchmarkSuite.config.doDeterministic = false;
+BenchmarkSuite.RunSuites({NotifyResult: PrintResult, NotifyError: PrintError});
diff --git a/src/v8/test/js-perf-test/ArrayLiteralInitialSpreadSmallPacked/run.js b/src/v8/test/js-perf-test/ArrayLiteralInitialSpreadSmallPacked/run.js
new file mode 100644
index 0000000..9d29fa4
--- /dev/null
+++ b/src/v8/test/js-perf-test/ArrayLiteralInitialSpreadSmallPacked/run.js
@@ -0,0 +1,154 @@
+// 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.
+
+// Comparing different copy schemes against spread initial literals.
+// Benchmarks for small packed arrays.
+
+const smallHoleyArray = Array(100);
+const smallArray = Array.from(Array(100).keys());
+
+// ----------------------------------------------------------------------------
+// Benchmark: Spread
+// ----------------------------------------------------------------------------
+
+function SpreadSmall() {
+ var newArr = [...smallArray];
+ // basic sanity check
+ if (newArr.length != smallArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ForLength
+// ----------------------------------------------------------------------------
+
+function ForLengthSmall() {
+ var newArr = new Array(smallArray.length);
+ for (let i = 0; i < smallArray.length; i++) {
+ newArr[i] = smallArray[i];
+ }
+ // basic sanity check
+ if (newArr.length != smallArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ForLengthEmpty
+// ----------------------------------------------------------------------------
+
+function ForLengthEmptySmall() {
+ var newArr = [];
+ for (let i = 0; i < smallArray.length; i++) {
+ newArr[i] = smallArray[i];
+ }
+ // basic sanity check
+ if (newArr.length != smallArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: Slice
+// ----------------------------------------------------------------------------
+
+function SliceSmall() {
+ var newArr = smallArray.slice();
+ // basic sanity check
+ if (newArr.length != smallArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: Slice0
+// ----------------------------------------------------------------------------
+
+function Slice0Small() {
+ var newArr = smallArray.slice(0);
+ // basic sanity check
+ if (newArr.length != smallArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ConcatReceive
+// ----------------------------------------------------------------------------
+
+function ConcatReceiveSmall() {
+ var newArr = smallArray.concat();
+ // basic sanity check
+ if (newArr.length != smallArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ConcatArg
+// ----------------------------------------------------------------------------
+
+function ConcatArgSmall() {
+ var newArr = [].concat(smallArray);
+ // basic sanity check
+ if (newArr.length != smallArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ForOfPush
+// ----------------------------------------------------------------------------
+
+function ForOfPushSmall() {
+ var newArr = [];
+ for (let x of smallArray) {
+ newArr.push(x)
+ }
+ // basic sanity check
+ if (newArr.length != smallArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: MapId
+// ----------------------------------------------------------------------------
+
+function MapIdSmall() {
+ var newArr = smallArray.map(x => x);
+ // basic sanity check
+ if (newArr.length != smallArray.length) throw 666;
+ return newArr;
+}
+
+
+// ----------------------------------------------------------------------------
+// Setup and Run
+// ----------------------------------------------------------------------------
+
+load('../base.js');
+
+var success = true;
+
+function PrintResult(name, result) {
+ print(name + '-ArrayLiteralInitialSpreadSmallPacked(Score): ' + result);
+}
+
+function PrintError(name, error) {
+ PrintResult('Error: ' + name, error);
+ success = false;
+}
+
+function CreateBenchmark(name, f) {
+ new BenchmarkSuite(name, [1000], [ new Benchmark(name, false, false, 0, f) ]);
+}
+
+CreateBenchmark('Spread', SpreadSmall);
+CreateBenchmark('ForLength', ForLengthSmall);
+CreateBenchmark('ForLengthEmpty', ForLengthEmptySmall);
+CreateBenchmark('Slice', SliceSmall);
+CreateBenchmark('Slice0', Slice0Small);
+CreateBenchmark('ConcatReceive', ConcatReceiveSmall);
+CreateBenchmark('ConcatArg', ConcatArgSmall);
+CreateBenchmark('ForOfPush', ForOfPushSmall);
+CreateBenchmark('MapId', MapIdSmall);
+
+
+BenchmarkSuite.config.doWarmup = true;
+BenchmarkSuite.config.doDeterministic = false;
+BenchmarkSuite.RunSuites({NotifyResult: PrintResult, NotifyError: PrintError});
diff --git a/src/v8/test/js-perf-test/ArrayLiteralInitialSpreadSmallSmiMap/run.js b/src/v8/test/js-perf-test/ArrayLiteralInitialSpreadSmallSmiMap/run.js
new file mode 100644
index 0000000..a2f8bad
--- /dev/null
+++ b/src/v8/test/js-perf-test/ArrayLiteralInitialSpreadSmallSmiMap/run.js
@@ -0,0 +1,93 @@
+// 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.
+
+// Comparing different iterating schemes against spread initial literals.
+// Benchmarks for small smi maps.
+
+var keys = Array.from(Array(50).keys());
+var keyValuePairs = keys.map((value) => [value, value + 1]);
+var map = new Map(keyValuePairs);
+
+// ----------------------------------------------------------------------------
+// Benchmark: SpreadKeys
+// ----------------------------------------------------------------------------
+
+function SpreadKeys() {
+ var newArr = [...map.keys()];
+ // basic sanity check
+ if (newArr.length != map.size) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: SpreadValues
+// ----------------------------------------------------------------------------
+
+function SpreadValues() {
+ var newArr = [...map.values()];
+ // basic sanity check
+ if (newArr.length != map.size) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ForOfKeys
+// ----------------------------------------------------------------------------
+
+function ForOfKeys() {
+ var newArr = new Array(map.size);
+ var i = 0;
+ for (let x of map.keys()) {
+ newArr[i] = x;
+ i++;
+ }
+ if (newArr.length != map.size) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ForOfValues
+// ----------------------------------------------------------------------------
+
+function ForOfValues() {
+ var newArr = new Array(map.size);
+ var i = 0;
+ for (let x of map.values()) {
+ newArr[i] = x;
+ i++;
+ }
+ if (newArr.length != map.size) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Setup and Run
+// ----------------------------------------------------------------------------
+
+load('../base.js');
+
+var success = true;
+
+function PrintResult(name, result) {
+ print(name + '-ArrayLiteralInitialSpreadSmallSmiMap(Score): ' + result);
+}
+
+function PrintError(name, error) {
+ PrintResult('Error: ' + name, error);
+ success = false;
+}
+
+function CreateBenchmark(name, f) {
+ new BenchmarkSuite(name, [1000], [ new Benchmark(name, false, false, 0, f) ]);
+}
+
+CreateBenchmark('ForOfKeys', ForOfKeys);
+CreateBenchmark('ForOfValues', ForOfValues);
+CreateBenchmark('SpreadKeys', SpreadKeys);
+CreateBenchmark('SpreadValues', SpreadValues);
+
+
+BenchmarkSuite.config.doWarmup = true;
+BenchmarkSuite.config.doDeterministic = false;
+BenchmarkSuite.RunSuites({NotifyResult: PrintResult, NotifyError: PrintError});
diff --git a/src/v8/test/js-perf-test/ArrayLiteralInitialSpreadSmallSmiSet/run.js b/src/v8/test/js-perf-test/ArrayLiteralInitialSpreadSmallSmiSet/run.js
new file mode 100644
index 0000000..35e9bce
--- /dev/null
+++ b/src/v8/test/js-perf-test/ArrayLiteralInitialSpreadSmallSmiSet/run.js
@@ -0,0 +1,120 @@
+// 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.
+
+// Comparing different iterating schemes against spread initial literals.
+// Benchmarks for small smi sets.
+
+var keys = Array.from(Array(50).keys());
+var set = new Set(keys);
+
+// ----------------------------------------------------------------------------
+// Benchmark: Spread
+// ----------------------------------------------------------------------------
+
+function Spread() {
+ var newArr = [...set];
+ // basic sanity check
+ if (newArr.length != set.size) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: SpreadKeys
+// ----------------------------------------------------------------------------
+
+function SpreadKeys() {
+ var newArr = [...set.keys()];
+ // basic sanity check
+ if (newArr.length != set.size) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: SpreadValues
+// ----------------------------------------------------------------------------
+
+function SpreadValues() {
+ var newArr = [...set.values()];
+ // basic sanity check
+ if (newArr.length != set.size) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ForOf
+// ----------------------------------------------------------------------------
+
+function ForOf() {
+ var newArr = new Array(set.size);
+ var i = 0;
+ for (let x of set) {
+ newArr[i] = x;
+ i++;
+ }
+ if (newArr.length != set.size) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ForOfKeys
+// ----------------------------------------------------------------------------
+
+function ForOfKeys() {
+ var newArr = new Array(set.size);
+ var i = 0;
+ for (let x of set.keys()) {
+ newArr[i] = x;
+ i++;
+ }
+ if (newArr.length != set.size) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ForOfValues
+// ----------------------------------------------------------------------------
+
+function ForOfValues() {
+ var newArr = new Array(set.size);
+ var i = 0;
+ for (let x of set.values()) {
+ newArr[i] = x;
+ i++;
+ }
+ if (newArr.length != set.size) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Setup and Run
+// ----------------------------------------------------------------------------
+
+load('../base.js');
+
+var success = true;
+
+function PrintResult(name, result) {
+ print(name + '-ArrayLiteralInitialSpreadSmallSmiSet(Score): ' + result);
+}
+
+function PrintError(name, error) {
+ PrintResult('Error: ' + name, error);
+ success = false;
+}
+
+function CreateBenchmark(name, f) {
+ new BenchmarkSuite(name, [1000], [ new Benchmark(name, false, false, 0, f) ]);
+}
+
+CreateBenchmark('ForOf', ForOf);
+CreateBenchmark('ForOfKeys', ForOfKeys);
+CreateBenchmark('ForOfValues', ForOfValues);
+CreateBenchmark('Spread', Spread);
+CreateBenchmark('SpreadKeys', SpreadKeys);
+CreateBenchmark('SpreadValues', SpreadValues);
+
+
+BenchmarkSuite.config.doWarmup = true;
+BenchmarkSuite.config.doDeterministic = false;
+BenchmarkSuite.RunSuites({NotifyResult: PrintResult, NotifyError: PrintError});
diff --git a/src/v8/test/js-perf-test/ArrayLiteralSpread/run.js b/src/v8/test/js-perf-test/ArrayLiteralSpread/run.js
new file mode 100644
index 0000000..605df86
--- /dev/null
+++ b/src/v8/test/js-perf-test/ArrayLiteralSpread/run.js
@@ -0,0 +1,97 @@
+// 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 input = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
+
+
+// ----------------------------------------------------------------------------
+// Benchmark: Babel
+// ----------------------------------------------------------------------------
+
+function _toConsumableArray(arr) {
+ if (Array.isArray(arr)) {
+ for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) {
+ arr2[i] = arr[i];
+ }
+ return arr2;
+ } else {
+ return Array.from(arr);
+ }
+}
+
+function Babel() {
+ const result = [0].concat(_toConsumableArray(input));
+ if (result.length != 11) throw 666;
+}
+
+
+// ----------------------------------------------------------------------------
+// Benchmark: ForOfPush
+// ----------------------------------------------------------------------------
+
+
+function ForOfPush() {
+ const result = [0];
+ for (const x of input) {
+ result.push(x);
+ }
+ if (result.length != 11) throw 666;
+}
+
+
+// ----------------------------------------------------------------------------
+// Benchmark: ForOfSet
+// ----------------------------------------------------------------------------
+
+
+function ForOfSet() {
+ const result = [0];
+ for (const x of input) {
+ result[result.length] = x;
+ }
+ if (result.length != 11) throw 666;
+}
+
+
+// ----------------------------------------------------------------------------
+// Benchmark: Spread
+// ----------------------------------------------------------------------------
+
+
+function Spread() {
+ const result = [0, ...input];
+ if (result.length != 11) throw 666;
+}
+
+
+// ----------------------------------------------------------------------------
+// Setup and Run
+// ----------------------------------------------------------------------------
+
+load('../base.js');
+
+var success = true;
+
+function PrintResult(name, result) {
+ print(name + '-ArrayLiteralSpread(Score): ' + result);
+}
+
+function PrintError(name, error) {
+ PrintResult(name, error);
+ success = false;
+}
+
+function CreateBenchmark(name, f) {
+ new BenchmarkSuite(name, [100], [ new Benchmark(name, false, false, 0, f) ]);
+}
+
+CreateBenchmark('Babel', Babel);
+CreateBenchmark('ForOfPush', ForOfPush);
+CreateBenchmark('ForOfSet', ForOfSet);
+CreateBenchmark('Spread', Spread);
+
+BenchmarkSuite.config.doWarmup = undefined;
+BenchmarkSuite.config.doDeterministic = undefined;
+BenchmarkSuite.RunSuites({NotifyResult: PrintResult, NotifyError: PrintError});
diff --git a/src/v8/test/js-perf-test/ArraySort/run.js b/src/v8/test/js-perf-test/ArraySort/run.js
new file mode 100644
index 0000000..95f64d6
--- /dev/null
+++ b/src/v8/test/js-perf-test/ArraySort/run.js
@@ -0,0 +1,23 @@
+// 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('../base.js');
+load(arguments[0] + '.js')
+
+function PrintResult(name, result) {
+ print(name + '-ArraySort(Score): ' + result);
+}
+
+function PrintStep(name) {}
+
+function PrintError(name, error) {
+ PrintResult(name, error);
+}
+
+BenchmarkSuite.config.doWarmup = undefined;
+BenchmarkSuite.config.doDeterministic = undefined;
+
+BenchmarkSuite.RunSuites({ NotifyResult: PrintResult,
+ NotifyError: PrintError,
+ NotifyStep: PrintStep });
diff --git a/src/v8/test/js-perf-test/ArraySort/sort-base.js b/src/v8/test/js-perf-test/ArraySort/sort-base.js
new file mode 100644
index 0000000..776d45e
--- /dev/null
+++ b/src/v8/test/js-perf-test/ArraySort/sort-base.js
@@ -0,0 +1,141 @@
+// 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 kArraySize = 4000;
+let template_array = [];
+
+for (let i = 0; i < kArraySize; ++i) {
+ template_array[i] = Math.floor(Math.random() * kArraySize);
+}
+
+let array_to_sort = [];
+
+function AssertPackedSmiElements() {
+ assert(%HasFastPackedElements(array_to_sort) &&
+ %HasSmiElements(array_to_sort),
+ "Element kind is not PACKED_SMI_ELEMENTS");
+}
+
+function AssertPackedDoubleElements() {
+ assert(%HasFastPackedElements(array_to_sort) &&
+ %HasDoubleElements(array_to_sort),
+ "Element kind is not PACKED_DOUBLE_ELEMENTS");
+}
+
+function AssertPackedObjectElements() {
+ assert(%HasFastPackedElements(array_to_sort) &&
+ %HasObjectElements(array_to_sort),
+ "Element kind is not PACKED_ELEMENTS");
+}
+
+function AssertHoleySmiElements() {
+ assert(%HasHoleyElements(array_to_sort) &&
+ %HasSmiElements(array_to_sort),
+ "Element kind is not HOLEY_SMI_ELEMENTS");
+}
+
+function AssertHoleyDoubleElements() {
+ assert(%HasHoleyElements(array_to_sort) &&
+ %HasDoubleElements(array_to_sort),
+ "Element kind is not HOLEY_DOUBLE_ELEMENTS");
+}
+
+function AssertHoleyObjectElements() {
+ assert(%HasHoleyElements(array_to_sort) &&
+ %HasObjectElements(array_to_sort),
+ "Element kind is not HOLEY_ELEMENTS");
+}
+
+function AssertDictionaryElements() {
+ assert(%HasDictionaryElements(array_to_sort),
+ "Element kind is not DICTIONARY_ELEMENTS");
+}
+
+function CreatePackedSmiArray() {
+ array_to_sort = Array.from(template_array);
+ AssertPackedSmiElements();
+}
+
+function CreatePackedDoubleArray() {
+ array_to_sort = Array.from(template_array, (x,_) => x + 0.1);
+ AssertPackedDoubleElements();
+}
+
+function CreatePackedObjectArray() {
+ array_to_sort = Array.from(template_array, (x,_) => `value ${x}`);
+ AssertPackedObjectElements();
+}
+
+function CreateHoleySmiArray() {
+ array_to_sort = Array.from(template_array);
+ delete array_to_sort[0];
+ AssertHoleySmiElements();
+}
+
+function CreateHoleyDoubleArray() {
+ array_to_sort = new Array(kArraySize);
+ for (let i = 0; i < kArraySize; ++i) {
+ array_to_sort[i] = template_array[i] + 0.1;
+ }
+
+ AssertHoleyDoubleElements();
+}
+
+function CreateHoleyObjectArray() {
+ array_to_sort = new Array(kArraySize);
+ for (let i = 0; i < kArraySize; ++i) {
+ array_to_sort[i] = `value ${template_array[i]}`;
+ }
+
+ AssertHoleyObjectElements();
+}
+
+function CreateDictionaryArray() {
+ array_to_sort = Array.from(template_array);
+ Object.defineProperty(array_to_sort, kArraySize - 2,
+ { get: () => this.foo,
+ set: (v) => this.foo = v });
+
+ AssertDictionaryElements();
+}
+
+function Sort() {
+ array_to_sort.sort();
+}
+
+function CreateSortFn(comparefns = []) {
+ return () => {
+ for (let cmpfn of comparefns) {
+ array_to_sort.sort(cmpfn);
+ }
+ }
+}
+
+function cmp_smaller(a, b) {
+ if (a < b) return -1;
+ if (b < a) return 1;
+ return 0;
+}
+
+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/src/v8/test/js-perf-test/ArraySort/sort-cmpfn-kindchange.js b/src/v8/test/js-perf-test/ArraySort/sort-cmpfn-kindchange.js
new file mode 100644
index 0000000..8ff1a02
--- /dev/null
+++ b/src/v8/test/js-perf-test/ArraySort/sort-cmpfn-kindchange.js
@@ -0,0 +1,43 @@
+// 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');
+
+// Creates a comparison function, that will call the provided transform function
+// after a set amount of comparisons. The transform function should cause the
+// element kind of the array to change.
+function CreateCompareFn(transformfn) {
+ return (a, b) => {
+ ++counter;
+ if (counter == kArraySize/2) {
+ transformfn();
+ }
+
+ return cmp_smaller(a, b);
+ }
+}
+
+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);
+
+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);
+
+createSortSuite(
+ 'PackedElementToDictionary', 1000, CreateSortFn([cmp_packed_to_dict]),
+ CreatePackedObjectArray, AssertDictionaryElements);
+createSortSuite(
+ 'HoleyElementToDictionary', 1000, CreateSortFn([cmp_holey_to_dict]),
+ CreateHoleyObjectArray, AssertDictionaryElements);
diff --git a/src/v8/test/js-perf-test/ArraySort/sort-cmpfn.js b/src/v8/test/js-perf-test/ArraySort/sort-cmpfn.js
new file mode 100644
index 0000000..9675f5c
--- /dev/null
+++ b/src/v8/test/js-perf-test/ArraySort/sort-cmpfn.js
@@ -0,0 +1,20 @@
+// 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');
+
+// 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]);
+
+createSortSuite('PackedSmi', 1000, sortfn, CreatePackedSmiArray);
+createSortSuite('PackedDouble', 1000, sortfn, CreatePackedDoubleArray);
+createSortSuite('PackedElement', 1000, sortfn, CreatePackedObjectArray);
+
+createSortSuite('HoleySmi', 1000, sortfn, CreateHoleySmiArray);
+createSortSuite('HoleyDouble', 1000, sortfn, CreateHoleyDoubleArray);
+createSortSuite('HoleyElement', 1000, sortfn, CreateHoleyObjectArray);
+
+createSortSuite('Dictionary', 1000, sortfn, CreateDictionaryArray);
diff --git a/src/v8/test/js-perf-test/ArraySort/sort-lengths.js b/src/v8/test/js-perf-test/ArraySort/sort-lengths.js
new file mode 100644
index 0000000..f27805a
--- /dev/null
+++ b/src/v8/test/js-perf-test/ArraySort/sort-lengths.js
@@ -0,0 +1,36 @@
+// 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) {
+ array_to_sort = [];
+ for (let i = 0; i < length; ++i) {
+ array_to_sort.push(Math.floor(Math.random() * length));
+ }
+ AssertPackedSmiElements();
+}
+
+function Sorted(length) {
+ array_to_sort = [];
+ for (let i = 0; i < length; ++i) {
+ array_to_sort.push(i);
+ }
+ AssertPackedSmiElements();
+}
+
+function CreateSortSuitesForLength(length) {
+ createSortSuite('Random' + length, 1000, SortAsc, () => Random(length));
+ createSortSuite('Sorted' + length, 1000, SortAsc, () => Sorted(length));
+}
+
+CreateSortSuitesForLength(10);
+CreateSortSuitesForLength(100);
+CreateSortSuitesForLength(1000);
+CreateSortSuitesForLength(10000);
+CreateSortSuitesForLength(100000);
diff --git a/src/v8/test/js-perf-test/ArraySort/sort-megamorphic.js b/src/v8/test/js-perf-test/ArraySort/sort-megamorphic.js
new file mode 100644
index 0000000..4f71031
--- /dev/null
+++ b/src/v8/test/js-perf-test/ArraySort/sort-megamorphic.js
@@ -0,0 +1,20 @@
+// 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 SetupMegamorphic() {
+ CreatePackedSmiArray();
+
+ Array.prototype.sort.call([1.1]);
+ Array.prototype.sort.call(['a']);
+ Array.prototype.sort.call([2,,3]);
+ Array.prototype.sort.call([0.2,,0.1]);
+ Array.prototype.sort.call(['b',,'a']);
+ Array.prototype.sort.call({});
+}
+
+createSortSuite('Base', 1000, Sort, SetupMegamorphic);
+createSortSuite('MultipleCompareFns', 1000,
+ CreateSortFn([cmp_smaller, cmp_greater]), SetupMegamorphic);
diff --git a/src/v8/test/js-perf-test/ArraySort/sort-presorted.js b/src/v8/test/js-perf-test/ArraySort/sort-presorted.js
new file mode 100644
index 0000000..5078641
--- /dev/null
+++ b/src/v8/test/js-perf-test/ArraySort/sort-presorted.js
@@ -0,0 +1,108 @@
+// 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');
+
+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 SawSeq3(a, tooth, length) {
+ let count = 0;
+ while (true) {
+ for (let i = 0; i < tooth; ++i) {
+ a.push(tooth - i);
+ if (++count >= length) return;
+ }
+ }
+}
+
+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/src/v8/test/js-perf-test/ArraySort/sort.js b/src/v8/test/js-perf-test/ArraySort/sort.js
new file mode 100644
index 0000000..cc77e58
--- /dev/null
+++ b/src/v8/test/js-perf-test/ArraySort/sort.js
@@ -0,0 +1,15 @@
+// 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');
+
+createSortSuite('PackedSmi', 1000, Sort, CreatePackedSmiArray);
+createSortSuite('PackedDouble', 1000, Sort, CreatePackedDoubleArray);
+createSortSuite('PackedElement', 1000, Sort, CreatePackedObjectArray);
+
+createSortSuite('HoleySmi', 1000, Sort, CreateHoleySmiArray);
+createSortSuite('HoleyDouble', 1000, Sort, CreateHoleyDoubleArray);
+createSortSuite('HoleyElement', 1000, Sort, CreateHoleyObjectArray);
+
+createSortSuite('Dictionary', 1000, Sort, CreateDictionaryArray);
diff --git a/src/v8/test/js-perf-test/AsyncAwait/baseline-babel-es2017.js b/src/v8/test/js-perf-test/AsyncAwait/baseline-babel-es2017.js
index 1be3074..37709d7 100644
--- a/src/v8/test/js-perf-test/AsyncAwait/baseline-babel-es2017.js
+++ b/src/v8/test/js-perf-test/AsyncAwait/baseline-babel-es2017.js
@@ -160,10 +160,10 @@
return a;
})();
- %RunMicrotasks();
+ %PerformMicrotaskCheckpoint();
}
function Basic() {
a();
- %RunMicrotasks();
+ %PerformMicrotaskCheckpoint();
}
diff --git a/src/v8/test/js-perf-test/AsyncAwait/baseline-naive-promises.js b/src/v8/test/js-perf-test/AsyncAwait/baseline-naive-promises.js
index f59ae86..9b9c091 100644
--- a/src/v8/test/js-perf-test/AsyncAwait/baseline-naive-promises.js
+++ b/src/v8/test/js-perf-test/AsyncAwait/baseline-naive-promises.js
@@ -34,7 +34,7 @@
b = function b(p) { return p; };
a = function a(p) { return p; };
- %RunMicrotasks();
+ %PerformMicrotaskCheckpoint();
}
function Basic() {
@@ -48,5 +48,5 @@
.then(c)
.then(b)
.then(a);
- %RunMicrotasks();
+ %PerformMicrotaskCheckpoint();
}
diff --git a/src/v8/test/js-perf-test/AsyncAwait/native.js b/src/v8/test/js-perf-test/AsyncAwait/native.js
index 7979d2f..e9504c3 100644
--- a/src/v8/test/js-perf-test/AsyncAwait/native.js
+++ b/src/v8/test/js-perf-test/AsyncAwait/native.js
@@ -34,10 +34,10 @@
b = async function b() { return c(); };
a = async function a() { return b(); };
- %RunMicrotasks();
+ %PerformMicrotaskCheckpoint();
}
function Basic() {
a();
- %RunMicrotasks();
+ %PerformMicrotaskCheckpoint();
}
diff --git a/src/v8/test/js-perf-test/BigInt/add.js b/src/v8/test/js-perf-test/BigInt/add.js
new file mode 100644
index 0000000..f0397f2
--- /dev/null
+++ b/src/v8/test/js-perf-test/BigInt/add.js
@@ -0,0 +1,142 @@
+// Copyright 2019 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.
+
+"use strict";
+
+load('bigint-util.js');
+
+let initial_sum = 0n;
+let a = 0n;
+let random_bigints = [];
+
+// This dummy ensures that the feedback for benchmark.run() in the Measure
+// function from base.js is not monomorphic, thereby preventing the benchmarks
+// below from being inlined. This ensures consistent behavior and comparable
+// results.
+new BenchmarkSuite('Prevent-Inline-Dummy', [10000], [
+ new Benchmark('Prevent-Inline-Dummy', true, false, 0, () => {})
+]);
+
+
+new BenchmarkSuite('Add-TypeError', [10000], [
+ new Benchmark('Add-TypeError', true, false, 0, TestAddTypeError,
+ SetUpTestAddTypeError)
+]);
+
+
+new BenchmarkSuite('Add-Zero', [1000], [
+ new Benchmark('Add-Zero', true, false, 0, TestAddZero, SetUpTestAddZero)
+]);
+
+
+BITS_CASES.forEach((d) => {
+ new BenchmarkSuite(`Add-SameSign-${d}`, [1000], [
+ new Benchmark(`Add-SameSign-${d}`, true, false, 0, TestAddSameSign,
+ () => SetUpTestAddSameSign(d))
+ ]);
+});
+
+
+BITS_CASES.forEach((d) => {
+ new BenchmarkSuite(`Add-DifferentSign-${d}`, [1000], [
+ new Benchmark(`Add-DifferentSign-${d}`, true, false, 0,
+ TestAddDifferentSign, () => SetUpTestAddDifferentSign(d))
+ ]);
+});
+
+
+new BenchmarkSuite('Add-Random', [1000], [
+ new Benchmark('Add-Random', true, false, 0, TestAddRandom,
+ SetUpTestAddRandom)
+]);
+
+
+function SetUpTestAddTypeError() {
+ initial_sum = 42n;
+}
+
+function TestAddTypeError() {
+ let sum = initial_sum;
+ for (let i = 0; i < SLOW_TEST_ITERATIONS; ++i) {
+ try {
+ sum = 0 + sum;
+ }
+ catch(e) {
+ }
+ }
+ return sum;
+}
+
+
+function SetUpTestAddZero() {
+ initial_sum = 42n;
+}
+
+function TestAddZero() {
+ let sum = initial_sum;
+
+ for (let i = 0; i < TEST_ITERATIONS; ++i) {
+ sum = 0n + sum;
+ }
+
+ return sum;
+}
+
+
+function SetUpTestAddSameSign(bits) {
+ // Add two small random positive values to make sure the sum does not grow
+ // in digits.
+ initial_sum = SmallRandomBigIntWithBits(bits);
+ a = SmallRandomBigIntWithBits(bits);
+}
+
+function TestAddSameSign() {
+ let sum = initial_sum;
+
+ for (let i = 0; i < TEST_ITERATIONS; ++i) {
+ sum = a + sum;
+ }
+
+ return sum;
+}
+
+
+function SetUpTestAddDifferentSign(bits) {
+ // Add a small random negative value to a large positive one to make sure the
+ // sum does not shrink in digits.
+ initial_sum = MaxBigIntWithBits(bits);
+ a = -SmallRandomBigIntWithBits(bits);
+}
+
+function TestAddDifferentSign() {
+ let sum = initial_sum;
+
+ for (let i = 0; i < TEST_ITERATIONS; ++i) {
+ sum = a + sum;
+ }
+
+ return sum;
+}
+
+
+function SetUpTestAddRandom() {
+ random_bigints = [];
+ // RandomBigIntWithBits needs multiples of 4 bits.
+ const max_in_4bits = RANDOM_BIGINTS_MAX_BITS / 4;
+ for (let i = 0; i < TEST_ITERATIONS; ++i) {
+ const bits = Math.floor(Math.random() * max_in_4bits) * 4;
+ const bigint = RandomBigIntWithBits(bits);
+ random_bigints.push(Math.random() < 0.5 ? -bigint : bigint);
+ }
+}
+
+function TestAddRandom() {
+ let sum = 0n;
+
+ for (let i = 0; i < TEST_ITERATIONS; ++i) {
+ sum = random_bigints[i] + sum;
+ }
+
+ return sum;
+}
diff --git a/src/v8/test/js-perf-test/BigInt/as-uint-n.js b/src/v8/test/js-perf-test/BigInt/as-uint-n.js
new file mode 100644
index 0000000..f69d497
--- /dev/null
+++ b/src/v8/test/js-perf-test/BigInt/as-uint-n.js
@@ -0,0 +1,86 @@
+// Copyright 2019 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.
+
+"use strict";
+
+load('bigint-util.js');
+
+// This dummy ensures that the feedback for benchmark.run() in the Measure
+// function from base.js is not monomorphic, thereby preventing the benchmarks
+// below from being inlined. This ensures consistent behavior and comparable
+// results.
+new BenchmarkSuite('Prevent-Inline-Dummy', [10000], [
+ new Benchmark('Prevent-Inline-Dummy', true, false, 0, () => {})
+]);
+
+
+[32, 64, 128, 256].forEach((d) => {
+ new BenchmarkSuite(`AsUint64-${d}`, [1000], [
+ new Benchmark(`AsUint64-${d}`, true, false, 0, TestAsUint64,
+ () => SetUpTestAsUintN(d))
+ ]);
+});
+
+
+[32, 64, 128, 256].forEach((d) => {
+ new BenchmarkSuite(`AsUint32-${d}`, [1000], [
+ new Benchmark(`AsUint32-${d}`, true, false, 0, TestAsUint32,
+ () => SetUpTestAsUintN(d))
+ ]);
+});
+
+
+[32, 64, 128, 256].forEach((d) => {
+ new BenchmarkSuite(`AsUint8-${d}`, [1000], [
+ new Benchmark(`AsUint8-${d}`, true, false, 0, TestAsUint8,
+ () => SetUpTestAsUintN(d))
+ ]);
+});
+
+
+function SetUpTestAsUintN(d) {
+ random_bigints = [
+ RandomBigIntWithBits(d),
+ RandomBigIntWithBits(d),
+ RandomBigIntWithBits(d),
+ RandomBigIntWithBits(d),
+ RandomBigIntWithBits(d),
+ RandomBigIntWithBits(d),
+ RandomBigIntWithBits(d),
+ RandomBigIntWithBits(d)
+ ];
+}
+
+
+function TestAsUint64() {
+ let result = 0n;
+
+ for (let i = 0; i < TEST_ITERATIONS; ++i) {
+ result = BigInt.asUintN(64, random_bigints[i % 8]);
+ }
+
+ return result;
+}
+
+
+function TestAsUint32() {
+ let result = 0n;
+
+ for (let i = 0; i < TEST_ITERATIONS; ++i) {
+ result = BigInt.asUintN(32, random_bigints[i % 8]);
+ }
+
+ return result;
+}
+
+
+function TestAsUint8() {
+ let result = 0n;
+
+ for (let i = 0; i < TEST_ITERATIONS; ++i) {
+ result = BigInt.asUintN(8, random_bigints[i % 8]);
+ }
+
+ return result;
+}
diff --git a/src/v8/test/js-perf-test/BigInt/bigint-util.js b/src/v8/test/js-perf-test/BigInt/bigint-util.js
new file mode 100644
index 0000000..7e42606
--- /dev/null
+++ b/src/v8/test/js-perf-test/BigInt/bigint-util.js
@@ -0,0 +1,65 @@
+// Copyright 2019 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.
+
+"use strict";
+
+
+function RandomHexDigit(allow_zero) {
+ const chars = allow_zero ? '0123456789ABCDEF' : '123456789ABCDEF';
+ return chars.charAt(Math.floor(Math.random() * chars.length));
+}
+
+
+// Some benchmarks shall compute sums but the result must not grow in terms
+// of digits. These can use "small" BigInts, which are BigInts where the most
+// significant bits of a digit are 0, so it does not overflow.
+function SmallRandomBigIntWithBits(bits) {
+ console.assert(bits % 4 === 0);
+ if (bits <= 0) {
+ return 0n;
+ }
+
+ // Make sure it does not start with four 0-bits.
+ let s = "0x" + RandomHexDigit(false);
+ bits -= 4;
+ // Digits are at least 32 bits long, so we round down to the next smaller
+ // multiple of 32 to keep the most significant digit small.
+ bits = Math.floor(bits / 32) * 32;
+ for (; bits > 0; bits -= 4) {
+ s += RandomHexDigit(true);
+ }
+ return BigInt(s);
+}
+
+
+function MaxBigIntWithBits(bits) {
+ console.assert(bits % 4 === 0);
+ if (bits <= 0) {
+ return 0n;
+ }
+
+ let s = "0x";
+ for (; bits > 0; bits -= 4) {
+ s += "F";
+ }
+ return BigInt(s);
+}
+
+
+// Generates a random BigInt between 2^(bits-4) and 2^bits-1 (for bits > 0).
+function RandomBigIntWithBits(bits) {
+ console.assert(bits % 4 === 0);
+ if (bits <= 0) {
+ return 0n;
+ }
+
+ // Make sure it does not start with four 0-bits.
+ let s = "0x" + RandomHexDigit(false);
+ bits -= 4;
+ // Randomly generate remaining bits.
+ for (; bits > 0; bits -= 4) {
+ s += RandomHexDigit(true);
+ }
+ return BigInt(s);
+}
diff --git a/src/v8/test/js-perf-test/BigInt/run.js b/src/v8/test/js-perf-test/BigInt/run.js
new file mode 100644
index 0000000..2f2cc30
--- /dev/null
+++ b/src/v8/test/js-perf-test/BigInt/run.js
@@ -0,0 +1,31 @@
+// Copyright 2019 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.
+
+"use strict";
+
+load('../base.js');
+load('test-config.js');
+load('to-boolean.js');
+load('add.js');
+load('as-uint-n.js');
+
+
+var success = true;
+
+function PrintResult(name, result) {
+ print(name + '-BigInt(Score): ' + result);
+}
+
+
+function PrintError(name, error) {
+ PrintResult(name, error);
+ success = false;
+}
+
+
+BenchmarkSuite.config.doWarmup = undefined;
+BenchmarkSuite.config.doDeterministic = undefined;
+
+BenchmarkSuite.RunSuites({ NotifyResult: PrintResult,
+ NotifyError: PrintError });
diff --git a/src/v8/test/js-perf-test/BigInt/test-config.js b/src/v8/test/js-perf-test/BigInt/test-config.js
new file mode 100644
index 0000000..8d77e70
--- /dev/null
+++ b/src/v8/test/js-perf-test/BigInt/test-config.js
@@ -0,0 +1,10 @@
+// Copyright 2019 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.
+
+"use strict";
+
+const TEST_ITERATIONS = 1000;
+const SLOW_TEST_ITERATIONS = 50;
+const BITS_CASES = [32, 64, 128, 256, 512, 1024, 2048, 4096, 8192];
+const RANDOM_BIGINTS_MAX_BITS = 64 * 100;
diff --git a/src/v8/test/js-perf-test/BigInt/to-boolean.js b/src/v8/test/js-perf-test/BigInt/to-boolean.js
new file mode 100644
index 0000000..031c292
--- /dev/null
+++ b/src/v8/test/js-perf-test/BigInt/to-boolean.js
@@ -0,0 +1,59 @@
+// Copyright 2019 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.
+
+"use strict";
+
+const ITERATIONS = 100000;
+
+// This dummy ensures that the feedback for benchmark.run() in the Measure function
+// from base.js is not monomorphic, thereby preventing the benchmarks below from being inlined.
+// This ensures consistent behavior and comparable results.
+new BenchmarkSuite('Prevent-Inline-Dummy', [10000], [
+ new Benchmark('Prevent-Inline-Dummy', true, false, 0, () => {})
+]);
+
+new BenchmarkSuite('BigInt-ToBoolean', [10000], [
+ new Benchmark('BigInt-ToBoolean', true, false, 0, TestToBoolean),
+]);
+
+new BenchmarkSuite('BigInt-BooleanConstructor', [10000], [
+ new Benchmark('BigInt-BooleanConstructor', true, false, 0, TestBooleanConstructor),
+]);
+
+new BenchmarkSuite('BigInt-NewBooleanConstructor', [10000], [
+ new Benchmark('BigInt-NewBooleanConstructor', true, false, 0, TestNewBooleanConstructor),
+]);
+
+
+function TestBooleanConstructor() {
+ let kl = true;
+ for (let i = 0; i < ITERATIONS; ++i) {
+ // Store to a variable to prevent elimination.
+ // Keep a depedency on the loop counter to prevent hoisting.
+ kl = Boolean(i % 2 == 0 ? 42n : 32n);
+ }
+ return kl;
+}
+
+
+function TestNewBooleanConstructor() {
+ let kl = true;
+ for (let i = 0; i < ITERATIONS; ++i) {
+ // Store to a variable to prevent elimination.
+ // Keep a depedency on the loop counter to prevent hoisting.
+ kl = new Boolean(i % 2 == 0 ? 42n : 32n);
+ }
+ return kl;
+}
+
+
+function TestToBoolean() {
+ let kl = true;
+ for (let i = 0; i < ITERATIONS; ++i) {
+ // Store to a variable to prevent elimination.
+ // Keep a depedency on the loop counter to prevent hoisting.
+ kl = (i % 2 == 0 ? 42n : 32n) ? true : false;
+ }
+ return kl;
+}
diff --git a/src/v8/test/js-perf-test/BytecodeHandlers/LdaKeyedProperty.js b/src/v8/test/js-perf-test/BytecodeHandlers/LdaKeyedProperty.js
new file mode 100644
index 0000000..b0da481
--- /dev/null
+++ b/src/v8/test/js-perf-test/BytecodeHandlers/LdaKeyedProperty.js
@@ -0,0 +1,40 @@
+// Copyright 2019 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 addBenchmark(name, test) {
+ new BenchmarkSuite(name, [1000],
+ [
+ new Benchmark(name, false, false, 0, test)
+ ]);
+}
+
+function objectLookupStringConstant() {
+ const x = { 1: "foo" };
+
+ for (var i = 0; i < 1000; ++i) {
+ const p = x["1"];
+ }
+}
+
+function objectLookupIndexNumber() {
+ const x = { 1: "foo" };
+ const a = 1;
+
+ for (var i = 0; i < 1000; ++i) {
+ const p = x[a];
+ }
+}
+
+function objectLookupIndexString() {
+ const x = { 1: "foo" };
+ const a = "1";
+
+ for (var i = 0; i < 1000; ++i) {
+ const p = x[a];
+ }
+}
+
+addBenchmark('Object-Lookup-String-Constant', objectLookupStringConstant);
+addBenchmark('Object-Lookup-Index-Number', objectLookupIndexNumber);
+addBenchmark('Object-Lookup-Index-String', objectLookupIndexString);
diff --git a/src/v8/test/js-perf-test/BytecodeHandlers/LdaNamedProperty.js b/src/v8/test/js-perf-test/BytecodeHandlers/LdaNamedProperty.js
new file mode 100644
index 0000000..c924db8
--- /dev/null
+++ b/src/v8/test/js-perf-test/BytecodeHandlers/LdaNamedProperty.js
@@ -0,0 +1,60 @@
+// Copyright 2019 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 addBenchmark(name, test) {
+ new BenchmarkSuite(name, [1000],
+ [
+ new Benchmark(name, false, false, 0, test)
+ ]);
+}
+
+addBenchmark('Smi-Value', smiValue);
+addBenchmark('Prototype-Chain-Value', functionOnPrototypeValue);
+
+// TODO(all): might be a good idea to also do with receivers: double, HeapObject
+// with map, HeapObject, tagged, empty getter / accessor.
+// Also, element keyed loads (in another file, probably?) both with strings and
+// numbers for normal, cons,and sliced strings (for named properties).
+// Also, monomorphic vs poly vs mega.
+
+function smiValue() {
+ function constructSmi() {
+ this.smi = 0;
+ }
+ let o = new constructSmi();
+
+ for (var i = 0; i < 1000; ++i) {
+ o.smi; o.smi; o.smi; o.smi; o.smi; o.smi; o.smi; o.smi; o.smi; o.smi;
+ o.smi; o.smi; o.smi; o.smi; o.smi; o.smi; o.smi; o.smi; o.smi; o.smi;
+ o.smi; o.smi; o.smi; o.smi; o.smi; o.smi; o.smi; o.smi; o.smi; o.smi;
+ o.smi; o.smi; o.smi; o.smi; o.smi; o.smi; o.smi; o.smi; o.smi; o.smi;
+ o.smi; o.smi; o.smi; o.smi; o.smi; o.smi; o.smi; o.smi; o.smi; o.smi;
+ o.smi; o.smi; o.smi; o.smi; o.smi; o.smi; o.smi; o.smi; o.smi; o.smi;
+ o.smi; o.smi; o.smi; o.smi; o.smi; o.smi; o.smi; o.smi; o.smi; o.smi;
+ o.smi; o.smi; o.smi; o.smi; o.smi; o.smi; o.smi; o.smi; o.smi; o.smi;
+ o.smi; o.smi; o.smi; o.smi; o.smi; o.smi; o.smi; o.smi; o.smi; o.smi;
+ o.smi; o.smi; o.smi; o.smi; o.smi; o.smi; o.smi; o.smi; o.smi; o.smi;
+ }
+}
+
+function functionOnPrototypeValue() {
+ function objectWithPrototypeChain() {
+ }
+ objectWithPrototypeChain.prototype.__proto__ =
+ {__proto__:{__proto__:{__proto__:{f(){}}}}};
+ let o = new objectWithPrototypeChain();
+
+ for (var i = 0; i < 1000; ++i) {
+ o.f; o.f; o.f; o.f; o.f; o.f; o.f; o.f; o.f; o.f;
+ o.f; o.f; o.f; o.f; o.f; o.f; o.f; o.f; o.f; o.f;
+ o.f; o.f; o.f; o.f; o.f; o.f; o.f; o.f; o.f; o.f;
+ o.f; o.f; o.f; o.f; o.f; o.f; o.f; o.f; o.f; o.f;
+ o.f; o.f; o.f; o.f; o.f; o.f; o.f; o.f; o.f; o.f;
+ o.f; o.f; o.f; o.f; o.f; o.f; o.f; o.f; o.f; o.f;
+ o.f; o.f; o.f; o.f; o.f; o.f; o.f; o.f; o.f; o.f;
+ o.f; o.f; o.f; o.f; o.f; o.f; o.f; o.f; o.f; o.f;
+ o.f; o.f; o.f; o.f; o.f; o.f; o.f; o.f; o.f; o.f;
+ o.f; o.f; o.f; o.f; o.f; o.f; o.f; o.f; o.f; o.f;
+ }
+}
diff --git a/src/v8/test/js-perf-test/Collections/weakmap.js b/src/v8/test/js-perf-test/Collections/weakmap.js
index e13d1b3..acd8a14 100644
--- a/src/v8/test/js-perf-test/Collections/weakmap.js
+++ b/src/v8/test/js-perf-test/Collections/weakmap.js
@@ -15,7 +15,12 @@
]);
var MapBenchmark = new BenchmarkSuite('WeakMapSetGet-Large', [1e7], [
- new Benchmark('Set-Get', false, false, 0, WeakMapSetGetLarge,
+ new Benchmark('Set-Get', false, true, 1, WeakMapSetGetLarge,
+ WeakMapSetupBaseLarge, WeakMapTearDown),
+]);
+
+var MapBenchmark = new BenchmarkSuite('WeakMapSet-Huge', [1e8], [
+ new Benchmark('Set-Get', false, true, 1, WeakMapSetHuge,
WeakMapSetupBaseLarge, WeakMapTearDown),
]);
@@ -92,7 +97,7 @@
function WeakMapDelete() {
// This is run more than once per setup so we will end up deleting items
- // more than once. Therefore, we do not the return value of delete.
+ // more than once. Therefore, we do not check the return value of delete.
for (var i = 0; i < N; i++) {
wm.delete(keys[i]);
}
@@ -113,3 +118,14 @@
}
}
}
+
+function WeakMapSetHuge() {
+ function Foo(i) {
+ this.x = i;
+ }
+ let obj;
+ for (let i = 0; i < LargeN; i++) {
+ obj = new Foo(i); // Make sure we do not scalar-replace the object.
+ wm.set(obj, 1);
+ }
+}
diff --git a/src/v8/test/js-perf-test/DataView/dataviewtest.js b/src/v8/test/js-perf-test/DataView/dataviewtest.js
new file mode 100644
index 0000000..e8de3a2
--- /dev/null
+++ b/src/v8/test/js-perf-test/DataView/dataviewtest.js
@@ -0,0 +1,210 @@
+// 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.
+
+new BenchmarkSuite('DataViewTest-DataView-BigEndian', [1000], [
+ new Benchmark('DataViewTest-DataView-BigEndian', false, false, 0, doTestDataViewBigEndian),
+]);
+
+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),
+]);
+
+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);
+}
+
+function doTestDataViewLittleEndian() {
+ doIterations(true, true);
+}
+
+function doTestTypedArrayBigEndian() {
+ doIterations(false, false);
+}
+
+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;
+ if (dataView) {
+ for (var i = 0; i < iterations; i++)
+ doOneIterationDV(buffer, littleEndian);
+ } else {
+ for (var i = 0; i < iterations; i++)
+ doOneIterationJS(buffer, littleEndian);
+ }
+}
+
+function makeBuffer(size, littleEndian) {
+ var buffer = new ArrayBuffer(size * 14);
+ var view = new DataView(buffer);
+ for (var i = 0; i < size; ++i) {
+ view.setInt8(i * 14, i);
+ view.setUint8(i * 14 + 1, i);
+ view.setInt16(i * 14 + 2, i * i, littleEndian);
+ view.setUint16(i * 14 + 4, i * i, littleEndian);
+ view.setInt32(i * 14 + 6, i * i * i, littleEndian);
+ view.setUint32(i * 14 + 10, i * i * i, littleEndian);
+ }
+ return buffer;
+}
+
+function doOneIterationDV(buffer, littleEndian) {
+ var xor = 0;
+ var view = new DataView(buffer);
+ for (var i = 0; i < view.byteLength; i += 14) {
+ xor ^= view.getInt8(i);
+ xor ^= view.getUint8(i + 1);
+ xor ^= view.getInt16(i + 2, littleEndian);
+ xor ^= view.getUint16(i + 4, littleEndian);
+ xor ^= view.getInt32(i + 6, littleEndian);
+ xor ^= view.getUint32(i + 10, littleEndian);
+ }
+}
+
+function doOneIterationJS(buffer, littleEndian) {
+ var xor = 0;
+ var reader;
+ if (littleEndian) {
+ reader = new LittleEndian(buffer);
+ } else {
+ reader = new BigEndian(buffer);
+ }
+ for (var i = 0; i < buffer.byteLength; i += 14) {
+ xor ^= reader.getInt8(i);
+ xor ^= reader.getUint8(i + 1);
+ xor ^= reader.getInt16(i + 2);
+ xor ^= reader.getUint16(i + 4);
+ xor ^= reader.getInt32(i + 6);
+ xor ^= reader.getUint32(i + 10);
+ }
+}
+
+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);
+}
+BigEndian.prototype.getInt8 = function(byteOffset) {
+ return this.int8View_[byteOffset];
+};
+BigEndian.prototype.getUint8 = function(byteOffset) {
+ return this.uint8View_[byteOffset];
+};
+BigEndian.prototype.getInt16 = function(byteOffset) {
+ return this.uint8View_[byteOffset + 1] | (this.int8View_[byteOffset] << 8);
+};
+BigEndian.prototype.getUint16 = function(byteOffset) {
+ return this.uint8View_[byteOffset + 1] | (this.uint8View_[byteOffset] << 8);
+};
+BigEndian.prototype.getInt32 = function(byteOffset) {
+ return this.uint8View_[byteOffset + 3] |
+ (this.uint8View_[byteOffset + 2] << 8) |
+ (this.uint8View_[byteOffset + 1] << 16) |
+ (this.int8View_[byteOffset] << 24);
+};
+BigEndian.prototype.getUint32 = function(byteOffset) {
+ return this.uint8View_[byteOffset + 3] +
+ (this.uint8View_[byteOffset + 2] << 8) +
+ (this.uint8View_[byteOffset + 1] << 16) +
+ (this.uint8View_[byteOffset] * (1 << 24));
+};
+
+function LittleEndian(buffer, opt_byteOffset) {
+ this.uint8View_ = new Uint8Array(buffer, opt_byteOffset || 0);
+ this.int8View_ = new Int8Array(buffer, opt_byteOffset || 0);
+}
+LittleEndian.prototype.getInt8 = function(byteOffset) {
+ return this.int8View_[byteOffset];
+};
+LittleEndian.prototype.getUint8 = function(byteOffset) {
+ return this.uint8View_[byteOffset];
+};
+LittleEndian.prototype.getInt16 = function(byteOffset) {
+ return this.uint8View_[byteOffset] | (this.int8View_[byteOffset + 1] << 8);
+};
+LittleEndian.prototype.getUint16 = function(byteOffset) {
+ return this.uint8View_[byteOffset] | (this.uint8View_[byteOffset + 1] << 8);
+};
+LittleEndian.prototype.getInt32 = function(byteOffset) {
+ return this.uint8View_[byteOffset] |
+ (this.uint8View_[byteOffset + 1] << 8) |
+ (this.uint8View_[byteOffset + 2] << 16) |
+ (this.int8View_[byteOffset + 3] << 24);
+};
+LittleEndian.prototype.getUint32 = function(byteOffset) {
+ return this.uint8View_[byteOffset] +
+ (this.uint8View_[byteOffset + 1] << 8) +
+ (this.uint8View_[byteOffset + 2] << 16) +
+ (this.uint8View_[byteOffset + 3] * (1 << 24));
+};
diff --git a/src/v8/test/js-perf-test/DataView/run.js b/src/v8/test/js-perf-test/DataView/run.js
new file mode 100644
index 0000000..5515166
--- /dev/null
+++ b/src/v8/test/js-perf-test/DataView/run.js
@@ -0,0 +1,24 @@
+// 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('dataviewtest.js');
+
+var success = true;
+
+function PrintResult(name, result) {
+ print(`DataView-${name}(Score): ${result}`);
+}
+
+function PrintError(name, error) {
+ PrintResult(name, error);
+ success = false;
+}
+
+
+BenchmarkSuite.config.doWarmup = undefined;
+BenchmarkSuite.config.doDeterministic = undefined;
+
+BenchmarkSuite.RunSuites({ NotifyResult: PrintResult,
+ NotifyError: PrintError });
diff --git a/src/v8/test/js-perf-test/Dates/run.js b/src/v8/test/js-perf-test/Dates/run.js
new file mode 100644
index 0000000..c57e569
--- /dev/null
+++ b/src/v8/test/js-perf-test/Dates/run.js
@@ -0,0 +1,20 @@
+// 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('../base.js');
+load('toLocaleString.js');
+
+function PrintResult(name, result) {
+ console.log(name);
+ console.log(name + '-Dates(Score): ' + result);
+}
+
+function PrintError(name, error) {
+ PrintResult(name, error);
+}
+
+BenchmarkSuite.config.doWarmup = undefined;
+BenchmarkSuite.config.doDeterministic = undefined;
+
+BenchmarkSuite.RunSuites({ NotifyResult: PrintResult,
+ NotifyError: PrintError });
diff --git a/src/v8/test/js-perf-test/Dates/toLocaleString.js b/src/v8/test/js-perf-test/Dates/toLocaleString.js
new file mode 100644
index 0000000..fd89a7c
--- /dev/null
+++ b/src/v8/test/js-perf-test/Dates/toLocaleString.js
@@ -0,0 +1,20 @@
+// 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 DateToLocaleDateString() {
+ let d = new Date();
+ d.toLocaleDateString()
+}
+createSuite('toLocaleDateString', 100000, DateToLocaleDateString, ()=>{});
+
+function DateToLocaleString() {
+ let d = new Date();
+ d.toLocaleString()
+}
+createSuite('toLocaleString', 100000, DateToLocaleString, ()=>{});
+
+function DateToLocaleTimeString() {
+ let d = new Date();
+ d.toLocaleTimeString()
+}
+createSuite('toLocaleTimeString', 100000, DateToLocaleTimeString, ()=>{});
diff --git a/src/v8/test/js-perf-test/Generators/generators.js b/src/v8/test/js-perf-test/Generators/generators.js
index d49dee3..b891f2a 100644
--- a/src/v8/test/js-perf-test/Generators/generators.js
+++ b/src/v8/test/js-perf-test/Generators/generators.js
@@ -67,7 +67,7 @@
// ----------------------------------------------------------------------------
function* multiples(x) {
- let skip = function.sent || 0;
+ let skip = 2;
let next = 0;
while (true) {
if (skip === 0) {
diff --git a/src/v8/test/js-perf-test/Inspector/debugger.js b/src/v8/test/js-perf-test/Inspector/debugger.js
index c2ec6d9..e9c8625 100644
--- a/src/v8/test/js-perf-test/Inspector/debugger.js
+++ b/src/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)
- ]);
+
+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 TearDown() {
+ SendMessage('Debugger.disable');
+}
+
+function DebuggerPaused() {
+ for (var i = 0; i < 10; ++i) {
+ debugger;
}
+}
- benchy('Debugger.paused', DebuggerPaused, Setup);
- benchy('Debugger.getPossibleBreakpoints',
- DebuggerGetPossibleBreakpoints,
- SetupGetPossibleBreakpoints);
- benchy('AsyncStacksInstrumentation',
- AsyncStacksInstrumentation,
- SetupAsyncStacksInstrumentation);
-
- function Setup() {
- SendMessage('Debugger.enable');
- // Force lazy compilation of inspector related scripts.
- SendMessage('Runtime.evaluate', {expression: ''});
- }
-
- function TearDown() {
- SendMessage('Debugger.disable');
- }
-
- 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;
}
- }
+ };
+ SendMessage('Runtime.evaluate', {expression});
+}
- 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});
- }
+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) %PerformMicrotaskCheckpoint();
+}
- 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/src/v8/test/js-perf-test/InterpreterEntryTrampoline/arguments.js b/src/v8/test/js-perf-test/InterpreterEntryTrampoline/arguments.js
new file mode 100644
index 0000000..2855fd4
--- /dev/null
+++ b/src/v8/test/js-perf-test/InterpreterEntryTrampoline/arguments.js
@@ -0,0 +1,119 @@
+// Copyright 2019 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 addBenchmark(name, test) {
+ new BenchmarkSuite(name, [1000],
+ [
+ new Benchmark(name, false, false, 0, test)
+ ]);
+}
+
+addBenchmark('Calls-No-Argument', callsNoArgument);
+addBenchmark('Calls-One-Argument', callsOneArgument);
+addBenchmark('Calls-Six-Arguments', callsSixArguments);
+addBenchmark('Calls-With-Receiver', callsWithReceiver);
+
+function callsNoArgument() {
+ function f() {
+ return 0;
+ }
+
+ for (var i = 0; i < 1000; ++i) {
+ f(); f(); f(); f(); f(); f(); f(); f(); f();
+ f(); f(); f(); f(); f(); f(); f(); f(); f();
+ f(); f(); f(); f(); f(); f(); f(); f(); f();
+ f(); f(); f(); f(); f(); f(); f(); f(); f();
+ f(); f(); f(); f(); f(); f(); f(); f(); f();
+ f(); f(); f(); f(); f(); f(); f(); f(); f();
+ f(); f(); f(); f(); f(); f(); f(); f(); f();
+ f(); f(); f(); f(); f(); f(); f(); f(); f();
+ f(); f(); f(); f(); f(); f(); f(); f(); f();
+ f(); f(); f(); f(); f(); f(); f(); f(); f();
+ f(); f(); f(); f(); f(); f(); f(); f(); f();
+ }
+}
+
+function callsOneArgument() {
+ function f(a) {
+ return a;
+ }
+ let z = 0;
+
+ for (var i = 0; i < 1000; ++i) {
+ f(z); f(z); f(z); f(z); f(z); f(z); f(z); f(z);
+ f(z); f(z); f(z); f(z); f(z); f(z); f(z); f(z);
+ f(z); f(z); f(z); f(z); f(z); f(z); f(z); f(z);
+ f(z); f(z); f(z); f(z); f(z); f(z); f(z); f(z);
+ f(z); f(z); f(z); f(z); f(z); f(z); f(z); f(z);
+ f(z); f(z); f(z); f(z); f(z); f(z); f(z); f(z);
+ f(z); f(z); f(z); f(z); f(z); f(z); f(z); f(z);
+ f(z); f(z); f(z); f(z); f(z); f(z); f(z); f(z);
+ f(z); f(z); f(z); f(z); f(z); f(z); f(z); f(z);
+ f(z); f(z); f(z); f(z); f(z); f(z); f(z); f(z);
+ f(z); f(z); f(z); f(z); f(z); f(z); f(z); f(z);
+ f(z); f(z); f(z); f(z); f(z); f(z); f(z); f(z);
+ }
+}
+
+function callsSixArguments() {
+ function g(a,b,c,d,e,f) {
+ return c;
+ }
+ let a = 0;
+ let b = 1;
+ let c = 2;
+ let d = 3;
+ let e = 4;
+ let f = 5;
+
+ for (var i = 0; i < 1000; ++i) {
+ g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f);
+ g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f);
+ g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f);
+ g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f);
+ g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f);
+ g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f);
+ g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f);
+ g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f);
+ g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f);
+ g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f);
+ g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f);
+ g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f);
+ g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f);
+ g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f);
+ g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f);
+ g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f);
+ g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f);
+ g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f);
+ g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f);
+ g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f);
+ g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f);
+ g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f);
+ g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f);
+ g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f);
+ }
+}
+
+function callsWithReceiver() {
+ function constructObject() {
+ this.f = function() {
+ return 0;
+ };
+ }
+ let o = new constructObject();
+
+ for (var i = 0; i < 1000; ++i) {
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ }
+}
diff --git a/src/v8/test/js-perf-test/InterpreterEntryTrampoline/locals.js b/src/v8/test/js-perf-test/InterpreterEntryTrampoline/locals.js
new file mode 100644
index 0000000..533cd6b
--- /dev/null
+++ b/src/v8/test/js-perf-test/InterpreterEntryTrampoline/locals.js
@@ -0,0 +1,326 @@
+// Copyright 2019 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 addBenchmark(name, test) {
+ new BenchmarkSuite(name, [1000],
+ [
+ new Benchmark(name, false, false, 0, test)
+ ]);
+}
+
+addBenchmark('Calls-No-Argument', callsNoArgument);
+addBenchmark('Calls-No-Argument-1-Local', callsNoArgument_OneLocal);
+addBenchmark('Calls-No-Argument-2-Locals', callsNoArgument_2Locals);
+addBenchmark('Calls-No-Argument-3-Locals', callsNoArgument_3Locals);
+addBenchmark('Calls-No-Argument-4-Locals', callsNoArgument_4Locals);
+addBenchmark('Calls-No-Argument-5-Locals', callsNoArgument_5Locals);
+addBenchmark('Calls-No-Argument-10-Locals', callsNoArgument_10Locals);
+addBenchmark('Calls-No-Argument-100-Locals', callsNoArgument_100Locals);
+
+
+function callsNoArgument() {
+ function f() {
+ return 0;
+ }
+
+ for (var i = 0; i < 1000; ++i) {
+ f(); f(); f(); f(); f(); f(); f(); f(); f();
+ f(); f(); f(); f(); f(); f(); f(); f(); f();
+ f(); f(); f(); f(); f(); f(); f(); f(); f();
+ f(); f(); f(); f(); f(); f(); f(); f(); f();
+ f(); f(); f(); f(); f(); f(); f(); f(); f();
+ f(); f(); f(); f(); f(); f(); f(); f(); f();
+ f(); f(); f(); f(); f(); f(); f(); f(); f();
+ f(); f(); f(); f(); f(); f(); f(); f(); f();
+ f(); f(); f(); f(); f(); f(); f(); f(); f();
+ f(); f(); f(); f(); f(); f(); f(); f(); f();
+ f(); f(); f(); f(); f(); f(); f(); f(); f();
+ }
+}
+
+function callsNoArgument_OneLocal() {
+ function constructObject() {
+ this.f = function() {
+ var x1 = 1;
+ return 0;
+ };
+ }
+ let o = new constructObject();
+
+ for (var i = 0; i < 1000; ++i) {
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ }
+}
+
+function callsNoArgument_2Locals() {
+ function constructObject() {
+ this.f = function() {
+ var x1 = 1;
+ var x2 = 2;
+ return 0;
+ };
+ }
+ let o = new constructObject();
+
+ for (var i = 0; i < 1000; ++i) {
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ }
+}
+
+function callsNoArgument_3Locals() {
+ function constructObject() {
+ this.f = function() {
+ var x1 = 1;
+ var x2 = 2;
+ var x3 = 3;
+ return 0;
+ };
+ }
+ let o = new constructObject();
+
+ for (var i = 0; i < 1000; ++i) {
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ }
+}
+
+function callsNoArgument_4Locals() {
+ function constructObject() {
+ this.f = function() {
+ var x1 = 1;
+ var x2 = 2;
+ var x3 = 3;
+ var x4 = 4;
+ return 0;
+ };
+ }
+ let o = new constructObject();
+
+ for (var i = 0; i < 1000; ++i) {
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ }
+}
+
+function callsNoArgument_5Locals() {
+ function constructObject() {
+ this.f = function() {
+ var x1 = 1;
+ var x2 = 2;
+ var x3 = 3;
+ var x4 = 4;
+ var x5 = 5;
+ return 0;
+ };
+ }
+ let o = new constructObject();
+
+ for (var i = 0; i < 1000; ++i) {
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ }
+}
+
+function callsNoArgument_10Locals() {
+ function constructObject() {
+ this.f = function() {
+ var x1 = 1;
+ var x2 = 2;
+ var x3 = 3;
+ var x4 = 4;
+ var x5 = 5;
+ var x6 = 6;
+ var x7 = 7;
+ var x8 = 8;
+ var x9 = 9;
+ var x10 = 10;
+ return 0;
+ };
+ }
+ let o = new constructObject();
+
+ for (var i = 0; i < 1000; ++i) {
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ }
+}
+
+function callsNoArgument_100Locals() {
+ function constructObject() {
+ this.f = function() {
+ var x1 = 1;
+ var x2 = 2;
+ var x3 = 3;
+ var x4 = 4;
+ var x5 = 5;
+ var x6 = 6;
+ var x7 = 7;
+ var x8 = 8;
+ var x9 = 9;
+ var x10 = 10;
+ var x11 = 11;
+ var x12 = 12;
+ var x13 = 13;
+ var x14 = 14;
+ var x15 = 15;
+ var x16 = 16;
+ var x17 = 17;
+ var x18 = 18;
+ var x19 = 19;
+ var x20 = 20;
+ var x21 = 21;
+ var x22 = 22;
+ var x23 = 23;
+ var x24 = 24;
+ var x25 = 25;
+ var x26 = 26;
+ var x27 = 27;
+ var x28 = 28;
+ var x29 = 29;
+ var x30 = 30;
+ var x31 = 31;
+ var x32 = 32;
+ var x33 = 33;
+ var x34 = 34;
+ var x35 = 35;
+ var x36 = 36;
+ var x37 = 37;
+ var x38 = 38;
+ var x39 = 39;
+ var x40 = 40;
+ var x41 = 41;
+ var x42 = 42;
+ var x43 = 43;
+ var x44 = 44;
+ var x45 = 45;
+ var x46 = 46;
+ var x47 = 47;
+ var x48 = 48;
+ var x49 = 49;
+ var x50 = 50;
+ var x51 = 51;
+ var x52 = 52;
+ var x53 = 53;
+ var x54 = 54;
+ var x55 = 55;
+ var x56 = 56;
+ var x57 = 57;
+ var x58 = 58;
+ var x59 = 59;
+ var x60 = 60;
+ var x61 = 61;
+ var x62 = 62;
+ var x63 = 63;
+ var x64 = 64;
+ var x65 = 65;
+ var x66 = 66;
+ var x67 = 67;
+ var x68 = 68;
+ var x69 = 69;
+ var x70 = 70;
+ var x71 = 71;
+ var x72 = 72;
+ var x73 = 73;
+ var x74 = 74;
+ var x75 = 75;
+ var x76 = 76;
+ var x77 = 77;
+ var x78 = 78;
+ var x79 = 79;
+ var x80 = 80;
+ var x81 = 81;
+ var x82 = 82;
+ var x83 = 83;
+ var x84 = 84;
+ var x85 = 85;
+ var x86 = 86;
+ var x87 = 87;
+ var x88 = 88;
+ var x89 = 89;
+ var x90 = 90;
+ var x91 = 91;
+ var x92 = 92;
+ var x93 = 93;
+ var x94 = 94;
+ var x95 = 95;
+ var x96 = 96;
+ var x97 = 97;
+ var x98 = 98;
+ var x99 = 99;
+ var x100 = 100;
+ return 0;
+ };
+ }
+ let o = new constructObject();
+
+ for (var i = 0; i < 1000; ++i) {
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
+ }
+}
diff --git a/src/v8/test/js-perf-test/InterpreterEntryTrampoline/run.js b/src/v8/test/js-perf-test/InterpreterEntryTrampoline/run.js
new file mode 100644
index 0000000..bd792c7
--- /dev/null
+++ b/src/v8/test/js-perf-test/InterpreterEntryTrampoline/run.js
@@ -0,0 +1,26 @@
+// Copyright 2019 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(arguments[0] + '.js');
+
+var success = true;
+
+function PrintResult(name, result) {
+ print(name + '-InterpreterEntryTrampoline(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/src/v8/test/js-perf-test/Intl/constructor.js b/src/v8/test/js-perf-test/Intl/constructor.js
new file mode 100644
index 0000000..72dc7e6
--- /dev/null
+++ b/src/v8/test/js-perf-test/Intl/constructor.js
@@ -0,0 +1,44 @@
+// Copyright 2019 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 NewIntlCollator() {
+ let obj = new Intl.Collator();
+}
+createSuite('NewIntlCollator', 100, NewIntlCollator, ()=>{});
+
+function NewIntlDateTimeFormat() {
+ let obj = new Intl.DateTimeFormat();
+}
+createSuite('NewIntlDateTimeFormat', 100, NewIntlDateTimeFormat, ()=>{});
+
+function NewIntlNumberFormat() {
+ let obj = new Intl.NumberFormat();
+}
+createSuite('NewIntlNumberFormat', 100, NewIntlNumberFormat, ()=>{});
+
+function NewIntlPluralRules() {
+ let obj = new Intl.PluralRules();
+}
+createSuite('NewIntlPluralRules', 100, NewIntlPluralRules, ()=>{});
+
+function NewIntlListFormat() {
+ let obj = new Intl.ListFormat();
+}
+createSuite('NewIntlListFormat', 100, NewIntlListFormat, ()=>{});
+
+function NewIntlRelativeTimeFormat() {
+ let obj = new Intl.RelativeTimeFormat();
+}
+createSuite('NewIntlRelativeTimeFormat', 100, NewIntlRelativeTimeFormat, ()=>{});
+
+function NewIntlLocaleWithOptions() {
+ let obj = new Intl.Locale("en-Latn-US-u-nu-thai",
+ { language: "zh", region: "TW", script: "Hant", calendar: "roc", collation: "zhuyin",
+ hourCycle: "h11", caseFirst: "upper", numberingSystem: "hanidec"});
+}
+createSuite('NewIntlLocaleWithOptions', 100, NewIntlLocaleWithOptions, ()=>{});
+
+function NewIntlLocale() {
+ let obj = new Intl.Locale("zh");
+}
+createSuite('NewIntlLocale', 100, NewIntlLocale, ()=>{});
diff --git a/src/v8/test/js-perf-test/Intl/run.js b/src/v8/test/js-perf-test/Intl/run.js
new file mode 100644
index 0000000..61ac92a
--- /dev/null
+++ b/src/v8/test/js-perf-test/Intl/run.js
@@ -0,0 +1,19 @@
+// Copyright 2019 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('constructor.js');
+
+function PrintResult(name, result) {
+ console.log(name + '-Intl(Score): ' + result);
+}
+
+function PrintError(name, error) {
+ PrintResult(name, error);
+}
+
+BenchmarkSuite.config.doWarmup = undefined;
+BenchmarkSuite.config.doDeterministic = undefined;
+
+BenchmarkSuite.RunSuites({ NotifyResult: PrintResult,
+ NotifyError: PrintError });
diff --git a/src/v8/test/js-perf-test/JSTests1.json b/src/v8/test/js-perf-test/JSTests1.json
new file mode 100644
index 0000000..9ac44cd
--- /dev/null
+++ b/src/v8/test/js-perf-test/JSTests1.json
@@ -0,0 +1,280 @@
+{
+ "owners": ["jarin@chromium.org", "mvstanton@chromium.org"],
+ "name": "JSTests",
+ "run_count": 3,
+ "run_count_arm": 1,
+ "run_count_arm64": 1,
+ "timeout": 120,
+ "timeout_arm64": 240,
+ "units": "score",
+ "total": true,
+ "resources": ["base.js"],
+ "tests": [
+ {
+ "name": "Collections",
+ "path": ["Collections"],
+ "main": "run.js",
+ "resources": [
+ "common.js",
+ "map.js",
+ "run.js",
+ "set.js",
+ "weakmap.js",
+ "weakset.js"
+ ],
+ "results_regexp": "^%s\\-Collections\\(Score\\): (.+)$",
+ "tests": [
+ {"name": "Map-Smi"},
+ {"name": "Map-String"},
+ {"name": "Map-Object"},
+ {"name": "Map-Object-Set-Get-Large"},
+ {"name": "Map-Double"},
+ {"name": "Map-Iteration"},
+ {"name": "Map-Iterator"},
+ {"name": "Set-Smi"},
+ {"name": "Set-String"},
+ {"name": "Set-Object"},
+ {"name": "Set-Double"},
+ {"name": "Set-Iteration"},
+ {"name": "Set-Iterator"},
+ {"name": "WeakMap"},
+ {"name": "WeakMap-Constructor"},
+ {"name": "WeakMapSetGet-Large"},
+ {"name": "WeakMapSet-Huge"},
+ {"name": "WeakSet"},
+ {"name": "WeakSet-Constructor"}
+ ]
+ },
+ {
+ "name": "BigInt",
+ "path": ["BigInt"],
+ "main": "run.js",
+ "resources": [
+ "bigint-util.js",
+ "test-config.js",
+ "to-boolean.js",
+ "add.js",
+ "as-uint-n.js"
+ ],
+ "results_regexp": "^%s\\-BigInt\\(Score\\): (.+)$",
+ "tests": [
+ { "name": "BigInt-ToBoolean" },
+ { "name": "BigInt-BooleanConstructor" },
+ { "name": "BigInt-NewBooleanConstructor" },
+ { "name": "Add-TypeError" },
+ { "name": "Add-Zero" },
+ { "name": "Add-SameSign-32" },
+ { "name": "Add-DifferentSign-32" },
+ { "name": "Add-SameSign-64" },
+ { "name": "Add-DifferentSign-64" },
+ { "name": "Add-SameSign-128" },
+ { "name": "Add-DifferentSign-128" },
+ { "name": "Add-SameSign-256" },
+ { "name": "Add-DifferentSign-256" },
+ { "name": "Add-SameSign-512" },
+ { "name": "Add-DifferentSign-512" },
+ { "name": "Add-SameSign-1024" },
+ { "name": "Add-DifferentSign-1024" },
+ { "name": "Add-SameSign-2048" },
+ { "name": "Add-DifferentSign-2048" },
+ { "name": "Add-SameSign-4096" },
+ { "name": "Add-DifferentSign-4096" },
+ { "name": "Add-SameSign-8192" },
+ { "name": "Add-DifferentSign-8192" },
+ { "name": "Add-Random" },
+ { "name": "AsUint64-32" },
+ { "name": "AsUint64-64" },
+ { "name": "AsUint64-128" },
+ { "name": "AsUint64-256" },
+ { "name": "AsUint32-32" },
+ { "name": "AsUint32-64" },
+ { "name": "AsUint32-128" },
+ { "name": "AsUint32-256" },
+ { "name": "AsUint8-32" },
+ { "name": "AsUint8-64" },
+ { "name": "AsUint8-128" },
+ { "name": "AsUint8-256" }
+ ]
+ },
+ {
+ "name": "BigInt-Jitless",
+ "path": ["BigInt"],
+ "main": "run.js",
+ "resources": [
+ "to-boolean.js"
+ ],
+ "flags": ["--jitless"],
+ "results_regexp": "^%s\\-BigInt\\(Score\\): (.+)$",
+ "tests": [
+ { "name": "BigInt-ToBoolean" },
+ { "name": "BigInt-BooleanConstructor" },
+ { "name": "BigInt-NewBooleanConstructor" }
+ ]
+ },
+ {
+ "name": "TypedArrays",
+ "path": ["TypedArrays"],
+ "results_regexp": "^TypedArrays\\-%s\\(Score\\): (.+)$",
+ "tests": [
+ {
+ "name": "CopyWithin",
+ "main": "run.js",
+ "resources": ["copywithin.js"],
+ "test_flags": ["copywithin"]
+ },
+ {
+ "name": "Constructor",
+ "main": "run.js",
+ "resources": ["constructor.js"],
+ "test_flags": ["constructor"]
+ },
+ {
+ "name": "ConstructWithBuffer",
+ "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": "ConstructByTypedArray",
+ "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": "FilterNoSpecies",
+ "main": "run.js",
+ "resources": ["filter-nospecies.js"],
+ "test_flags": ["filter-nospecies"],
+ "results_regexp": "^TypedArrays\\-%s\\(Score\\): (.+)$",
+ "tests": [
+ {"name": "Uint8Array"},
+ {"name": "Uint16Array"},
+ {"name": "Uint32Array"},
+ {"name": "Float32Array"},
+ {"name": "Float64Array"}
+ ]
+ },
+ {
+ "name": "JoinBigIntTypes",
+ "main": "run.js",
+ "resources": ["base.js", "join.js", "join-bigint.js"],
+ "test_flags": ["join-bigint"]
+ },
+ {
+ "name": "JoinFloatTypes",
+ "main": "run.js",
+ "resources": ["base.js", "join.js", "join-float.js"],
+ "test_flags": ["join-float"]
+ },
+ {
+ "name": "JoinIntTypes",
+ "main": "run.js",
+ "resources": ["base.js", "join.js", "join-int.js"],
+ "test_flags": ["join-int"]
+ },
+ {
+ "name": "JoinWithSeparatorBigIntTypes",
+ "main": "run.js",
+ "resources": ["base.js", "join.js", "join-sep-bigint.js"],
+ "test_flags": ["join-sep-bigint"]
+ },
+ {
+ "name": "JoinWithSeparatorFloatTypes",
+ "main": "run.js",
+ "resources": ["base.js", "join.js", "join-sep-float.js"],
+ "test_flags": ["join-sep-float"]
+ },
+ {
+ "name": "JoinWithSeparatorIntTypes",
+ "main": "run.js",
+ "resources": ["base.js", "join.js", "join-sep-int.js"],
+ "test_flags": ["join-sep-int"]
+ },
+ {
+ "name": "SetFromArrayLike",
+ "main": "run.js",
+ "resources": ["set-from-arraylike.js"],
+ "test_flags": ["set-from-arraylike"]
+ },
+ {
+ "name": "SetFromDifferentType",
+ "main": "run.js",
+ "resources": ["set-from-different-type.js"],
+ "test_flags": ["set-from-different-type"]
+ },
+ {
+ "name": "SetFromSameType",
+ "main": "run.js",
+ "resources": ["set-from-same-type.js"],
+ "test_flags": ["set-from-same-type"]
+ },
+ {
+ "name": "SliceNoSpecies",
+ "main": "run.js",
+ "resources": ["slice-nospecies.js"],
+ "test_flags": ["slice-nospecies"]
+ },
+ {
+ "name": "SortIntTypes",
+ "main": "run.js",
+ "resources": ["base.js", "sort.js", "sort-int.js"],
+ "test_flags": ["sort-int"]
+ },
+ {
+ "name": "SortBigIntTypes",
+ "main": "run.js",
+ "resources": ["base.js", "sort.js", "sort-bigint.js"],
+ "test_flags": ["sort-bigint"]
+ },
+ {
+ "name": "SortFloatTypes",
+ "main": "run.js",
+ "resources": ["base.js", "sort.js", "sort-float.js"],
+ "test_flags": ["sort-float"]
+ },
+ {
+ "name": "SortCustomCompareFnIntTypes",
+ "main": "run.js",
+ "resources": ["base.js", "sort.js", "sort-cmpfn-int.js"],
+ "test_flags": ["sort-cmpfn-int"]
+ },
+ {
+ "name": "SortCustomCompareFnBigIntTypes",
+ "main": "run.js",
+ "resources": ["base.js", "sort.js", "sort-cmpfn-bigint.js"],
+ "test_flags": ["sort-cmpfn-bigint"]
+ },
+ {
+ "name": "SortCustomCompareFnFloatTypes",
+ "main": "run.js",
+ "resources": ["base.js", "sort.js", "sort-cmpfn-float.js"],
+ "test_flags": ["sort-cmpfn-float"]
+ },
+ {
+ "name": "SubarrayNoSpecies",
+ "main": "run.js",
+ "resources": ["subarray-nospecies.js"],
+ "test_flags": ["subarray-nospecies"]
+ }
+ ]
+ }
+ ]
+}
diff --git a/src/v8/test/js-perf-test/JSTests2.json b/src/v8/test/js-perf-test/JSTests2.json
new file mode 100644
index 0000000..0933c7d
--- /dev/null
+++ b/src/v8/test/js-perf-test/JSTests2.json
@@ -0,0 +1,188 @@
+{
+ "owners": ["jarin@chromium.org", "mvstanton@chromium.org"],
+ "name": "JSTests",
+ "run_count": 3,
+ "run_count_arm": 1,
+ "run_count_arm64": 1,
+ "timeout": 120,
+ "timeout_arm64": 240,
+ "units": "score",
+ "total": true,
+ "resources": ["base.js"],
+ "tests": [
+ {
+ "name": "ArrayLiteralInitialSpreadSmallPacked",
+ "path": ["ArrayLiteralInitialSpreadSmallPacked"],
+ "main": "run.js",
+ "resources": [],
+ "results_regexp": "^%s\\-ArrayLiteralInitialSpreadSmallPacked\\(Score\\): (.+)$",
+ "tests": [
+ {"name": "Spread"},
+ {"name": "ForLength"},
+ {"name": "ForLengthEmpty"},
+ {"name": "Slice"},
+ {"name": "Slice0"},
+ {"name": "ConcatReceive"},
+ {"name": "ConcatArg"},
+ {"name": "ForOfPush"},
+ {"name": "MapId"}
+ ]
+ },
+ {
+ "name": "PropertyQueries",
+ "path": ["PropertyQueries"],
+ "main": "run.js",
+ "resources": ["property-queries.js"],
+ "results_regexp": "^%s\\-PropertyQueries\\(Score\\): (.+)$",
+ "tests": [
+ {"name": "in--INTERN-prop"},
+ {"name": "in--DEINTERN-prop"},
+ {"name": "in--NE-INTERN-prop"},
+ {"name": "in--NE-DEINTERN-prop"},
+ {"name": "in--el"},
+ {"name": "in--el-str"},
+ {"name": "in--NE-el"},
+ {"name": "Object.hasOwnProperty--INTERN-prop"},
+ {"name": "Object.hasOwnProperty--DEINTERN-prop"},
+ {"name": "Object.hasOwnProperty--NE-INTERN-prop"},
+ {"name": "Object.hasOwnProperty--NE-DEINTERN-prop"},
+ {"name": "Object.hasOwnProperty--el"},
+ {"name": "Object.hasOwnProperty--el-str"},
+ {"name": "Object.hasOwnProperty--NE-el"}
+ ]
+ },
+ {
+ "name": "Array",
+ "path": ["Array"],
+ "timeout": 180,
+ "timeout_arm64": 360,
+ "main": "run.js",
+ "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", "slice.js", "copy-within.js"
+ ],
+ "flags": [
+ "--allow-natives-syntax"
+ ],
+ "results_regexp": "^%s\\-Array\\(Score\\): (.+)$",
+ "tests": [
+ {"name": "NaiveForEachReplacement"},
+ {"name": "DoubleForEach"},
+ {"name": "SmiForEach"},
+ {"name": "FastForEach"},
+ {"name": "GenericForEach"},
+ {"name": "OptFastForEach"},
+ {"name": "OptUnreliableForEach"},
+ {"name": "NaiveFilterReplacement"},
+ {"name": "DoubleFilter"},
+ {"name": "SmiFilter"},
+ {"name": "FastFilter"},
+ {"name": "GenericFilter"},
+ {"name": "OptFastFilter"},
+ {"name": "OptUnreliableFilter"},
+ {"name": "NaiveMapReplacement"},
+ {"name": "DoubleMap"},
+ {"name": "SmiMap"},
+ {"name": "FastMap"},
+ {"name": "GenericMap"},
+ {"name": "OptFastMap"},
+ {"name": "OptUnreliableMap"},
+ {"name": "DoubleEvery"},
+ {"name": "SmiEvery"},
+ {"name": "FastEvery"},
+ {"name": "OptFastEvery"},
+ {"name": "OptUnreliableEvery"},
+ {"name": "SmiJoin"},
+ {"name": "StringJoin"},
+ {"name": "SparseSmiJoin"},
+ {"name": "SparseStringJoin"},
+ {"name": "DoubleSome"},
+ {"name": "SmiSome"},
+ {"name": "FastSome"},
+ {"name": "OptFastSome"},
+ {"name": "OptUnreliableSome"},
+ {"name": "DoubleReduce"},
+ {"name": "SmiReduce"},
+ {"name": "FastReduce"},
+ {"name": "OptFastReduce"},
+ {"name": "OptUnreliableReduce"},
+ {"name": "DoubleReduceRight"},
+ {"name": "SmiReduceRight"},
+ {"name": "FastReduceRight"},
+ {"name": "OptFastReduceRight"},
+ {"name": "OptUnreliableReduceRight"},
+ {"name": "SmiToString"},
+ {"name": "StringToString"},
+ {"name": "SparseSmiToString"},
+ {"name": "SparseStringToString"},
+ {"name": "NaiveFindReplacement"},
+ {"name": "DoubleFind"},
+ {"name": "SmiFind"},
+ {"name": "FastFind"},
+ {"name": "GenericFind"},
+ {"name": "OptFastFind"},
+ {"name": "OptUnreliableFind"},
+ {"name": "NaiveFindIndexReplacement"},
+ {"name": "DoubleFindIndex"},
+ {"name": "SmiFindIndex"},
+ {"name": "FastFindIndex"},
+ {"name": "GenericFindIndex"},
+ {"name": "OptFastFindIndex"},
+ {"name": "OptUnreliableFindIndex"},
+ {"name": "EmptyArrayOf"},
+ {"name": "SmallSmiArrayOf"},
+ {"name": "LargeSmiArrayOf"},
+ {"name": "SmallTransplantedArrayOf"},
+ {"name": "SmallDoubleArrayOf"},
+ {"name": "SmallStringArrayOf"},
+ {"name": "SmallMixedArrayOf"},
+ {"name": "SmiFrom"},
+ {"name": "SmallSmiFrom"},
+ {"name": "SmiCowNoMapFrom"},
+ {"name": "SmiNonCowNoMapFrom"},
+ {"name": "SmiNoIteratorFrom"},
+ {"name": "TransplantedFrom"},
+ {"name": "DoubleFrom"},
+ {"name": "DoubleNoMapFrom"},
+ {"name": "StringFrom"},
+ {"name": "StringCowNoMapFrom"},
+ {"name": "StringNonCowNoMapFrom"},
+ {"name": "MixedFrom"},
+ {"name": "MixedCowNoMapFrom"},
+ {"name": "MixedNonCowNoMapFrom"},
+ {"name": "Array.slice(0)"},
+ {"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(0)-dict"},
+ {"name": "Array.slice(500,999)-dict"},
+ {"name": "Array.slice(200,700)-dict"},
+ {"name": "Array.slice(200,-300)-dict"},
+ {"name": "Array.slice(4,1)-dict"},
+ {"name": "Array.slice(0)-double"},
+ {"name": "Array.slice(500,999)-double"},
+ {"name": "Array.slice(200,700)-double"},
+ {"name": "Array.slice(200,-300)-double"},
+ {"name": "Array.slice(4,1)-double"},
+ {"name": "Array.slice(0)-object"},
+ {"name": "Array.slice(500,999)-object"},
+ {"name": "Array.slice(200,700)-object"},
+ {"name": "Array.slice(200,-300)-object"},
+ {"name": "Array.slice(4,1)-object"},
+ {"name": "Array.slice(0)-sloppy-args"},
+ {"name": "Array.slice(500,999)-sloppy-args"},
+ {"name": "Array.slice(200,700)-sloppy-args"},
+ {"name": "Array.slice(200,-300)-sloppy-args"},
+ {"name": "Array.slice(4,1)-sloppy-args"},
+ {"name": "SmiCopyWithin"},
+ {"name": "StringCopyWithin"},
+ {"name": "SparseSmiCopyWithin"},
+ {"name": "SparseStringCopyWithin"}
+ ]
+ }
+ ]
+}
diff --git a/src/v8/test/js-perf-test/JSTests3.json b/src/v8/test/js-perf-test/JSTests3.json
new file mode 100644
index 0000000..598e9fc
--- /dev/null
+++ b/src/v8/test/js-perf-test/JSTests3.json
@@ -0,0 +1,415 @@
+{
+ "owners": ["jarin@chromium.org", "mvstanton@chromium.org"],
+ "name": "JSTests",
+ "run_count": 3,
+ "run_count_arm": 1,
+ "run_count_arm64": 1,
+ "timeout": 120,
+ "timeout_arm64": 240,
+ "units": "score",
+ "total": true,
+ "resources": ["base.js"],
+ "tests": [
+ {
+ "name": "ArrayLiteralInitialSpreadSmallDoubleHoley",
+ "path": ["ArrayLiteralInitialSpreadSmallDoubleHoley"],
+ "main": "run.js",
+ "resources": [],
+ "results_regexp": "^%s\\-ArrayLiteralInitialSpreadSmallDoubleHoley\\(Score\\): (.+)$",
+ "tests": [
+ {"name": "Spread"},
+ {"name": "ForLength"},
+ {"name": "ForLengthEmpty"},
+ {"name": "Slice"},
+ {"name": "Slice0"},
+ {"name": "ConcatReceive"},
+ {"name": "ConcatArg"},
+ {"name": "ForOfPush"},
+ {"name": "MapId"}
+ ]
+ },
+ {
+ "name": "Strings",
+ "path": ["Strings"],
+ "run_count": 1,
+ "timeout": 240,
+ "timeout_arm": 420,
+ "units": "score",
+ "tests": [
+ {
+ "name": "StringFunctions",
+ "main": "run.js",
+ "resources": [ "harmony-string.js" ],
+ "test_flags": [ "harmony-string" ],
+ "results_regexp": "^%s\\-Strings\\(Score\\): (.+)$",
+ "run_count": 1,
+ "tests": [
+ {"name": "StringRepeat"},
+ {"name": "StringStartsWith"},
+ {"name": "StringEndsWith"},
+ {"name": "StringIncludes"},
+ {"name": "StringFromCodePoint"},
+ {"name": "StringCodePointAt"},
+ {"name": "StringCodePointAtSum"}
+ ]
+ },
+ {
+ "name": "StringIndexOf",
+ "main": "run.js",
+ "resources": [ "string-indexof.js" ],
+ "test_flags": [ "string-indexof" ],
+ "results_regexp": "^%s\\-Strings\\(Score\\): (.+)$",
+ "run_count": 1,
+ "tests": [
+ {"name": "StringIndexOfConstant"},
+ {"name": "StringIndexOfNonConstant"}
+ ]
+ },
+ {
+ "name": "StringSplit",
+ "main": "run.js",
+ "resources": [ "string-split.js" ],
+ "test_flags": [ "string-split" ],
+ "results_regexp": "^%s\\-Strings\\(Score\\): (.+)$",
+ "run_count": 1,
+ "tests": [
+ {"name": "ShortSubjectEmptySeparator"},
+ {"name": "LongSubjectEmptySeparator"},
+ {"name": "ShortTwoBytesSubjectEmptySeparator"},
+ {"name": "LongTwoBytesSubjectEmptySeparator"},
+ {"name": "ShortSubject"},
+ {"name": "LongSubject"},
+ {"name": "ShortTwoBytesSubject"},
+ {"name": "LongTwoBytesSubject"}
+ ]
+ },
+ {
+ "name": "StringAt",
+ "main": "run.js",
+ "resources": [ "string-stringat.js" ],
+ "test_flags": [ "string-stringat" ],
+ "results_regexp": "^%s\\-Strings\\(Score\\): (.+)$",
+ "run_count": 1,
+ "tests": [
+ {"name": "StringCharCodeAtConstant"},
+ {"name": "StringCharCodeAtNonConstant"},
+ {"name": "StringCharCodeAtConstantInbounds"},
+ {"name": "StringCharCodeAtNonConstantInbounds"},
+ {"name": "StringCodePointAtConstant"},
+ {"name": "StringCodePointAtNonConstant"},
+ {"name": "StringCodePointAtConstantInbounds"},
+ {"name": "StringCodePointAtNonConstantInbounds"}
+ ]
+ },
+ {
+ "name": "StringAtComparison",
+ "main": "run.js",
+ "resources": [ "string-stringat-comp.js" ],
+ "test_flags": [ "string-stringat-comp" ],
+ "results_regexp": "^%s\\-Strings\\(Score\\): (.+)$",
+ "run_count": 1,
+ "tests": [
+ {"name": "charCodeAt_const"},
+ {"name": "charCodeAt_both"},
+ {"name": "charAt_const"},
+ {"name": "charAt_never"},
+ {"name": "charAt_both"},
+ {"name": "stringIndex_const"}
+ ]
+ },
+ {
+ "name": "StringNormalize",
+ "main": "run.js",
+ "resources": [ "string-normalize.js" ],
+ "test_flags": [ "string-normalize" ],
+ "results_regexp": "^%s\\-Strings\\(Score\\): (.+)$",
+ "run_count": 1,
+ "tests": [
+ {"name": "StringNormalize"},
+ {"name": "StringNormalizeNFD"},
+ {"name": "StringNormalizeNFKC"},
+ {"name": "StringNormalizeNFKD"}
+ ]
+ },
+ {
+ "name": "StringLocaleCompare",
+ "main": "run.js",
+ "resources": [ "string-localeCompare.js" ],
+ "test_flags": [ "string-localeCompare" ],
+ "results_regexp": "^%s\\-Strings\\(Score\\): (.+)$",
+ "run_count": 1,
+ "tests": [
+ {"name": "StringLocaleCompare"}
+ ]
+ },
+ {
+ "name": "StringToLocaleCase",
+ "main": "run.js",
+ "resources": [ "string-toLocaleCase.js" ],
+ "test_flags": [ "string-toLocaleCase" ],
+ "results_regexp": "^%s\\-Strings\\(Score\\): (.+)$",
+ "run_count": 1,
+ "tests": [
+ {"name": "StringToLocaleLowerCase"},
+ {"name": "StringToLocaleUpperCase"},
+ {"name": "StringToLocaleLowerCaseTR"},
+ {"name": "StringToLocaleUpperCaseTR"}
+ ]
+ },
+ {
+ "name": "StringMatchAll",
+ "main": "run.js",
+ "resources": [ "string-matchall.js" ],
+ "test_flags": [ "string-matchall" ],
+ "results_regexp": "^%s\\-Strings\\(Score\\): (.+)$",
+ "run_count": 1,
+ "tests": [
+ {"name": "StringMatchAllBuiltinRegExpIteratorCreation"},
+ {"name": "StringMatchAllBuiltinStringIteratorCreation"},
+ {"name": "StringMatchAllBuiltinString"},
+ {"name": "StringMatchAllManualString"},
+ {"name": "StringMatchAllBuiltinRegExp"},
+ {"name": "StringMatchAllManualRegExp"},
+ {"name": "StringMatchAllBuiltinZeroWidth"},
+ {"name": "StringMatchAllBuiltinZeroWidthUnicode"}
+ ]
+ },
+ {
+ "name": "StringStartsEndsWithComparison",
+ "main": "run.js",
+ "resources": [ "string-startsendswith-comp.js" ],
+ "test_flags": [ "string-startsendswith-comp" ],
+ "results_regexp": "^%s\\-Strings\\(Score\\): (.+)$",
+ "run_count": 1,
+ "tests": [
+ {"name": "startsWith"},
+ {"name": "startsIndex"},
+ {"name": "endsWith"},
+ {"name": "endsIndex"}
+ ]
+ },
+ {
+ "name": "StringStartsWith",
+ "main": "run.js",
+ "resources": [ "string-startswith.js" ],
+ "test_flags": [ "string-startswith" ],
+ "results_regexp": "^%s\\-Strings\\(Score\\): (.+)$",
+ "run_count": 1,
+ "flags": [ "--allow-natives-syntax" ],
+ "tests": [
+ {"name": "DirectStringsDirectSearch"},
+ {"name": "ConsStringsDirectSearch"},
+ {"name": "DirectStringsConsSearch"},
+ {"name": "ConsStringsConsSearch"}
+ ]
+ },
+ {
+ "name": "StringSubstring",
+ "main": "run.js",
+ "resources": [ "string-substring.js" ],
+ "test_flags": [ "string-substring" ],
+ "results_regexp": "^%s\\-Strings\\(Score\\): (.+)$",
+ "run_count": 1,
+ "tests": [
+ {"name": "StringDropFirstSlice"},
+ {"name": "StringDropFirstSubstr"},
+ {"name": "StringDropFirstSubstring"},
+ {"name": "StringTakeFirstSlice"},
+ {"name": "StringTakeFirstSubstr"},
+ {"name": "StringTakeFirstSubstring"},
+ {"name": "StringDropLastSlice"},
+ {"name": "StringDropLastSubstr"},
+ {"name": "StringDropLastSubstring"},
+ {"name": "StringTakeLastSlice"},
+ {"name": "StringTakeLastSubstr"},
+ {"name": "StringTakeLastSubstring"}
+ ]
+ }
+ ]
+ },
+ {
+ "name": "BytecodeHandlers",
+ "path": ["BytecodeHandlers"],
+ "flags": [ "--no-opt" ],
+ "tests": [
+ {
+ "name": "Compare",
+ "main": "run.js",
+ "resources": [ "compare.js" ],
+ "test_flags": [ "compare" ],
+ "results_regexp": "^%s\\-BytecodeHandler\\(Score\\): (.+)$",
+ "tests": [
+ {"name": "Smi-StrictEquals-True"},
+ {"name": "Smi-StrictEquals-False"},
+ {"name": "Number-StrictEquals-True"},
+ {"name": "Number-StrictEquals-False"},
+ {"name": "String-StrictEquals-True"},
+ {"name": "String-StrictEquals-False"},
+ {"name": "SmiString-StrictEquals"},
+ {"name": "Smi-Equals-True"},
+ {"name": "Smi-Equals-False"},
+ {"name": "Number-Equals-True"},
+ {"name": "Number-Equals-False"},
+ {"name": "String-Equals-True"},
+ {"name": "String-Equals-False"},
+ {"name": "ObjectNull-Equals"},
+ {"name": "SmiString-Equals"},
+ {"name": "Smi-RelationalCompare"},
+ {"name": "Number-RelationalCompare"},
+ {"name": "String-RelationalCompare"},
+ {"name": "SmiString-RelationalCompare"}
+ ]
+ },
+ {
+ "name": "StringConcat",
+ "main": "run.js",
+ "resources": [ "string-concat.js" ],
+ "test_flags": [ "string-concat" ],
+ "results_regexp": "^%s\\-BytecodeHandler\\(Score\\): (.+)$",
+ "tests": [
+ {"name": "ShortString-StringConcat-2"},
+ {"name": "ShortString-StringConcat-3"},
+ {"name": "ShortString-StringConcat-5"},
+ {"name": "ShortString-StringConcat-10"},
+ {"name": "LongString-StringConcat-2"},
+ {"name": "LongString-StringConcat-3"},
+ {"name": "LongString-StringConcat-5"},
+ {"name": "LongString-StringConcat-10"},
+ {"name": "NumberString-StringConcat-2"},
+ {"name": "NumberString-StringConcat-3"},
+ {"name": "NumberString-StringConcat-5"},
+ {"name": "NumberString-StringConcat-10"}
+ ]
+ },
+ {
+ "name": "Arithmetic",
+ "main": "run.js",
+ "resources": [ "arithmetic.js" ],
+ "test_flags": [ "arithmetic" ],
+ "results_regexp": "^%s\\-BytecodeHandler\\(Score\\): (.+)$",
+ "timeout": 240,
+ "tests": [
+ {"name": "Smi-Add"},
+ {"name": "Number-Add"},
+ {"name": "Number-Oddball-Add"},
+ {"name": "String-Add"},
+ {"name": "Object-Add"},
+ {"name": "Number-String-Add"},
+ {"name": "Smi-Sub"},
+ {"name": "Number-Sub"},
+ {"name": "Number-Oddball-Sub"},
+ {"name": "Object-Sub"},
+ {"name": "Smi-Mul"},
+ {"name": "Number-Mul"},
+ {"name": "Number-Oddball-Mul"},
+ {"name": "Object-Mul"},
+ {"name": "Smi-Div"},
+ {"name": "Number-Div"},
+ {"name": "Number-Oddball-Div"},
+ {"name": "Object-Div"},
+ {"name": "Smi-Mod"},
+ {"name": "Number-Mod"},
+ {"name": "Number-Oddball-Mod"},
+ {"name": "Object-Mod"},
+ {"name": "Smi-Constant-Add"},
+ {"name": "Smi-Constant-Sub"},
+ {"name": "Smi-Constant-Mul"},
+ {"name": "Smi-Constant-Div"},
+ {"name": "Smi-Constant-Mod"},
+ {"name": "Smi-Increment"},
+ {"name": "Number-Increment"},
+ {"name": "Smi-Decrement"},
+ {"name": "Number-Decrement"}
+ ]
+ },
+ {
+ "name": "Bitwise",
+ "main": "run.js",
+ "resources": [ "bitwise.js" ],
+ "test_flags": [ "bitwise" ],
+ "results_regexp": "^%s\\-BytecodeHandler\\(Score\\): (.+)$",
+ "tests": [
+ {"name": "Smi-Or"},
+ {"name": "Number-Or"},
+ {"name": "Smi-Xor"},
+ {"name": "Number-Xor"},
+ {"name": "Smi-And"},
+ {"name": "Number-And"},
+ {"name": "Smi-Constant-Or"},
+ {"name": "Smi-Constant-Xor"},
+ {"name": "Smi-Constant-And"},
+ {"name": "Smi-ShiftLeft"},
+ {"name": "Number-ShiftLeft"},
+ {"name": "Smi-ShiftRight"},
+ {"name": "Number-ShiftRight"},
+ {"name": "Smi-ShiftRightLogical"},
+ {"name": "Number-ShiftRightLogical"},
+ {"name": "Smi-Constant-ShiftLeft"},
+ {"name": "Smi-Constant-ShiftRight"},
+ {"name": "Smi-Constant-ShiftRightLogical"}
+ ]
+ },
+ {
+ "name": "LdaNamedProperty",
+ "main": "run.js",
+ "resources": [ "LdaNamedProperty.js" ],
+ "test_flags": [ "LdaNamedProperty" ],
+ "results_regexp": "^%s\\-BytecodeHandler\\(Score\\): (.+)$",
+ "tests": [
+ {"name": "Smi-Value"},
+ {"name": "Prototype-Chain-Value"}
+ ]
+ },
+ {
+ "name": "LdaKeyedProperty",
+ "main": "run.js",
+ "resources": [ "LdaKeyedProperty.js" ],
+ "test_flags": [ "LdaKeyedProperty" ],
+ "results_regexp": "^%s\\-BytecodeHandler\\(Score\\): (.+)$",
+ "tests": [
+ {"name": "Object-Lookup-String-Constant"},
+ {"name": "Object-Lookup-Index-Number"},
+ {"name": "Object-Lookup-Index-String"}
+ ]
+ }
+ ]
+ },
+ {
+ "name": "InterpreterEntryTrampoline",
+ "path": ["InterpreterEntryTrampoline"],
+ "flags": ["--no-opt"],
+ "tests": [
+ {
+ "name": "Arguments",
+ "main": "run.js",
+ "resources": [ "arguments.js" ],
+ "test_flags": [ "arguments" ],
+ "results_regexp": "^%s\\-InterpreterEntryTrampoline\\(Score\\): (.+)$",
+ "tests": [
+ {"name": "Calls-No-Argument"},
+ {"name": "Calls-One-Argument"},
+ {"name": "Calls-Six-Arguments"},
+ {"name": "Calls-With-Receiver"}
+ ]
+ },
+ {
+ "name": "Locals",
+ "main": "run.js",
+ "resources": [ "locals.js" ],
+ "test_flags": [ "locals" ],
+ "results_regexp": "^%s\\-InterpreterEntryTrampoline\\(Score\\): (.+)$",
+ "tests": [
+ {"name": "Calls-No-Argument"},
+ {"name": "Calls-No-Argument-1-Local"},
+ {"name": "Calls-No-Argument-2-Locals"},
+ {"name": "Calls-No-Argument-3-Locals"},
+ {"name": "Calls-No-Argument-4-Locals"},
+ {"name": "Calls-No-Argument-5-Locals"},
+ {"name": "Calls-No-Argument-10-Locals"},
+ {"name": "Calls-No-Argument-100-Locals"}
+ ]
+ }
+ ]
+ }
+ ]
+}
diff --git a/src/v8/test/js-perf-test/JSTests4.json b/src/v8/test/js-perf-test/JSTests4.json
new file mode 100644
index 0000000..42cbaba
--- /dev/null
+++ b/src/v8/test/js-perf-test/JSTests4.json
@@ -0,0 +1,199 @@
+{
+ "owners": ["jarin@chromium.org", "mvstanton@chromium.org"],
+ "name": "JSTests",
+ "run_count": 3,
+ "run_count_arm": 1,
+ "run_count_arm64": 1,
+ "timeout": 120,
+ "timeout_arm64": 240,
+ "units": "score",
+ "total": true,
+ "resources": ["base.js"],
+ "tests": [
+ {
+ "name": "Proxies",
+ "path": ["Proxies"],
+ "main": "run.js",
+ "resources": ["proxies.js"],
+ "results_regexp": "^%s\\-Proxies\\(Score\\): (.+)$",
+ "tests": [
+ {"name": "GetStringWithoutTrap"},
+ {"name": "GetStringWithTrap"},
+ {"name": "GetIndexWithoutTrap"},
+ {"name": "GetIndexWithTrap"},
+ {"name": "GetSymbolWithoutTrap"},
+ {"name": "GetSymbolWithTrap"},
+ {"name": "HasStringWithoutTrap"},
+ {"name": "HasStringWithTrap"},
+ {"name": "HasSymbolWithoutTrap"},
+ {"name": "HasSymbolWithTrap"},
+ {"name": "SetStringWithoutTrap"},
+ {"name": "SetStringWithTrap"},
+ {"name": "SetIndexWithoutTrap"},
+ {"name": "SetIndexWithTrap"},
+ {"name": "SetSymbolWithoutTrap"},
+ {"name": "SetSymbolWithTrap"},
+ {"name": "HasInIdiom"},
+ {"name": "IsExtensibleWithoutTrap"},
+ {"name": "IsExtensibleWithTrap"},
+ {"name": "PreventExtensionsWithoutTrap"},
+ {"name": "PreventExtensionsWithTrap"},
+ {"name": "GetPrototypeOfWithoutTrap"},
+ {"name": "GetPrototypeOfWithTrap"},
+ {"name": "SetPrototypeOfWithoutTrap"},
+ {"name": "SetPrototypeOfWithTrap"}
+ ]
+ },
+ {
+ "name": "ArrayLiteralInitialSpreadSmallHoley",
+ "path": ["ArrayLiteralInitialSpreadSmallHoley"],
+ "main": "run.js",
+ "resources": [],
+ "results_regexp": "^%s\\-ArrayLiteralInitialSpreadSmallHoley\\(Score\\): (.+)$",
+ "tests": [
+ {"name": "Spread"},
+ {"name": "ForLength"},
+ {"name": "ForLengthEmpty"},
+ {"name": "Slice"},
+ {"name": "Slice0"},
+ {"name": "ConcatReceive"},
+ {"name": "ConcatArg"},
+ {"name": "ForOfPush"},
+ {"name": "MapId"}
+ ]
+ },
+ {
+ "name": "ArrayLiteralInitialSpreadSmallDoublePacked",
+ "path": ["ArrayLiteralInitialSpreadSmallDoublePacked"],
+ "main": "run.js",
+ "resources": [],
+ "results_regexp": "^%s\\-ArrayLiteralInitialSpreadSmallDoublePacked\\(Score\\): (.+)$",
+ "tests": [
+ {"name": "Spread"},
+ {"name": "ForLength"},
+ {"name": "ForLengthEmpty"},
+ {"name": "Slice"},
+ {"name": "Slice0"},
+ {"name": "ConcatReceive"},
+ {"name": "ConcatArg"},
+ {"name": "ForOfPush"},
+ {"name": "MapId"}
+ ]
+ },
+ {
+ "name": "ArrayLiteralInitialSpreadSmallSmiSet",
+ "path": ["ArrayLiteralInitialSpreadSmallSmiSet"],
+ "main": "run.js",
+ "resources": [],
+ "results_regexp": "^%s\\-ArrayLiteralInitialSpreadSmallSmiSet\\(Score\\): (.+)$",
+ "tests": [
+ {"name": "ForOf"},
+ {"name": "ForOfKeys"},
+ {"name": "ForOfValues"},
+ {"name": "Spread"},
+ {"name": "SpreadKeys"},
+ {"name": "SpreadValues"}
+ ]
+ },
+ {
+ "name": "ArrayLiteralInitialSpreadLargeSmiSet",
+ "path": ["ArrayLiteralInitialSpreadLargeSmiSet"],
+ "main": "run.js",
+ "resources": [],
+ "results_regexp": "^%s\\-ArrayLiteralInitialSpreadLargeSmiSet\\(Score\\): (.+)$",
+ "tests": [
+ {"name": "ForOf"},
+ {"name": "ForOfKeys"},
+ {"name": "ForOfValues"},
+ {"name": "Spread"},
+ {"name": "SpreadKeys"},
+ {"name": "SpreadValues"}
+ ]
+ },
+ {
+ "name": "Object",
+ "path": ["Object"],
+ "main": "run.js",
+ "flags": ["--harmony"],
+ "resources": [
+ "assign.js",
+ "create.js",
+ "entries.js",
+ "values.js"
+ ],
+ "results_regexp": "^%s\\-Object\\(Score\\): (.+)$",
+ "tests": [
+ {"name": "Assign"},
+ {"name": "Create"},
+ {"name": "Entries"},
+ {"name": "EntriesMegamorphic"},
+ {"name": "Values"},
+ {"name": "ValuesMegamorphic"}
+ ]
+ },
+ {
+ "name": "Keys",
+ "path": ["Keys"],
+ "main": "run.js",
+ "resources": ["keys.js"],
+ "results_regexp": "^%s\\-Keys\\(Score\\): (.+)$",
+ "tests": [
+ {"name": "Object.keys()"},
+ {"name": "for-in"},
+ {"name": "for-in hasOwnProperty()"},
+ {"name": "for (i < Object.keys().length)"},
+ {"name": "Object.keys().forEach()"},
+ {"name": "for (i < array.length)"},
+ {"name": "for (i < length)"}
+ ]
+ },
+ {
+ "name": "ArraySortPreSorted",
+ "path": ["ArraySort"],
+ "main": "run.js",
+ "resources": ["sort-base.js", "sort-presorted.js"],
+ "test_flags": ["sort-presorted"],
+ "results_regexp": "^%s\\-ArraySort\\(Score\\): (.+)$",
+ "flags": [
+ "--allow-natives-syntax"
+ ],
+ "tests": [
+ {"name": "Random"},
+ {"name": "Up"},
+ {"name": "Down"},
+ {"name": "Saw1000"},
+ {"name": "Saw500"},
+ {"name": "Saw200"},
+ {"name": "Saw200Symmetric"},
+ {"name": "Saw200Down"},
+ {"name": "UpDown"},
+ {"name": "UpUp"},
+ {"name": "DownDown"},
+ {"name": "DownUp"}
+ ]
+ },
+ {
+ "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"}
+ ]
+ }
+ ]
+}
diff --git a/src/v8/test/js-perf-test/JSTests5.json b/src/v8/test/js-perf-test/JSTests5.json
new file mode 100644
index 0000000..66504bf
--- /dev/null
+++ b/src/v8/test/js-perf-test/JSTests5.json
@@ -0,0 +1,623 @@
+{
+ "owners": ["jarin@chromium.org", "mvstanton@chromium.org"],
+ "name": "JSTests",
+ "run_count": 3,
+ "run_count_arm": 1,
+ "run_count_arm64": 1,
+ "timeout": 120,
+ "timeout_arm64": 240,
+ "units": "score",
+ "total": true,
+ "resources": ["base.js"],
+ "tests": [
+ {
+ "name": "AsyncAwait",
+ "path": ["AsyncAwait"],
+ "main": "run.js",
+ "resources": [
+ "native.js",
+ "baseline-babel-es2017.js",
+ "baseline-naive-promises.js"
+ ],
+ "flags": ["--allow-natives-syntax"],
+ "results_regexp": "^%s\\-AsyncAwait\\(Score\\): (.+)$",
+ "tests": [
+ {"name": "BaselineES2017"},
+ {"name": "BaselineNaivePromises"},
+ {"name": "Native"}
+ ]
+ },
+ {
+ "name": "Generators",
+ "path": ["Generators"],
+ "main": "run.js",
+ "resources": ["generators.js"],
+ "results_regexp": "^Generators\\-Generators\\(Score\\): (.+)$"
+ },
+ {
+ "name": "ArrayLiteralInitialSpreadLargePacked",
+ "path": ["ArrayLiteralInitialSpreadLargePacked"],
+ "main": "run.js",
+ "resources": [],
+ "results_regexp": "^%s\\-ArrayLiteralInitialSpreadLargePacked\\(Score\\): (.+)$",
+ "tests": [
+ {"name": "Spread"},
+ {"name": "ForLength"},
+ {"name": "ForLengthEmpty"},
+ {"name": "Slice"},
+ {"name": "Slice0"},
+ {"name": "ConcatReceive"},
+ {"name": "ConcatArg"}
+ ]
+ },
+ {
+ "name": "ArrayLiteralInitialSpreadLargeHoley",
+ "path": ["ArrayLiteralInitialSpreadLargeHoley"],
+ "main": "run.js",
+ "resources": [],
+ "results_regexp": "^%s\\-ArrayLiteralInitialSpreadLargeHoley\\(Score\\): (.+)$",
+ "tests": [
+ {"name": "Spread"},
+ {"name": "ForLength"},
+ {"name": "ForLengthEmpty"},
+ {"name": "Slice"},
+ {"name": "Slice0"},
+ {"name": "ConcatReceive"},
+ {"name": "ConcatArg"}
+ ]
+ },
+ {
+ "name": "ArrayLiteralInitialSpreadLargeDoublePacked",
+ "path": ["ArrayLiteralInitialSpreadLargeDoublePacked"],
+ "main": "run.js",
+ "resources": [],
+ "results_regexp": "^%s\\-ArrayLiteralInitialSpreadLargeDoublePacked\\(Score\\): (.+)$",
+ "tests": [
+ {"name": "Spread"},
+ {"name": "ForLength"},
+ {"name": "ForLengthEmpty"},
+ {"name": "Slice"},
+ {"name": "Slice0"},
+ {"name": "ConcatReceive"},
+ {"name": "ConcatArg"}
+ ]
+ },
+ {
+ "name": "ArrayLiteralInitialSpreadLargeDoubleHoley",
+ "path": ["ArrayLiteralInitialSpreadLargeDoubleHoley"],
+ "main": "run.js",
+ "resources": [],
+ "results_regexp": "^%s\\-ArrayLiteralInitialSpreadLargeDoubleHoley\\(Score\\): (.+)$",
+ "tests": [
+ {"name": "Spread"},
+ {"name": "ForLength"},
+ {"name": "ForLengthEmpty"},
+ {"name": "Slice"},
+ {"name": "Slice0"},
+ {"name": "ConcatReceive"},
+ {"name": "ConcatArg"}
+ ]
+ },
+ {
+ "name": "ArrayLiteralInitialSpreadSmallSmiMap",
+ "path": ["ArrayLiteralInitialSpreadSmallSmiMap"],
+ "main": "run.js",
+ "resources": [],
+ "results_regexp": "^%s\\-ArrayLiteralInitialSpreadSmallSmiMap\\(Score\\): (.+)$",
+ "tests": [
+ {"name": "ForOfKeys"},
+ {"name": "ForOfValues"},
+ {"name": "SpreadKeys"},
+ {"name": "SpreadValues"}
+ ]
+ },
+ {
+ "name": "ArrayLiteralInitialSpreadLargeSmiMap",
+ "path": ["ArrayLiteralInitialSpreadLargeSmiMap"],
+ "main": "run.js",
+ "resources": [],
+ "results_regexp": "^%s\\-ArrayLiteralInitialSpreadLargeSmiMap\\(Score\\): (.+)$",
+ "tests": [
+ {"name": "ForOfKeys"},
+ {"name": "ForOfValues"},
+ {"name": "SpreadKeys"},
+ {"name": "SpreadValues"}
+ ]
+ },
+ {
+ "name": "ArrayLiteralSpread",
+ "path": ["ArrayLiteralSpread"],
+ "main": "run.js",
+ "resources": [],
+ "results_regexp": "^%s\\-ArrayLiteralSpread\\(Score\\): (.+)$",
+ "tests": [
+ {"name": "Babel"},
+ {"name": "ForOfPush"},
+ {"name": "ForOfSet"},
+ {"name": "Spread"}
+ ]
+ },
+ {
+ "name": "SpreadCallsGeneral",
+ "path": ["SpreadCallsGeneral"],
+ "main": "run.js",
+ "resources": [],
+ "results_regexp": "^%s\\-SpreadCallsGeneral\\(Score\\): (.+)$",
+ "tests": [
+ {"name": "ApplySpreadLiteral"},
+ {"name": "SpreadCall"},
+ {"name": "SpreadCallSpreadLiteral"}
+ ]
+ },
+ {
+ "name": "RestParameters",
+ "path": ["RestParameters"],
+ "main": "run.js",
+ "resources": ["rest.js"],
+ "units": "score",
+ "results_regexp": "^%s\\-RestParameters\\(Score\\): (.+)$",
+ "tests": [
+ {"name": "Basic1"},
+ {"name": "ReturnArgsBabel"},
+ {"name": "ReturnArgsNative"}
+ ]
+ },
+ {
+ "name": "SpreadCalls",
+ "path": ["SpreadCalls"],
+ "main": "run.js",
+ "resources": ["spreadcalls.js"],
+ "units": "score",
+ "results_regexp": "^%s\\-SpreadCalls\\(Score\\): (.+)$",
+ "tests": [
+ {"name": "Call"},
+ {"name": "CallMethod"},
+ {"name": "CallNew"}
+ ]
+ },
+ {
+ "name": "Classes",
+ "path": ["Classes"],
+ "main": "run.js",
+ "resources": [
+ "super.js",
+ "default-constructor.js",
+ "leaf-constructors.js"],
+ "results_regexp": "^%s\\-Classes\\(Score\\): (.+)$",
+ "tests": [
+ {"name": "Super"},
+ {"name": "DefaultConstructor"},
+ {"name": "LeafConstructors"}
+ ]
+ },
+ {
+ "name": "Closures",
+ "path": ["Closures"],
+ "main": "run.js",
+ "resources": ["closures.js"],
+ "flags": [],
+ "results_regexp": "^%s\\-Closures\\(Score\\): (.+)$",
+ "tests": [
+ {"name": "Closures"}
+ ]
+ },
+ {
+ "name": "ClosuresMarkForTierUp",
+ "path": ["Closures"],
+ "main": "run.js",
+ "resources": ["closures.js"],
+ "flags": [],
+ "results_regexp": "^%s\\-Closures\\(Score\\): (.+)$",
+ "tests": [
+ {"name": "Closures"}
+ ]
+ },
+ {
+ "name": "ManyClosures",
+ "path": ["ManyClosures"],
+ "main": "run.js",
+ "resources": ["create-many-closures.js"],
+ "flags": [ "--allow-natives-syntax", "--expose-gc" ],
+ "results_regexp": "^%s\\-ManyClosures\\(Score\\): (.+)$",
+ "tests": [
+ {"name": "ManyClosures"}
+ ]
+ },
+ {
+ "name": "Iterators",
+ "path": ["Iterators"],
+ "main": "run.js",
+ "resources": ["forof.js"],
+ "results_regexp": "^%s\\-Iterators\\(Score\\): (.+)$",
+ "tests": [
+ {"name": "ForOf"}
+ ]
+ },
+ {
+ "name": "StringIterators",
+ "path": ["StringIterators"],
+ "main": "run.js",
+ "resources": ["string-iterator.js"],
+ "results_regexp": "^%s\\-StringIterators\\(Score\\): (.+)$",
+ "tests": [
+ {"name": "Spread_OneByteShort"},
+ {"name": "Spread_TwoByteShort"},
+ {"name": "Spread_WithSurrogatePairsShort"},
+ {"name": "ForOf_OneByteShort"},
+ {"name": "ForOf_TwoByteShort"},
+ {"name": "ForOf_WithSurrogatePairsShort"},
+ {"name": "ForOf_OneByteLong"},
+ {"name": "ForOf_TwoByteLong"},
+ {"name": "ForOf_WithSurrogatePairsLong"}
+ ]
+ },
+ {
+ "name": "Templates",
+ "path": ["Templates"],
+ "main": "run.js",
+ "resources": ["templates.js"],
+ "units": "score",
+ "results_regexp": "^%s\\-Templates\\(Score\\): (.+)$",
+ "total": true,
+ "tests": [
+ {"name": "Untagged"},
+ {"name": "LargeUntagged"},
+ {"name": "Tagged"}
+ ]
+ },
+ {
+ "name": "ObjectLiteralSpread",
+ "path": ["ObjectLiteralSpread"],
+ "main": "run.js",
+ "resources": [],
+ "results_regexp": "^%s\\-ObjectLiteralSpread\\(Score\\): (.+)$",
+ "tests": [
+ {"name": "Babel"},
+ {"name": "BabelAndOverwrite"},
+ {"name": "ObjectAssign"},
+ {"name": "ObjectAssignAndOverwrite"},
+ {"name": "ObjectSpread"},
+ {"name": "ObjectSpreadAndOverwrite"}
+ ]
+ },
+ {
+ "name": "Scope",
+ "path": ["Scope"],
+ "main": "run.js",
+ "resources": ["with.js"],
+ "results_regexp": "^%s\\-Scope\\(Score\\): (.+)$",
+ "tests": [
+ {"name": "With"}
+ ]
+ },
+ {
+ "name": "Exceptions",
+ "path": ["Exceptions"],
+ "main": "run.js",
+ "resources": ["try-catch.js"],
+ "results_regexp": "^%s\\-Exceptions\\(Score\\): (.+)$",
+ "tests": [
+ {"name": "Try-Catch"}
+ ]
+ },
+ {
+ "name": "DataView",
+ "path": ["DataView"],
+ "main": "run.js",
+ "resources": ["dataviewtest.js"],
+ "results_regexp": "^DataView\\-%s\\(Score\\): (.+)$",
+ "tests": [
+ {"name": "DataViewTest-DataView-BigEndian"},
+ {"name": "DataViewTest-DataView-LittleEndian"},
+ {"name": "DataViewTest-DataView-Floats"},
+ {"name": "DataViewTest-TypedArray-BigEndian"},
+ {"name": "DataViewTest-TypedArray-LittleEndian"},
+ {"name": "DataViewTest-TypedArray-Floats"}
+ ]
+ },
+ {
+ "name": "ArrayIndexOfIncludesPolymorphic",
+ "path": ["ArrayIndexOfIncludesPolymorphic"],
+ "main": "run.js",
+ "resources": ["indexof-includes-polymorphic.js"],
+ "test_flags": ["indexof-includes-polymorphic"],
+ "results_regexp": "^%s\\-ArrayIndexOfIncludesPolymorphic\\(Score\\): (.+)$",
+ "flags": [
+ "--allow-natives-syntax"
+ ],
+ "tests": [
+ {"name": "for loop"},
+ {"name": "Array#indexOf"},
+ {"name": "Array#includes"}
+ ]
+ },
+ {
+ "name": "ArrayInOperator",
+ "path": ["ArrayInOperator"],
+ "main": "run.js",
+ "resources": [],
+ "results_regexp": "^%s\\-ArrayInOperator\\(Score\\): (.+)$",
+ "tests": [
+ {"name": "PackedSMI"},
+ {"name": "PackedDouble"},
+ {"name": "PackedElements"},
+ {"name": "HoleySMI"},
+ {"name": "HoleyDouble"},
+ {"name": "HoleyElements"},
+ {"name": "SparseSMI"},
+ {"name": "SparseDouble"},
+ {"name": "SparseElements"},
+ {"name": "TypedUint8"},
+ {"name": "TypedInt32"},
+ {"name": "TypedFloat64"}
+ ]
+ },
+ {
+ "name": "ArraySort",
+ "path": ["ArraySort"],
+ "main": "run.js",
+ "resources": ["sort-base.js", "sort.js"],
+ "test_flags": ["sort"],
+ "results_regexp": "^%s\\-ArraySort\\(Score\\): (.+)$",
+ "flags": [
+ "--allow-natives-syntax"
+ ],
+ "tests": [
+ {"name": "PackedSmi"},
+ {"name": "PackedDouble"},
+ {"name": "PackedElement"},
+ {"name": "HoleySmi"},
+ {"name": "HoleyDouble"},
+ {"name": "HoleyElement"},
+ {"name": "Dictionary"}
+ ]
+ },
+ {
+ "name": "ArraySortCompareFns",
+ "path": ["ArraySort"],
+ "main": "run.js",
+ "resources": ["sort-base.js", "sort-cmpfn.js"],
+ "test_flags": ["sort-cmpfn"],
+ "results_regexp": "^%s\\-ArraySort\\(Score\\): (.+)$",
+ "flags": [
+ "--allow-natives-syntax"
+ ],
+ "tests": [
+ {"name": "PackedSmi"},
+ {"name": "PackedDouble"},
+ {"name": "PackedElement"},
+ {"name": "HoleySmi"},
+ {"name": "HoleyDouble"},
+ {"name": "HoleyElement"},
+ {"name": "Dictionary"}
+ ]
+ },
+ {
+ "name": "ArraySortCompareFnKindChange",
+ "path": ["ArraySort"],
+ "main": "run.js",
+ "resources": ["sort-base.js", "sort-cmpfn-kindchange.js"],
+ "test_flags": ["sort-cmpfn-kindchange"],
+ "results_regexp": "^%s\\-ArraySort\\(Score\\): (.+)$",
+ "flags": [
+ "--allow-natives-syntax"
+ ],
+ "tests": [
+ {"name": "PackedSmiToPackedDouble"},
+ {"name": "HoleySmiToHoleyDouble"},
+ {"name": "PackedDoubleToHoleyDouble"},
+ {"name": "PackedElementToDictionary"},
+ {"name": "HoleyElementToDictionary"}
+ ]
+ },
+ {
+ "name": "ArraySortMegamorphic",
+ "path": ["ArraySort"],
+ "main": "run.js",
+ "resources": ["sort-base.js", "sort-megamorphic.js"],
+ "test_flags": ["sort-megamorphic"],
+ "results_regexp": "^%s\\-ArraySort\\(Score\\): (.+)$",
+ "flags": [
+ "--allow-natives-syntax"
+ ],
+ "tests": [
+ {"name": "Base"},
+ {"name": "MultipleCompareFns"}
+ ]
+ },
+ {
+ "name": "ForLoops",
+ "path": ["ForLoops"],
+ "main": "run.js",
+ "resources": [
+ "for_loop.js"
+ ],
+ "results_regexp": "^%s\\-ForLoop\\(Score\\): (.+)$",
+ "tests": [
+ {"name": "Let-Standard"},
+ {"name": "Var-Standard"}
+ ]
+ },
+ {
+ "name": "Modules",
+ "path": ["Modules"],
+ "main": "run.js",
+ "resources": ["basic-export.js", "basic-import.js", "basic-namespace.js", "value.js"],
+ "flags": [
+ "--allow-natives-syntax",
+ "--harmony-dynamic-import"
+ ],
+ "results_regexp": "^%s\\-Modules\\(Score\\): (.+)$",
+ "tests": [
+ {"name": "BasicExport"},
+ {"name": "BasicImport"},
+ {"name": "BasicNamespace"}
+ ]
+ },
+ {
+ "name": "Dates",
+ "path": ["Dates"],
+ "main": "run.js",
+ "resources": ["toLocaleString.js"],
+ "results_regexp": "^%s\\-Dates\\(Score\\): (.+)$",
+ "tests": [
+ {"name": "toLocaleDateString"},
+ {"name": "toLocaleString"},
+ {"name": "toLocaleTimeString"}
+ ]
+ },
+ {
+ "name": "ExpressionDepth",
+ "path": ["ExpressionDepth"],
+ "main": "run.js",
+ "flags": [ "--no-opt" ],
+ "results_regexp": "^%s\\-ExpressionDepth\\(Score\\): (.+)$",
+ "tests": [
+ {"name": "Or-Value"},
+ {"name": "Or-Test"},
+ {"name": "And-Value"},
+ {"name": "And-Test"},
+ {"name": "Comma-Value"},
+ {"name": "Comma-Test"},
+ {"name": "Equals-Value"},
+ {"name": "Equals-Test"},
+ {"name": "StrictEquals-Value"},
+ {"name": "StrictEquals-Test"},
+ {"name": "GreaterThan-Value"},
+ {"name": "GreaterThan-Test"},
+ {"name": "Add"},
+ {"name": "Sub"},
+ {"name": "StringConcat"},
+ {"name": "BitwiseOr"}
+ ]
+ },
+ {
+ "name": "Intl",
+ "path": ["Intl"],
+ "main": "run.js",
+ "resources": [ "constructor.js" ],
+ "flags": [],
+ "results_regexp": "^%s\\-Intl\\(Score\\): (.+)$",
+ "tests": [
+ {"name": "NewIntlCollator"},
+ {"name": "NewIntlDateTimeFormat"},
+ {"name": "NewIntlNumberFormat"},
+ {"name": "NewIntlPluralRules"},
+ {"name": "NewIntlListFormat"},
+ {"name": "NewIntlRelativeTimeFormat"},
+ {"name": "NewIntlLocale"},
+ {"name": "NewIntlLocaleWithOptions"}
+ ]
+ },
+ {
+ "name": "Inspector",
+ "path": ["Inspector"],
+ "main": "run.js",
+ "resources": [ "debugger.js", "runtime.js" ],
+ "flags": ["--enable-inspector","--allow-natives-syntax"],
+ "results_regexp": "^%s\\-Inspector\\(Score\\): (.+)$",
+ "tests": [
+ {"name": "Debugger.paused"},
+ {"name": "Runtime.evaluate(String16Cstor)"},
+ {"name": "Debugger.getPossibleBreakpoints"},
+ {"name": "AsyncStacksInstrumentation"}
+ ]
+ },
+ {
+ "name": "Parsing",
+ "path": ["Parsing"],
+ "main": "run.js",
+ "flags": ["--no-compilation-cache", "--allow-natives-syntax"],
+ "resources": [ "comments.js", "strings.js", "arrowfunctions.js"],
+ "results_regexp": "^%s\\-Parsing\\(Score\\): (.+)$",
+ "tests": [
+ {"name": "OneLineComment"},
+ {"name": "OneLineComments"},
+ {"name": "MultiLineComment"},
+ {"name": "SingleLineString"},
+ {"name": "SingleLineStrings"},
+ {"name": "MultiLineString"},
+ {"name": "ArrowFunctionShort"},
+ {"name": "ArrowFunctionLong"},
+ {"name": "CommaSepExpressionListShort"},
+ {"name": "CommaSepExpressionListLong"},
+ {"name": "CommaSepExpressionListLate"},
+ {"name": "FakeArrowFunction"}
+ ]
+ },
+ {
+ "name": "Numbers",
+ "path": ["Numbers"],
+ "main": "run.js",
+ "flags": ["--allow-natives-syntax"],
+ "resources": [
+ "toNumber.js",
+ "toLocaleString.js"
+ ],
+ "results_regexp": "^%s\\-Numbers\\(Score\\): (.+)$",
+ "tests": [
+ {"name": "Constructor"},
+ {"name": "UnaryPlus"},
+ {"name": "ParseFloat"},
+ {"name": "toLocaleString"}
+ ]
+ },
+ {
+ "name": "ObjectFreeze",
+ "path": ["ObjectFreeze"],
+ "main": "run.js",
+ "flags": [],
+ "resources": [
+ "array-indexof-includes.js",
+ "spread-call.js",
+ "tagged-template.js",
+ "has-own-property.js",
+ "array-map.js",
+ "array-reduce.js"
+ ],
+ "results_regexp": "^%s\\-Numbers\\(Score\\): (.+)$",
+ "tests": [
+ {"name": "TaggedTemplate"},
+ {"name": "TaggedTemplateLoose"},
+ {"name": "ArrayIndexOf"},
+ {"name": "ArrayIncludes"},
+ {"name": "ApplySpreadLiteral"},
+ {"name": "SpreadCall"},
+ {"name": "SpreadCallSpreadLiteral"},
+ {"name": "HasOwnProperty"},
+ {"name": "ArrayMap"},
+ {"name": "ArrayReduce"},
+ {"name": "ArrayReduceRight"}
+ ]
+ },
+ {
+ "name": "TurboFan",
+ "path": ["TurboFan"],
+ "main": "run.js",
+ "flags": [],
+ "resources": [ "typedLowering.js"],
+ "results_regexp": "^%s\\-TurboFan\\(Score\\): (.+)$",
+ "tests": [
+ {"name": "NumberToString"}
+ ]
+ },
+ {
+ "name": "StackTrace",
+ "path": ["StackTrace"],
+ "main": "run.js",
+ "flags": ["--allow-natives-syntax"],
+ "resources": ["capture.js", "serialize.js"],
+ "results_regexp": "^%s\\-StackTrace\\(Score\\): (.+)$",
+ "tests": [
+ {"name": "Simple-Capture-Error"},
+ {"name": "Custom-Capture-Error"},
+ {"name": "Inline-Capture-Error"},
+ {"name": "Recursive-Capture-Error"},
+ {"name": "Simple-Serialize-Error.stack"},
+ {"name": "Custom-Serialize-Error.stack"},
+ {"name": "Inline-Serialize-Error.stack"},
+ {"name": "Recursive-Serialize-Error.stack"}
+ ]
+ }
+ ]
+}
diff --git a/src/v8/test/js-perf-test/ManyClosures/create-many-closures.js b/src/v8/test/js-perf-test/ManyClosures/create-many-closures.js
index 548e666..7932f36 100644
--- a/src/v8/test/js-perf-test/ManyClosures/create-many-closures.js
+++ b/src/v8/test/js-perf-test/ManyClosures/create-many-closures.js
@@ -29,6 +29,7 @@
// Create a closure and optimize.
var f = g();
+ %PrepareFunctionForOptimization(f);
f(0);
f(0);
%OptimizeFunctionOnNextCall(f);
diff --git a/src/v8/test/js-perf-test/Modules/run.js b/src/v8/test/js-perf-test/Modules/run.js
index e5f91e1..4c03880 100644
--- a/src/v8/test/js-perf-test/Modules/run.js
+++ b/src/v8/test/js-perf-test/Modules/run.js
@@ -23,21 +23,21 @@
function BasicExport() {
let success = false;
import("basic-export.js").then(m => { m.bench(); success = true; });
- %RunMicrotasks();
+ %PerformMicrotaskCheckpoint();
if (!success) throw new Error(666);
}
function BasicImport() {
let success = false;
import("basic-import.js").then(m => { m.bench(); success = true; });
- %RunMicrotasks();
+ %PerformMicrotaskCheckpoint();
if (!success) throw new Error(666);
}
function BasicNamespace() {
let success = false;
import("basic-namespace.js").then(m => { m.bench(); success = true; });
- %RunMicrotasks();
+ %PerformMicrotaskCheckpoint();
if (!success) throw new Error(666);
}
diff --git a/src/v8/test/js-perf-test/Numbers/run.js b/src/v8/test/js-perf-test/Numbers/run.js
new file mode 100644
index 0000000..d482278
--- /dev/null
+++ b/src/v8/test/js-perf-test/Numbers/run.js
@@ -0,0 +1,21 @@
+// 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('../base.js');
+load('toNumber.js');
+load('toLocaleString.js');
+
+function PrintResult(name, result) {
+ console.log(name);
+ console.log(name + '-Numbers(Score): ' + result);
+}
+
+function PrintError(name, error) {
+ PrintResult(name, error);
+}
+
+BenchmarkSuite.config.doWarmup = undefined;
+BenchmarkSuite.config.doDeterministic = undefined;
+
+BenchmarkSuite.RunSuites({ NotifyResult: PrintResult,
+ NotifyError: PrintError });
diff --git a/src/v8/test/js-perf-test/Numbers/toLocaleString.js b/src/v8/test/js-perf-test/Numbers/toLocaleString.js
new file mode 100644
index 0000000..8dd5a53
--- /dev/null
+++ b/src/v8/test/js-perf-test/Numbers/toLocaleString.js
@@ -0,0 +1,14 @@
+// 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 NumberToLocaleString() {
+ Number(0).toLocaleString()
+ Number(-12).toLocaleString()
+ Number(13).toLocaleString()
+ Number(123456789).toLocaleString()
+ Number(1234567.89).toLocaleString()
+ Number(-123456789).toLocaleString()
+ Number(-1234567.89).toLocaleString()
+}
+createSuite('toLocaleString', 100000, NumberToLocaleString, ()=>{});
diff --git a/src/v8/test/js-perf-test/Numbers/toNumber.js b/src/v8/test/js-perf-test/Numbers/toNumber.js
new file mode 100644
index 0000000..44382f0
--- /dev/null
+++ b/src/v8/test/js-perf-test/Numbers/toNumber.js
@@ -0,0 +1,25 @@
+// 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 = [undefined, 12, "123"];
+
+function NumberConstructor() {
+ Number.isNaN(Number(A[0]))
+ Number.isNaN(Number(A[1]))
+ Number.isNaN(Number(A[2]))
+}
+createSuite('Constructor', 1000, NumberConstructor, ()=>{});
+
+function NumberPlus() {
+ Number.isNaN(+(A[0]))
+ Number.isNaN(+(A[1]))
+ Number.isNaN(+(A[2]))
+}
+createSuite('UnaryPlus', 1000, NumberPlus, ()=>{});
+
+function NumberParseFloat() {
+ Number.isNaN(parseFloat(A[0]))
+ Number.isNaN(parseFloat(A[1]))
+ Number.isNaN(parseFloat(A[2]))
+}
+createSuite('ParseFloat', 1000, NumberParseFloat, ()=>{});
diff --git a/src/v8/test/js-perf-test/ObjectFreeze/array-indexof-includes.js b/src/v8/test/js-perf-test/ObjectFreeze/array-indexof-includes.js
new file mode 100644
index 0000000..01e1849
--- /dev/null
+++ b/src/v8/test/js-perf-test/ObjectFreeze/array-indexof-includes.js
@@ -0,0 +1,53 @@
+// Copyright 2019 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 setupArray(length) {
+ var a = new Array(length);
+ for (var i=0;i<length;i++) {
+ a[i] = ''+i;
+ }
+ return Object.freeze(a);
+}
+
+const frozenArray = setupArray(200);
+
+function driverArrayIndexOf(n) {
+ let result = 0;
+ for (var i=0;i<n;i++) {
+ result += frozenArray.indexOf(''+i)==-1?0:1;
+ }
+ return result;
+}
+
+function ArrayIndexOf() {
+ driverArrayIndexOf(1e4);
+}
+
+function ArrayIndexOfWarmUp() {
+ driverArrayIndexOf(1e1);
+ driverArrayIndexOf(1e2);
+ driverArrayIndexOf(1e3);
+}
+
+createSuite('ArrayIndexOf', 10, ArrayIndexOf, ArrayIndexOfWarmUp);
+
+function driverArrayIncludes(n) {
+ let result = 0;
+ for (var i=0;i<n;i++) {
+ result += frozenArray.includes(''+i)?0:1;
+ }
+ return result;
+}
+
+function ArrayIncludes() {
+ driverArrayIncludes(1e4);
+}
+
+function ArrayIncludesWarmUp() {
+ driverArrayIncludes(1e1);
+ driverArrayIncludes(1e2);
+ driverArrayIncludes(1e3);
+}
+
+createSuite('ArrayIncludes', 10, ArrayIncludes, ArrayIncludesWarmUp);
diff --git a/src/v8/test/js-perf-test/ObjectFreeze/array-map.js b/src/v8/test/js-perf-test/ObjectFreeze/array-map.js
new file mode 100644
index 0000000..4a5651c
--- /dev/null
+++ b/src/v8/test/js-perf-test/ObjectFreeze/array-map.js
@@ -0,0 +1,32 @@
+// Copyright 2019 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 setupArrayMap(length) {
+ var a = new Array(length);
+ for (var i=0;i<length;i++) {
+ a[i] = ''+i;
+ }
+ return Object.freeze(a);
+}
+
+const frozenArrayMap = setupArrayMap(200);
+
+function driverArrayMap(n) {
+ let result = 0;
+ for (var i=0;i<n;i++) {
+ result = frozenArrayMap.map(Number);
+ }
+ return result;
+}
+
+function ArrayMap() {
+ driverArrayMap(1e3);
+}
+
+function ArrayMapWarmUp() {
+ driverArrayMap(1e1);
+ driverArrayMap(1e2);
+}
+
+createSuite('ArrayMap', 10, ArrayMap, ArrayMapWarmUp);
diff --git a/src/v8/test/js-perf-test/ObjectFreeze/array-reduce.js b/src/v8/test/js-perf-test/ObjectFreeze/array-reduce.js
new file mode 100644
index 0000000..1acf179
--- /dev/null
+++ b/src/v8/test/js-perf-test/ObjectFreeze/array-reduce.js
@@ -0,0 +1,59 @@
+// Copyright 2019 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 setupArrayReduce(length) {
+ let a = new Array(length);
+ for (let i=0;i<length;i++) {
+ a[i] = ''+i;
+ }
+ return Object.freeze(a);
+}
+
+const kArraylength = 200;
+const frozenArrayReduce = setupArrayReduce(kArraylength);
+
+const reducer = (accumulator, currentValue) => accumulator + Number(currentValue);
+
+function driverArrayReduce(n) {
+ let result = 0;
+ for (let i=0;i<n;i++) {
+ result = frozenArrayReduce.reduce(reducer);
+ }
+ return result;
+}
+
+const kIterations = 1e3;
+
+function ArrayReduce() {
+ driverArrayReduce(kIterations);
+}
+
+const kIterationsWarmUp = [1e1, 1e2];
+
+function ArrayReduceWarmUp() {
+ driverArrayReduce(kIterationsWarmUp[0]);
+ driverArrayReduce(kIterationsWarmUp[1]);
+}
+
+const kRun = 1e1;
+createSuite('ArrayReduce', kRun, ArrayReduce, ArrayReduceWarmUp);
+
+function driverArrayReduceRight(n) {
+ let result = 0;
+ for (let i=0;i<n;i++) {
+ result = frozenArrayReduce.reduceRight(reducer);
+ }
+ return result;
+}
+
+function ArrayReduceRight() {
+ driverArrayReduceRight(kIterations);
+}
+
+function ArrayReduceRightWarmUp() {
+ driverArrayReduceRight(kIterationsWarmUp[0]);
+ driverArrayReduceRight(kIterationsWarmUp[1]);
+}
+
+createSuite('ArrayReduceRight', kRun, ArrayReduceRight, ArrayReduceRightWarmUp);
diff --git a/src/v8/test/js-perf-test/ObjectFreeze/has-own-property.js b/src/v8/test/js-perf-test/ObjectFreeze/has-own-property.js
new file mode 100644
index 0000000..5f17c64
--- /dev/null
+++ b/src/v8/test/js-perf-test/ObjectFreeze/has-own-property.js
@@ -0,0 +1,23 @@
+// Copyright 2019 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 driver(n) {
+ let result = 0;
+ for (var i=0;i<n;i++) {
+ result += frozenArray.hasOwnProperty(''+i)==-1?0:1;
+ }
+ return result;
+}
+
+function HasOwnProperty() {
+ driver(1e4);
+}
+
+function HasOwnPropertyWarmUp() {
+ driver(1e1);
+ driver(1e2);
+ driver(1e3);
+}
+
+createSuite('HasOwnProperty', 10, HasOwnProperty, HasOwnPropertyWarmUp);
diff --git a/src/v8/test/js-perf-test/ObjectFreeze/run.js b/src/v8/test/js-perf-test/ObjectFreeze/run.js
new file mode 100644
index 0000000..a8e31a8
--- /dev/null
+++ b/src/v8/test/js-perf-test/ObjectFreeze/run.js
@@ -0,0 +1,25 @@
+// 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('../base.js');
+load('tagged-template.js');
+load('array-indexof-includes.js');
+load('spread-call.js');
+load('has-own-property.js');
+load('array-map.js');
+load('array-reduce.js');
+
+function PrintResult(name, result) {
+ console.log(name);
+ console.log(name + '-Numbers(Score): ' + result);
+}
+
+function PrintError(name, error) {
+ PrintResult(name, error);
+}
+
+BenchmarkSuite.config.doWarmup = undefined;
+BenchmarkSuite.config.doDeterministic = undefined;
+
+BenchmarkSuite.RunSuites({ NotifyResult: PrintResult,
+ NotifyError: PrintError });
diff --git a/src/v8/test/js-perf-test/ObjectFreeze/spread-call.js b/src/v8/test/js-perf-test/ObjectFreeze/spread-call.js
new file mode 100644
index 0000000..ec1cd5d
--- /dev/null
+++ b/src/v8/test/js-perf-test/ObjectFreeze/spread-call.js
@@ -0,0 +1,59 @@
+// Copyright 2019 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 setupArray(length) {
+ var a = new Array(length);
+ for (var i=0;i<length;i++) {
+ a[i] = ''+i;
+ }
+ return Object.freeze(a);
+}
+
+const frozenSpreadArray = setupArray(100);
+
+function foo() {
+ var result = arguments[0];
+ for (var i = 1; i < arguments.length; ++i) {
+ result += arguments[i];
+ }
+ return result;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: SpreadCall
+// ----------------------------------------------------------------------------
+
+function SpreadCall() {
+ foo(...frozenSpreadArray);
+}
+
+
+// ----------------------------------------------------------------------------
+// Benchmark: SpreadCallSpreadLiteral
+// ----------------------------------------------------------------------------
+
+function SpreadCallSpreadLiteral() {
+ foo(...[...frozenSpreadArray]);
+}
+
+
+// ----------------------------------------------------------------------------
+// Benchmark: ApplySpreadLiteral
+// ----------------------------------------------------------------------------
+
+function ApplySpreadLiteral() {
+ foo.apply(this, [...frozenSpreadArray]);
+}
+
+// ----------------------------------------------------------------------------
+// Setup and Run
+// ----------------------------------------------------------------------------
+
+function CreateBenchmark(name, f) {
+ new BenchmarkSuite(name, [10], [ new Benchmark(name, false, false, 0, f) ]);
+}
+
+CreateBenchmark('ApplySpreadLiteral', ApplySpreadLiteral);
+CreateBenchmark('SpreadCall', SpreadCall);
+CreateBenchmark('SpreadCallSpreadLiteral', SpreadCallSpreadLiteral);
diff --git a/src/v8/test/js-perf-test/ObjectFreeze/tagged-template.js b/src/v8/test/js-perf-test/ObjectFreeze/tagged-template.js
new file mode 100644
index 0000000..83fbb8a
--- /dev/null
+++ b/src/v8/test/js-perf-test/ObjectFreeze/tagged-template.js
@@ -0,0 +1,65 @@
+// Copyright 2019 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 tag(strings, ...values) {
+ let a = 0;
+ for (let i = 0; i < strings.length; ++i) a += strings[i].length;
+ return a;
+}
+
+function driver(n) {
+ let result = 0;
+ for (let i = 0; i < n; ++i) {
+ result += tag`${"Hello"} ${"cruel"} ${"slow"} ${"world"}!\n`;
+ result += tag`${"Why"} ${"is"} ${"this"} ${"so"} ${"damn"} ${"slow"}?!\n`;
+ }
+ return result;
+}
+
+function TaggedTemplate() {
+ driver(1e4);
+}
+
+function TaggedTemplateWarmUp() {
+ driver(1e1);
+ driver(1e2);
+ driver(1e3);
+}
+
+createSuite('TaggedTemplate', 10, TaggedTemplate, TaggedTemplateWarmUp);
+
+var _templateObject = _taggedTemplateLiteralLoose(
+ ["", " ", " ", " ", "!\n"],
+ ["", " ", " ", " ", "!\\n"]
+),
+_templateObject2 = _taggedTemplateLiteralLoose(
+ ["", " ", " ", " ", " ", " ", "?!\n"],
+ ["", " ", " ", " ", " ", " ", "?!\\n"]
+);
+
+function _taggedTemplateLiteralLoose(strings, raw) {
+ strings.raw = raw;
+ return strings;
+}
+
+function driverLoose(n) {
+ var result = 0;
+ for (var i = 0; i < n; ++i) {
+ result += tag(_templateObject, "Hello", "cruel", "slow", "world");
+ result += tag(_templateObject2, "Why", "is", "this", "so", "damn", "slow");
+ }
+ return result;
+}
+
+function TaggedTemplateLoose() {
+ driverLoose(1e4);
+}
+
+function TaggedTemplateLooseWarmUp() {
+ driverLoose(1e1);
+ driverLoose(1e2);
+ driverLoose(1e3);
+}
+
+createSuite('TaggedTemplateLoose', 10, TaggedTemplateLoose, TaggedTemplateLooseWarmUp);
diff --git a/src/v8/test/js-perf-test/ObjectLiteralSpread/run.js b/src/v8/test/js-perf-test/ObjectLiteralSpread/run.js
new file mode 100644
index 0000000..b9d7ea0
--- /dev/null
+++ b/src/v8/test/js-perf-test/ObjectLiteralSpread/run.js
@@ -0,0 +1,101 @@
+// 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 input = {
+ a: 1,
+ b: 2,
+ c: 3,
+ ['d']: 4,
+ 1: 5
+};
+
+
+// ----------------------------------------------------------------------------
+// Benchmark: Babel
+// ----------------------------------------------------------------------------
+
+function _extends(target) {
+ for (var i = 1; i < arguments.length; i++) {
+ var source = arguments[i];
+ for (var key in source) {
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
+ target[key] = source[key];
+ }
+ }
+ }
+ return target;
+};
+
+function Babel() {
+ const result = _extends({}, input);
+ if (Object.keys(result).length != 5) throw 666;
+}
+
+function BabelAndOverwrite() {
+ const result = _extends({}, input, {a: 6});
+ if (Object.keys(result).length != 5) throw 666;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: Object.assign
+// ----------------------------------------------------------------------------
+
+
+function ObjectAssign() {
+ const result = Object.assign({}, input);
+ if (Object.keys(result).length != 5) throw 666;
+}
+
+function ObjectAssignAndOverwrite() {
+ const result = Object.assign({}, input, {a : 6});
+ if (Object.keys(result).length != 5) throw 666;
+}
+
+
+// ----------------------------------------------------------------------------
+// Benchmark: Object.assign
+// ----------------------------------------------------------------------------
+
+
+function ObjectSpread() {
+ const result = { ...input };
+ if (Object.keys(result).length != 5) throw 666;
+}
+
+function ObjectSpreadAndOverwrite() {
+ const result = { ...input, a: 6 };
+ if (Object.keys(result).length != 5) throw 666;
+}
+
+// ----------------------------------------------------------------------------
+// Setup and Run
+// ----------------------------------------------------------------------------
+
+load('../base.js');
+
+var success = true;
+
+function PrintResult(name, result) {
+ print(name + '-ObjectLiteralSpread(Score): ' + result);
+}
+
+function PrintError(name, error) {
+ PrintResult(name, error);
+ success = false;
+}
+
+function CreateBenchmark(name, f) {
+ new BenchmarkSuite(name, [100], [ new Benchmark(name, false, false, 0, f) ]);
+}
+
+CreateBenchmark('Babel', Babel);
+CreateBenchmark('BabelAndOverwrite', BabelAndOverwrite);
+CreateBenchmark('ObjectAssign', ObjectAssign);
+CreateBenchmark('ObjectAssignAndOverwrite', ObjectAssignAndOverwrite);
+CreateBenchmark('ObjectSpread', ObjectSpread);
+CreateBenchmark('ObjectSpreadAndOverwrite', ObjectSpreadAndOverwrite);
+
+BenchmarkSuite.config.doWarmup = undefined;
+BenchmarkSuite.config.doDeterministic = undefined;
+BenchmarkSuite.RunSuites({NotifyResult: PrintResult, NotifyError: PrintError});
diff --git a/src/v8/test/js-perf-test/Parsing/arrowfunctions.js b/src/v8/test/js-perf-test/Parsing/arrowfunctions.js
new file mode 100644
index 0000000..40955ea
--- /dev/null
+++ b/src/v8/test/js-perf-test/Parsing/arrowfunctions.js
@@ -0,0 +1,60 @@
+// 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.
+
+new BenchmarkSuite("ArrowFunctionShort", [1000], [
+ new Benchmark("ArrowFunctionShort", false, true, iterations, Run, ArrowFunctionShortSetup)
+]);
+
+new BenchmarkSuite("ArrowFunctionLong", [1000], [
+ new Benchmark("ArrowFunctionLong", false, true, iterations, Run, ArrowFunctionLongSetup)
+]);
+
+new BenchmarkSuite("CommaSepExpressionListShort", [1000], [
+ new Benchmark("CommaSepExpressionListShort", false, true, iterations, Run, CommaSepExpressionListShortSetup)
+]);
+
+new BenchmarkSuite("CommaSepExpressionListLong", [1000], [
+ new Benchmark("CommaSepExpressionListLong", false, true, iterations, Run, CommaSepExpressionListLongSetup)
+]);
+
+new BenchmarkSuite("CommaSepExpressionListLate", [1000], [
+ new Benchmark("CommaSepExpressionListLate", false, true, iterations, Run, CommaSepExpressionListLateSetup)
+]);
+
+new BenchmarkSuite("FakeArrowFunction", [1000], [
+ new Benchmark("FakeArrowFunction", false, true, iterations, Run, FakeArrowFunctionSetup)
+]);
+
+function ArrowFunctionShortSetup() {
+ code = "let a;\n" + "a = (a,b) => { return a+b; }\n".repeat(50)
+}
+
+function ArrowFunctionLongSetup() {
+ code = "let a;\n" + "a = (a,b,c,d,e,f,g,h,i,j) => { return a+b; }\n".repeat(50)
+}
+
+function CommaSepExpressionListShortSetup() {
+ code = "let a;\n" + "a = (a,1)\n".repeat(50)
+}
+
+function CommaSepExpressionListLongSetup() {
+ code = "let a; let b; let c;\n" + "a = (a,2,3,4,5,b,c,1,7,1)\n".repeat(50)
+}
+
+function CommaSepExpressionListLateSetup() {
+ code = "let a; let b; let c; let d; let e; let f; let g; let h; let i;\n"
+ + "a = (a,b,c,d,e,f,g,h,i,1)\n".repeat(50)
+}
+
+function FakeArrowFunctionSetup() {
+ code = "let a; let b; let c; let d; let e; let f; let g; let h; let i; let j;\n"
+ + "a = (a,b,c,d,e,f,g,h,i,j)\n".repeat(50)
+}
+
+function Run() {
+ if (code == undefined) {
+ throw new Error("No test data");
+ }
+ eval(code);
+}
diff --git a/src/v8/test/js-perf-test/Parsing/comments.js b/src/v8/test/js-perf-test/Parsing/comments.js
index e5dbab1..5d6b70f 100644
--- a/src/v8/test/js-perf-test/Parsing/comments.js
+++ b/src/v8/test/js-perf-test/Parsing/comments.js
@@ -2,22 +2,18 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-const iterations = 100;
-
-new BenchmarkSuite('OneLineComment', [1000], [
- new Benchmark('OneLineComment', false, true, iterations, Run, OneLineCommentSetup)
+new BenchmarkSuite("OneLineComment", [1000], [
+ new Benchmark("OneLineComment", false, true, iterations, Run, OneLineCommentSetup)
]);
-new BenchmarkSuite('OneLineComments', [1000], [
- new Benchmark('OneLineComments', false, true, iterations, Run, OneLineCommentsSetup)
+new BenchmarkSuite("OneLineComments", [1000], [
+ new Benchmark("OneLineComments", false, true, iterations, Run, OneLineCommentsSetup)
]);
-new BenchmarkSuite('MultiLineComment', [1000], [
- new Benchmark('MultiLineComment', false, true, iterations, Run, MultiLineCommentSetup)
+new BenchmarkSuite("MultiLineComment", [1000], [
+ new Benchmark("MultiLineComment", false, true, iterations, Run, MultiLineCommentSetup)
]);
-let code;
-
function OneLineCommentSetup() {
code = "//" + " This is a comment... ".repeat(600);
%FlattenString(code);
diff --git a/src/v8/test/js-perf-test/Parsing/run.js b/src/v8/test/js-perf-test/Parsing/run.js
index e6531af..d699af2 100644
--- a/src/v8/test/js-perf-test/Parsing/run.js
+++ b/src/v8/test/js-perf-test/Parsing/run.js
@@ -3,14 +3,19 @@
// found in the LICENSE file.
-load('../base.js');
+load("../base.js");
-load('comments.js');
+const iterations = 100;
+let code;
+
+load("comments.js");
+load("strings.js");
+load("arrowfunctions.js")
var success = true;
function PrintResult(name, result) {
- print(name + '-Parsing(Score): ' + result);
+ print(name + "-Parsing(Score): " + result);
}
diff --git a/src/v8/test/js-perf-test/Parsing/strings.js b/src/v8/test/js-perf-test/Parsing/strings.js
new file mode 100644
index 0000000..63eef38
--- /dev/null
+++ b/src/v8/test/js-perf-test/Parsing/strings.js
@@ -0,0 +1,37 @@
+// 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.
+
+new BenchmarkSuite("SingleLineString", [1000], [
+ new Benchmark("SingleLineString", false, true, iterations, Run, SingleLineStringSetup)
+]);
+
+new BenchmarkSuite("SingleLineStrings", [3000], [
+ new Benchmark("SingleLineStrings", false, true, iterations, Run, SingleLineStringsSetup)
+]);
+
+new BenchmarkSuite("MultiLineString", [1000], [
+ new Benchmark("MultiLineString", false, true, iterations, Run, MultiLineStringSetup)
+]);
+
+function SingleLineStringSetup() {
+ code = "\"" + "This is a string".repeat(600) + "\"";
+ %FlattenString(code);
+}
+
+function SingleLineStringsSetup() {
+ code = "\"This is a string\"\n".repeat(600);
+ %FlattenString(code);
+}
+
+function MultiLineStringSetup() {
+ code = "\"" + "This is a string \\\n".repeat(600) + "\"";
+ %FlattenString(code);
+}
+
+function Run() {
+ if (code == undefined) {
+ throw new Error("No test data");
+ }
+ eval(code);
+}
diff --git a/src/v8/test/js-perf-test/Proxies/proxies.js b/src/v8/test/js-perf-test/Proxies/proxies.js
index 79d064e..cb8167a 100644
--- a/src/v8/test/js-perf-test/Proxies/proxies.js
+++ b/src/v8/test/js-perf-test/Proxies/proxies.js
@@ -373,7 +373,8 @@
setup() {
p = new Proxy(obj, {
set: function(target, propertyKey, value, receiver) {
- target[propertyKey] = SOME_OTHER_NUMBER
+ target[propertyKey] = SOME_OTHER_NUMBER;
+ return true;
}
});
},
@@ -412,7 +413,8 @@
setup() {
p = new Proxy(obj, {
set: function(target, propertyKey, value, receiver) {
- target[propertyKey] = SOME_OTHER_NUMBER
+ target[propertyKey] = SOME_OTHER_NUMBER;
+ return true;
}
});
},
@@ -450,7 +452,8 @@
setup() {
p = new Proxy(obj, {
set: function(target, propertyKey, value, receiver) {
- target[propertyKey] = SOME_OTHER_NUMBER
+ target[propertyKey] = SOME_OTHER_NUMBER;
+ return true;
}
});
},
@@ -503,3 +506,161 @@
return result === 20 * SOME_NUMBER;
}
});
+
+// ----------------------------------------------------------------------------
+
+obj = {};
+value = false;
+
+newBenchmark("IsExtensibleWithoutTrap", {
+ setup() {
+ p = new Proxy(obj, {});
+ },
+ run() {
+ for(var i = 0; i < ITERATIONS; i++) {
+ value = Object.isExtensible(p);
+ }
+ return value;
+ },
+ teardown() {
+ return value === true;
+ }
+});
+
+// ----------------------------------------------------------------------------
+
+obj = {};
+value = false;
+
+newBenchmark("IsExtensibleWithTrap", {
+ setup() {
+ p = new Proxy(obj, {
+ isExtensible: function(target) {
+ return true;
+ }
+ });
+ },
+ run() {
+ for(var i = 0; i < ITERATIONS; i++) {
+ value = Object.isExtensible(p);
+ }
+ return value;
+ },
+ teardown() {
+ return value === true;
+ }
+});
+
+// ----------------------------------------------------------------------------
+
+obj = {};
+value = false;
+
+newBenchmark("PreventExtensionsWithoutTrap", {
+ setup() {
+ p = new Proxy(obj, {});
+ },
+ run() {
+ for(var i = 0; i < ITERATIONS; i++) {
+ value = Object.preventExtensions(p);
+ }
+ return value;
+ },
+ teardown() {}
+});
+
+// ----------------------------------------------------------------------------
+
+obj = {};
+value = false;
+
+newBenchmark("PreventExtensionsWithTrap", {
+ setup() {
+ p = new Proxy(obj, {
+ preventExtensions: function(target) {
+ Object.preventExtensions(target);
+ return true;
+ }
+ });
+ },
+ run() {
+ for(var i = 0; i < ITERATIONS; i++) {
+ value = Object.preventExtensions(p);
+ }
+ return value;
+ },
+ teardown() {}
+});
+
+// ----------------------------------------------------------------------------
+
+newBenchmark("GetPrototypeOfWithoutTrap", {
+ setup() {
+ p = new Proxy({}, {});
+ },
+ run() {
+ for(var i = 0; i < ITERATIONS; i++) {
+ value = Object.getPrototypeOf(p);
+ }
+ return value;
+ },
+ teardown() {}
+});
+
+// ----------------------------------------------------------------------------
+
+newBenchmark("GetPrototypeOfWithTrap", {
+ setup() {
+ p = new Proxy({}, {
+ getPrototypeOf: function(target) {
+ return Array.prototype;
+ }
+ });
+ },
+ run() {
+ for(var i = 0; i < ITERATIONS; i++) {
+ value = Object.getPrototypeOf(p);
+ }
+ return value;
+ },
+ teardown() {}
+});
+
+// ----------------------------------------------------------------------------
+
+newBenchmark("SetPrototypeOfWithoutTrap", {
+ setup() {
+ var obj = { x: 1 };
+ obj.__proto__ = {};
+ p = new Proxy(obj, {});
+ },
+ run() {
+ for(var i = 0; i < ITERATIONS; i++) {
+ value = Object.setPrototypeOf(p, [1]);
+ }
+ return value;
+ },
+ teardown() {}
+});
+
+// ----------------------------------------------------------------------------
+
+newBenchmark("SetPrototypeOfWithTrap", {
+ setup() {
+ var obj = { x: 1 };
+ obj.__proto__ = {};
+ p = new Proxy(obj, {
+ setPrototypeOf: function(target, proto) {
+ Object.setPrototypeOf(target, proto);
+ return true;
+ }
+ });
+ },
+ run() {
+ for(var i = 0; i < ITERATIONS; i++) {
+ value = Object.setPrototypeOf(p, [1]);
+ }
+ return value;
+ },
+ teardown() {}
+});
diff --git a/src/v8/test/js-perf-test/RegExp.json b/src/v8/test/js-perf-test/RegExp.json
index 0b3a127..a5ee41b 100644
--- a/src/v8/test/js-perf-test/RegExp.json
+++ b/src/v8/test/js-perf-test/RegExp.json
@@ -1,4 +1,5 @@
{
+ "owners": ["jgruber@chromium.org", "yangguo@chromium.org"],
"name": "RegExp",
"run_count": 3,
"run_count_arm": 1,
@@ -22,9 +23,12 @@
"base_split.js",
"base_test.js",
"base.js",
+ "case_test.js",
+ "complex_case_test.js",
"ctor.js",
"exec.js",
"flags.js",
+ "inline_test.js",
"match.js",
"replace.js",
"search.js",
@@ -40,6 +44,8 @@
],
"results_regexp": "^%s\\-RegExp\\(Score\\): (.+)$",
"tests": [
+ {"name": "CaseInsensitiveTest"},
+ {"name": "ComplexCaseInsensitiveTest"},
{"name": "Ctor"},
{"name": "Exec"},
{"name": "Flags"},
@@ -54,7 +60,8 @@
{"name": "SlowReplace"},
{"name": "SlowSearch"},
{"name": "SlowSplit"},
- {"name": "SlowTest"}
+ {"name": "SlowTest"},
+ {"name": "InlineTest"}
]
}
]
diff --git a/src/v8/test/js-perf-test/RegExp/RegExpTests.json b/src/v8/test/js-perf-test/RegExp/RegExpTests.json
index ffb451c..cea4393 100644
--- a/src/v8/test/js-perf-test/RegExp/RegExpTests.json
+++ b/src/v8/test/js-perf-test/RegExp/RegExpTests.json
@@ -13,6 +13,8 @@
"path": ["."],
"main": "run.js",
"resources": [
+ "case_test.js",
+ "complex_case_test.js",
"base_ctor.js",
"base_exec.js",
"base_flags.js",
@@ -25,6 +27,7 @@
"ctor.js",
"exec.js",
"flags.js",
+ "inline_test.js",
"match.js",
"replace.js",
"search.js",
@@ -40,6 +43,8 @@
],
"results_regexp": "^%s\\-RegExp\\(Score\\): (.+)$",
"tests": [
+ {"name": "CaseInsensitiveTest"},
+ {"name": "ComplexCaseInsensitiveTest"},
{"name": "Ctor"},
{"name": "Exec"},
{"name": "Flags"},
@@ -54,7 +59,8 @@
{"name": "SlowReplace"},
{"name": "SlowSearch"},
{"name": "SlowSplit"},
- {"name": "SlowTest"}
+ {"name": "SlowTest"},
+ {"name": "InlineTest"}
]
}
]
diff --git a/src/v8/test/js-perf-test/RegExp/base.js b/src/v8/test/js-perf-test/RegExp/base.js
index 31f7206..3883b7f 100644
--- a/src/v8/test/js-perf-test/RegExp/base.js
+++ b/src/v8/test/js-perf-test/RegExp/base.js
@@ -5,6 +5,7 @@
function benchName(bench, setup) {
var name = bench.name;
if (setup) name += "/" + setup.name;
+ return name;
}
function slowBenchName(bench, setup) {
@@ -30,7 +31,7 @@
return new BenchmarkSuite(
name, [1000],
benchmarks.map(([bench, setup]) =>
- new Benchmark(benchName(bench, setup), false, false, 0, bench,
+ new Benchmark(benchName(bench, setup), false, false, 100000, bench,
setup)));
}
diff --git a/src/v8/test/js-perf-test/RegExp/case_test.js b/src/v8/test/js-perf-test/RegExp/case_test.js
new file mode 100644
index 0000000..c2501aa
--- /dev/null
+++ b/src/v8/test/js-perf-test/RegExp/case_test.js
@@ -0,0 +1,29 @@
+// Copyright 2019 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 ConstCaseInsensitiveTest() {
+ /[a-t]/i.test("abCdefgzabCdefgzabCdefgzabCdefgzabCdefgzabCdefgzabCdefgzabCdefgz");
+}
+
+function ConstCaseInsensitiveNonLatin1Test() {
+ /[α-ζ]/i.test("βκςΑφabcdeβκEFGαοςερκ");
+}
+
+const icre = /[a-t]/i;
+function GlobalConstCaseInsensitiveRegExpTest() {
+ icre.test("abCdefgzabCdefgzabCdefgzabCdefgzabCdefgzabCdefgzabCdefgzabCdefgz");
+}
+
+const icre2 = /[α-ζ]/i;
+function GlobalConstCaseInsensitiveNonLatin1RegExpTest() {
+ icre2.test("βκςΑφabcdeβκEFGαοςερκ");
+}
+
+benchmarks = [ [ConstCaseInsensitiveTest, () => {}],
+ [ConstCaseInsensitiveNonLatin1Test, () => {}],
+ [GlobalConstCaseInsensitiveRegExpTest, () => {}],
+ [GlobalConstCaseInsensitiveNonLatin1RegExpTest, () => {}],
+ ];
+
+createBenchmarkSuite("CaseInsensitiveTest");
diff --git a/src/v8/test/js-perf-test/RegExp/complex_case_test.js b/src/v8/test/js-perf-test/RegExp/complex_case_test.js
new file mode 100644
index 0000000..f51a646
--- /dev/null
+++ b/src/v8/test/js-perf-test/RegExp/complex_case_test.js
@@ -0,0 +1,46 @@
+// Copyright 2019 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.
+
+// The following RegExp regression case from
+// https://bugs.chromium.org/p/chromium/issues/detail?id=977003
+let g = "[\\t\\n\\f ]";
+let W = g + "*";
+let h = "[\\ud800-\\udbff][\\udc00-\\udfff]";
+let k = "[\\u0080-\\ud7ff\\ue000-\\ufffd]|" + h;
+let U = "[0-9a-fA-F]{1,6}" + g + "?";
+let E = "(?:" + U + "|[\\u0020-\\u007e\\u0080-\\ud7ff\\ue000\\ufffd]|" + h + ")";
+let m = "\\\\" + E;
+let o = "(?:[\\t\\x21\\x23-\\x26\\x28-\\x5b\\x5d-\\x7e]|" + k + "|" + m + ")";
+let p = '[^\'"\\n\\f\\\\]|\\\\[\\s\\S]';
+let q = '"(?:\'|' + p + ')*"' + '|\'(?:\"|' + p + ')*\'';
+let r = "[-+]?(?:[0-9]+(?:[.][0-9]+)?|[.][0-9]+)";
+let t = "(?:[a-zA-Z_]|" + k + "|" + m + ")";
+let u = "(?:[a-zA-Z0-9_-]|" + k + "|" + m + ")";
+let v = u + "+";
+let I = "-?" + t + u + "*";
+let x = "(?:@?-?" + t + "|#)" + u + "*";
+let y = r + "(?:%|" + I + ")?";
+let z = "url[(]" + W + "(?:" + q + "|" + o + "*)" + W + "[)]";
+let B = "U[+][0-9A-F?]{1,6}(?:-[0-9A-F]{1,6})?";
+let C = "<\!--";
+let F = "-->";
+let S = g + "+";
+let G = "/(?:[*][^*]*[*]+(?:[^/][^*]*[*]+)*/|/[^\\n\\f]*)";
+let J = "(?!url[(])" + I + "[(]";
+let R = "[~|^$*]=";
+let T = '[^"\'\\\\/]|/(?![/*])';
+let V = "\\uFEFF";
+let Y = [V, B, z, J, x, q, y, C, F, S, G, R, T].join("|");
+
+function ComplexGlobalCaseInsensitiveMatch() {
+ // keep the RegExp in the measurement but not string concat nor join.
+ let X = new RegExp(Y, "gi");
+ "abcſABCβκς".match(X);
+ "color:".match(X);
+}
+
+benchmarks = [ [ComplexGlobalCaseInsensitiveMatch, () => {}],
+ ];
+
+createBenchmarkSuite("ComplexCaseInsensitiveTest");
diff --git a/src/v8/test/js-perf-test/RegExp/inline_test.js b/src/v8/test/js-perf-test/RegExp/inline_test.js
new file mode 100644
index 0000000..09998ad
--- /dev/null
+++ b/src/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/src/v8/test/js-perf-test/RegExp/run.js b/src/v8/test/js-perf-test/RegExp/run.js
index c9ffc57..aedb5e9 100644
--- a/src/v8/test/js-perf-test/RegExp/run.js
+++ b/src/v8/test/js-perf-test/RegExp/run.js
@@ -8,6 +8,9 @@
load('ctor.js');
load('exec.js');
load('flags.js');
+load('inline_test.js')
+load('complex_case_test.js');
+load('case_test.js');
load('match.js');
load('replace.js');
load('search.js');
diff --git a/src/v8/test/js-perf-test/SixSpeed.json b/src/v8/test/js-perf-test/SixSpeed.json
index a2fb560..368fa40 100644
--- a/src/v8/test/js-perf-test/SixSpeed.json
+++ b/src/v8/test/js-perf-test/SixSpeed.json
@@ -1,4 +1,5 @@
{
+ "owners": ["jarin@chromium.org", "mvstanton@chromium.org"],
"name": "SixSpeed",
"run_count": 3,
"run_count_arm": 1,
@@ -93,7 +94,6 @@
{
"name": "Spread",
"path": ["SixSpeed"],
- "flags": ["--future"],
"results_regexp": "^%s\\(Score\\): (.+)$",
"tests": [
{
@@ -144,7 +144,6 @@
{
"name": "SuperSpread",
"path": ["SixSpeed"],
- "flags": ["--future"],
"results_regexp": "^%s\\(Score\\): (.+)$",
"tests": [
{
@@ -170,7 +169,6 @@
{
"name": "SpreadLiteral",
"path": ["SixSpeed"],
- "flags": ["--future"],
"results_regexp": "^%s\\(Score\\): (.+)$",
"tests": [
{
diff --git a/src/v8/test/js-perf-test/SpreadCallsGeneral/run.js b/src/v8/test/js-perf-test/SpreadCallsGeneral/run.js
new file mode 100644
index 0000000..9f8db96
--- /dev/null
+++ b/src/v8/test/js-perf-test/SpreadCallsGeneral/run.js
@@ -0,0 +1,69 @@
+// 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 foo(...args) {
+ if (args.length != 4) throw 666;
+}
+
+const front = [1, 2];
+const mid = 3;
+const back = function*() { yield 4 };
+
+
+// ----------------------------------------------------------------------------
+// Benchmark: SpreadCall
+// ----------------------------------------------------------------------------
+
+function SpreadCall() {
+ foo(...front, mid, ...back());
+}
+
+
+// ----------------------------------------------------------------------------
+// Benchmark: SpreadCallSpreadLiteral
+// ----------------------------------------------------------------------------
+
+function SpreadCallSpreadLiteral() {
+ foo(...[...front, mid, ...back()]);
+}
+
+
+// ----------------------------------------------------------------------------
+// Benchmark: ApplySpreadLiteral
+// ----------------------------------------------------------------------------
+
+function ApplySpreadLiteral() {
+ foo.apply(this, [...front, mid, ...back()]);
+}
+
+
+// ----------------------------------------------------------------------------
+// Setup and Run
+// ----------------------------------------------------------------------------
+
+load('../base.js');
+
+var success = true;
+
+function PrintResult(name, result) {
+ print(name + '-SpreadCallsGeneral(Score): ' + result);
+}
+
+function PrintError(name, error) {
+ PrintResult(name, error);
+ success = false;
+}
+
+function CreateBenchmark(name, f) {
+ new BenchmarkSuite(name, [100], [ new Benchmark(name, false, false, 0, f) ]);
+}
+
+CreateBenchmark('ApplySpreadLiteral', ApplySpreadLiteral);
+CreateBenchmark('SpreadCall', SpreadCall);
+CreateBenchmark('SpreadCallSpreadLiteral', SpreadCallSpreadLiteral);
+
+BenchmarkSuite.config.doWarmup = true;
+BenchmarkSuite.config.doDeterministic = undefined;
+BenchmarkSuite.RunSuites({NotifyResult: PrintResult, NotifyError: PrintError});
diff --git a/src/v8/test/js-perf-test/StackTrace/capture.js b/src/v8/test/js-perf-test/StackTrace/capture.js
new file mode 100644
index 0000000..54cb292
--- /dev/null
+++ b/src/v8/test/js-perf-test/StackTrace/capture.js
@@ -0,0 +1,52 @@
+// Copyright 2019 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() {
+
+function Simple() {
+ new Error("Simple Error");
+}
+
+class CustomError extends Error {};
+function Custom() {
+ new CustomError("Custom Error");
+}
+
+function Inline() {
+ function Inner() {
+ new Error("Error from inlined function!");
+ }
+ function Middle() { Inner(); }
+ function Outer() { Middle(); }
+
+ %PrepareFunctionForOptimization(Outer);
+ Outer();
+ Outer();
+ %OptimizeFunctionOnNextCall(Outer);
+ Outer();
+}
+
+const kInitialRecursionValue = 10;
+function Recursive() {
+ function StepOne(val) {
+ if (val <= 0) return new Error("Error in StepOne!");
+ StepTwo(val - 3);
+ StepTwo(val - 4);
+ }
+ function StepTwo(val) {
+ if (val <= 0) return new Error("Error in StepTwo!");
+ StepOne(val - 1);
+ StepOne(val - 2);
+ }
+
+ StepOne(kInitialRecursionValue);
+}
+
+createSuite('Simple-Capture-Error', 1000, Simple, () => {});
+createSuite('Custom-Capture-Error', 1000, Custom, () => {});
+
+createSuite('Inline-Capture-Error', 1000, Inline, () => {});
+createSuite('Recursive-Capture-Error', 1000, Recursive, () => {});
+
+})();
diff --git a/src/v8/test/js-perf-test/StackTrace/run.js b/src/v8/test/js-perf-test/StackTrace/run.js
new file mode 100644
index 0000000..2ceba4c
--- /dev/null
+++ b/src/v8/test/js-perf-test/StackTrace/run.js
@@ -0,0 +1,25 @@
+// Copyright 2019 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('serialize.js');
+load('capture.js');
+
+function PrintResult(name, result) {
+ print(name + '-StackTrace(Score): ' + result);
+}
+
+function PrintStep(name) {}
+
+function PrintError(name, error) {
+ PrintResult(name, error);
+}
+
+BenchmarkSuite.config.doWarmup = undefined;
+BenchmarkSuite.config.doDeterministic = undefined;
+
+BenchmarkSuite.RunSuites({ NotifyResult: PrintResult,
+ NotifyError: PrintError,
+ NotifyStep: PrintStep });
diff --git a/src/v8/test/js-perf-test/StackTrace/serialize.js b/src/v8/test/js-perf-test/StackTrace/serialize.js
new file mode 100644
index 0000000..a3dac31
--- /dev/null
+++ b/src/v8/test/js-perf-test/StackTrace/serialize.js
@@ -0,0 +1,89 @@
+// Copyright 2019 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() {
+
+const kErrorCount = 100000;
+let errorsCreatedBySetup;
+
+function CreateErrors(fn) {
+ counter = 0;
+ errorsCreatedBySetup = [];
+ for (let i = 0; i < kErrorCount; ++i) {
+ errorsCreatedBySetup[i] = fn();
+ }
+}
+
+function SimpleSetup() {
+ CreateErrors(() => new Error("Simple Error"));
+}
+
+class CustomError extends Error {};
+function CustomSetup() {
+ CreateErrors(() => new CustomError("Custom Error"));
+}
+
+function InlineSetup() {
+ function Inner() {
+ return new Error("Throwing from inlined function!");
+ }
+ function Middle() { return Inner(); }
+ function Outer() { return Middle(); }
+
+ %PrepareFunctionForOptimization(Outer);
+ Outer();
+ Outer();
+ %OptimizeFunctionOnNextCall(Outer);
+ Outer();
+
+ CreateErrors(() => Outer());
+}
+
+const kInitialRecursionValue = 12;
+function RecursiveSetup() {
+ counter = 0;
+ errorsCreatedBySetup = [];
+ function StepOne(val) {
+ if (val <= 0) {
+ errorsCreatedBySetup.push(new Error("Error in StepOne!"));
+ return;
+ }
+ StepTwo(val - 3);
+ StepTwo(val - 4);
+ }
+ function StepTwo(val) {
+ if (val <= 0) {
+ errorsCreatedBySetup.push(new Error("Error in StepTwo!"));
+ return;
+ }
+ StepOne(val - 1);
+ StepOne(val - 2);
+ }
+
+ while (errorsCreatedBySetup.length < kErrorCount) {
+ StepOne(kInitialRecursionValue);
+ }
+}
+
+let counter;
+function SerializeStack() {
+ if (counter < errorsCreatedBySetup.length) {
+ // Trigger serialization by accessing Error.stack.
+ %FlattenString(errorsCreatedBySetup[counter++].stack);
+ } else {
+ // All errors are serialized. The stack trace string is now cached, so
+ // re-iterating the array is a simple property lookup. Instead,
+ // a simple Error object is created and serialized, otherwise the benchmark
+ // result would fluctuate heavily if it reaches the end.
+ %FlattenString(new Error().stack);
+ }
+}
+
+createSuite('Simple-Serialize-Error.stack', 1000, SerializeStack, SimpleSetup);
+createSuite('Custom-Serialize-Error.stack', 1000, SerializeStack, CustomSetup);
+
+createSuite('Inline-Serialize-Error.stack', 1000, SerializeStack, InlineSetup);
+createSuite('Recursive-Serialize-Error.stack', 1000, SerializeStack, RecursiveSetup);
+
+})();
diff --git a/src/v8/test/js-perf-test/StringIterators/string-iterator.js b/src/v8/test/js-perf-test/StringIterators/string-iterator.js
index c559254..e465264 100644
--- a/src/v8/test/js-perf-test/StringIterators/string-iterator.js
+++ b/src/v8/test/js-perf-test/StringIterators/string-iterator.js
@@ -2,37 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-function assert(expression, message) {
- if (typeof expression === "string" && message === void 0) {
- message = expression;
- expression = eval(expression);
- }
-
- if (!expression) {
- var lines = ["Benchmark Error"];
- if (message !== void 0) {
- lines = ["Benchmark Error:", String(message)];
- }
- throw new Error(lines.join("\n"));
- }
- return true;
-}
-
-assert.same = function(expected, actual, message) {
- var isSame =
- expected === actual || typeof expected !== expected && actual !== actual;
- if (!isSame) {
- var details = `Expected: ${String(expected)}\n` +
- `But found: ${String(actual)}`;
- var lines = ["Benchmark Error:", details];
- if (message !== void 0) {
- lines = ["Benchmark Error:", details, "", String(message)];
- }
- throw new Error(lines.join("\n"));
- }
- return true;
-}
-
new BenchmarkSuite('Spread_OneByteShort', [1000], [
new Benchmark('test', false, false, 0,
Spread_OneByteShort, Spread_OneByteShortSetup,
@@ -52,8 +21,8 @@
function Spread_OneByteShortTearDown() {
var expected = "A|l|p|h|a|b|e|t|-|S|o|u|p";
- return assert("Array.isArray(result)")
- && assert.same(expected, result.join("|"));
+ assert(Array.isArray(result));
+ assertEquals(expected, result.join("|"));
}
// ----------------------------------------------------------------------------
@@ -75,8 +44,8 @@
function Spread_TwoByteShortTearDown() {
var expected = "\u5FCD|\u8005|\u306E|\u653B|\u6483";
- return assert("Array.isArray(result)")
- && assert.same(expected, result.join("|"));
+ assert(Array.isArray(result));
+ assertEquals(expected, result.join("|"));
}
// ----------------------------------------------------------------------------
@@ -100,8 +69,8 @@
function Spread_WithSurrogatePairsShortTearDown() {
var expected =
"\uD83C\uDF1F|\u5FCD|\u8005|\u306E|\u653B|\u6483|\uD83C\uDF1F";
- return assert("Array.isArray(result)")
- && assert.same(expected, result.join("|"));
+ assert(Array.isArray(result));
+ assertEquals(expected, result.join("|"));
}
// ----------------------------------------------------------------------------
@@ -123,7 +92,7 @@
}
function ForOf_OneByteShortTearDown() {
- return assert.same(string, result);
+ assertEquals(string, result);
}
// ----------------------------------------------------------------------------
@@ -145,7 +114,7 @@
}
function ForOf_TwoByteShortTearDown() {
- return assert.same(string, result);
+ assertEquals(string, result);
}
// ----------------------------------------------------------------------------
@@ -168,7 +137,7 @@
}
function ForOf_WithSurrogatePairsShortTearDown() {
- return assert.same(string, result);
+ assertEquals(string, result);
}
// ----------------------------------------------------------------------------
@@ -190,7 +159,7 @@
}
function ForOf_OneByteLongTearDown() {
- return assert.same(string, result);
+ assertEquals(string, result);
}
// ----------------------------------------------------------------------------
@@ -212,7 +181,7 @@
}
function ForOf_TwoByteLongTearDown() {
- return assert.same(string, result);
+ assertEquals(string, result);
}
// ----------------------------------------------------------------------------
@@ -235,5 +204,5 @@
}
function ForOf_WithSurrogatePairsLongTearDown() {
- return assert.same(string, result);
+ assertEquals(string, result);
}
diff --git a/src/v8/test/js-perf-test/Strings/harmony-string.js b/src/v8/test/js-perf-test/Strings/harmony-string.js
index c2eac4e..cbab3d9 100644
--- a/src/v8/test/js-perf-test/Strings/harmony-string.js
+++ b/src/v8/test/js-perf-test/Strings/harmony-string.js
@@ -2,19 +2,39 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-new BenchmarkSuite('StringFunctions', [1000], [
+new BenchmarkSuite('StringRepeat', [10], [
new Benchmark('StringRepeat', false, false, 0,
- Repeat, RepeatSetup, RepeatTearDown),
+ Repeat, RepeatSetup, RepeatTearDown),
+]);
+
+new BenchmarkSuite('StringStartsWith', [10], [
new Benchmark('StringStartsWith', false, false, 0,
- StartsWith, WithSetup, WithTearDown),
+ StartsWith, WithSetup, WithTearDown),
+]);
+
+new BenchmarkSuite('StringEndsWith', [10], [
new Benchmark('StringEndsWith', false, false, 0,
- EndsWith, WithSetup, WithTearDown),
+ EndsWith, WithSetup, WithTearDown),
+]);
+
+new BenchmarkSuite('StringIncludes', [10], [
new Benchmark('StringIncludes', false, false, 0,
- Includes, IncludesSetup, WithTearDown),
+ Includes, IncludesSetup, WithTearDown),
+]);
+
+new BenchmarkSuite('StringFromCodePoint', [10000], [
new Benchmark('StringFromCodePoint', false, false, 0,
- FromCodePoint, FromCodePointSetup, FromCodePointTearDown),
+ FromCodePoint, FromCodePointSetup, FromCodePointTearDown),
+]);
+
+new BenchmarkSuite('StringCodePointAt', [1000], [
new Benchmark('StringCodePointAt', false, false, 0,
- CodePointAt, CodePointAtSetup, CodePointAtTearDown),
+ CodePointAt, CodePointAtSetup, CodePointAtTearDown),
+]);
+
+new BenchmarkSuite('StringCodePointAtSum', [100000], [
+ new Benchmark('StringCodePointAtSum', false, true, 3,
+ CodePointAtSum, CodePointAtSumSetup),
]);
@@ -32,7 +52,7 @@
function RepeatTearDown() {
var expected = "";
- for(var i = 0; i < 1000; i++) {
+ for (var i = 0; i < 1000; i++) {
expected += stringRepeatSource;
}
return result === expected;
@@ -70,19 +90,20 @@
}
var MAX_CODE_POINT = 0xFFFFF;
+const K = 1024;
function FromCodePointSetup() {
- result = new Array(MAX_CODE_POINT + 1);
+ result = new Array((MAX_CODE_POINT + 1) / K);
}
function FromCodePoint() {
- for (var i = 0; i <= MAX_CODE_POINT; i++) {
+ for (var i = 0; i <= MAX_CODE_POINT; i += K) {
result[i] = String.fromCodePoint(i);
}
}
function FromCodePointTearDown() {
- for (var i = 0; i <= MAX_CODE_POINT; i++) {
+ for (var i = 0; i <= MAX_CODE_POINT; i += K) {
if (i !== result[i].codePointAt(0)) return false;
}
return true;
@@ -92,8 +113,8 @@
var allCodePoints;
function CodePointAtSetup() {
- allCodePoints = new Array(MAX_CODE_POINT + 1);
- for (var i = 0; i <= MAX_CODE_POINT; i++) {
+ allCodePoints = new Array((MAX_CODE_POINT + 1) / K);
+ for (var i = 0; i <= MAX_CODE_POINT; i += K) {
allCodePoints = String.fromCodePoint(i);
}
result = undefined;
@@ -101,11 +122,24 @@
function CodePointAt() {
result = 0;
- for (var i = 0; i <= MAX_CODE_POINT; i++) {
+ for (var i = 0; i <= MAX_CODE_POINT; i += K) {
result += allCodePoints.codePointAt(i);
}
}
function CodePointAtTearDown() {
- return result === MAX_CODE_POINT * (MAX_CODE_POINT + 1) / 2;
+ return result === (MAX_CODE_POINT / K) * ((MAX_CODE_POINT / K) + 1) / 2;
+}
+
+var payload;
+
+function CodePointAtSumSetup() {
+ payload = "abcdefghijklmnopqrstuvwxyz";
+ for(var j = 0; j < 16; ++j) payload += payload;
+}
+
+function CodePointAtSum() {
+ var c = 0;
+ for(j=payload.length-1; j >=0; --j) c+=payload.charCodeAt(j);
+ return c;
}
diff --git a/src/v8/test/js-perf-test/Strings/run.js b/src/v8/test/js-perf-test/Strings/run.js
index 66dd9b2..b94f14f 100644
--- a/src/v8/test/js-perf-test/Strings/run.js
+++ b/src/v8/test/js-perf-test/Strings/run.js
@@ -4,9 +4,7 @@
load('../base.js');
-load('harmony-string.js');
-load('string-indexof.js');
-
+load(arguments[0] + '.js');
var success = true;
@@ -20,7 +18,6 @@
success = false;
}
-
BenchmarkSuite.config.doWarmup = undefined;
BenchmarkSuite.config.doDeterministic = undefined;
diff --git a/src/v8/test/js-perf-test/Strings/string-indexof.js b/src/v8/test/js-perf-test/Strings/string-indexof.js
index a2049e0..1e077bc 100644
--- a/src/v8/test/js-perf-test/Strings/string-indexof.js
+++ b/src/v8/test/js-perf-test/Strings/string-indexof.js
@@ -34,36 +34,3 @@
return sum;
}
-
-new BenchmarkSuite('StringCharCodeAtConstant', [3], [
- new Benchmark('StringIndexOfConstant', true, false, 0,
- StringCharCodeAtConstant),
-]);
-
-new BenchmarkSuite('StringCharCodeAtNonConstant', [3], [
- new Benchmark('StringIndexOfNonConstant', true, false, 0,
- StringCharCodeAtNonConstant),
-]);
-
-const string = "qweruiplkjhgfdsazxccvbnm";
-const indices = [1, 13, 32, 100, "xx"];
-
-function StringCharCodeAtConstant() {
- var sum = 0;
-
- for (var j = 0; j < indices.length - 1; ++j) {
- sum += string.charCodeAt(indices[j] | 0);
- }
-
- return sum;
-}
-
-function StringCharCodeAtNonConstant() {
- var sum = 0;
-
- for (var j = 0; j < indices.length - 1; ++j) {
- sum += string.charCodeAt(indices[j]);
- }
-
- return sum;
-}
diff --git a/src/v8/test/js-perf-test/Strings/string-localeCompare.js b/src/v8/test/js-perf-test/Strings/string-localeCompare.js
new file mode 100644
index 0000000..6c8b609
--- /dev/null
+++ b/src/v8/test/js-perf-test/Strings/string-localeCompare.js
@@ -0,0 +1,19 @@
+// 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.
+
+new BenchmarkSuite('StringLocaleCompare', [1000000], [
+ new Benchmark('StringLocaleCompare', false, false, 0,
+ StringLocaleCompare),
+]);
+
+function StringLocaleCompare() {
+ var array = ["XYZ", "mno", "abc", "EFG", "ijk", "123", "tuv", "234", "efg"];
+
+ var sum = 0;
+ for (var j = 0; j < array.length; ++j) {
+ sum += "fox".localeCompare(array[j]);
+ }
+
+ return sum;
+}
diff --git a/src/v8/test/js-perf-test/Strings/string-matchall.js b/src/v8/test/js-perf-test/Strings/string-matchall.js
new file mode 100644
index 0000000..2b86d50
--- /dev/null
+++ b/src/v8/test/js-perf-test/Strings/string-matchall.js
@@ -0,0 +1,77 @@
+// 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 Internalize(s) {
+ return Object.keys({[s]:0})[0];
+}
+
+const string = Internalize('a'.repeat(100));
+let pattern;
+let result;
+
+const setupString = () => pattern = '.';
+const setupRegExp = () => pattern = /./g;
+const setupZeroWidth = () => pattern = /(?:)/g;
+const setupZeroWidthUnicode = () => pattern = /(?:)/gu;
+
+function benchIteratorCreation() {
+ result = string.matchAll(pattern);
+}
+
+function benchBuiltin() {
+ for (const match of string.matchAll(pattern)) {
+ result = match[0];
+ }
+}
+
+function benchManualString() {
+ let regexp = new RegExp(pattern, 'g');
+ let match;
+ while ((match = regexp.exec(string)) !== null) {
+ result = match[0];
+ }
+}
+
+function benchManualRegExp() {
+ let match;
+ while ((match = pattern.exec(string)) !== null) {
+ result = match[0];
+ }
+}
+
+// Iterator Creation
+new BenchmarkSuite('StringMatchAllBuiltinRegExpIteratorCreation', [20], [
+ new Benchmark('StringMatchAllBuiltinRegExpIteratorCreation', false, false, 0, benchIteratorCreation, setupRegExp)
+]);
+new BenchmarkSuite('StringMatchAllBuiltinStringIteratorCreation', [20], [
+ new Benchmark('StringMatchAllBuiltinStringIteratorCreation', false, false, 0, benchIteratorCreation, setupString)
+]);
+
+// String
+new BenchmarkSuite('StringMatchAllBuiltinString', [20], [
+ new Benchmark('StringMatchAllBuiltinString', false, false, 0, benchBuiltin, setupString)
+]);
+new BenchmarkSuite('StringMatchAllManualString', [20], [
+ new Benchmark('StringMatchAllManualString', false, false, 0, benchManualString, setupString)
+]);
+
+// RegExp
+new BenchmarkSuite('StringMatchAllBuiltinRegExp', [20], [
+ new Benchmark('StringMatchAllBuiltinRegExp', false, false, 0, benchBuiltin, setupRegExp)
+]);
+new BenchmarkSuite('StringMatchAllManualRegExp', [20], [
+ new Benchmark('StringMatchAllManualRegExp', false, false, 0, benchManualRegExp, setupRegExp)
+]);
+
+// Zero width
+new BenchmarkSuite('StringMatchAllBuiltinZeroWidth', [20], [
+ new Benchmark('StringMatchAllBuiltinZeroWidth', false, false, 0, benchBuiltin, setupZeroWidth)
+]);
+new BenchmarkSuite('StringMatchAllBuiltinZeroWidthUnicode', [20], [
+ new Benchmark('StringMatchAllBuiltinZeroWidthUnicode', false, false, 0, benchBuiltin, setupZeroWidthUnicode)
+]);
+
+})();
diff --git a/src/v8/test/js-perf-test/Strings/string-normalize.js b/src/v8/test/js-perf-test/Strings/string-normalize.js
new file mode 100644
index 0000000..21a8a59
--- /dev/null
+++ b/src/v8/test/js-perf-test/Strings/string-normalize.js
@@ -0,0 +1,38 @@
+// Copyright 2019 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('StringNormalize', [5], [
+ new Benchmark('StringNormalize', false, false, 0,
+ StringNormalize),
+]);
+new BenchmarkSuite('StringNormalizeNFD', [5], [
+ new Benchmark('StringNormalizeNFD', false, false, 0,
+ StringNormalizeNFD),
+]);
+new BenchmarkSuite('StringNormalizeNFKC', [5], [
+ new Benchmark('StringNormalizeNFKC', false, false, 0,
+ StringNormalizeNFKC),
+]);
+new BenchmarkSuite('StringNormalizeNFKD', [5], [
+ new Benchmark('StringNormalizeNFKD', false, false, 0,
+ StringNormalizeNFKD),
+]);
+
+const shortString = "àèìòùáéíóúäëïöüÿâêîôûãõñ";
+
+function StringNormalize() {
+ return shortString.normalize();
+}
+
+function StringNormalizeNFD() {
+ return shortString.normalize("NFD");
+}
+
+function StringNormalizeNFKC() {
+ return shortString.normalize("NFKC");
+}
+
+function StringNormalizeNFKD() {
+ return shortString.normalize("NFKD");
+}
diff --git a/src/v8/test/js-perf-test/Strings/string-split.js b/src/v8/test/js-perf-test/Strings/string-split.js
new file mode 100644
index 0000000..432129f
--- /dev/null
+++ b/src/v8/test/js-perf-test/Strings/string-split.js
@@ -0,0 +1,81 @@
+// 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.
+
+new BenchmarkSuite('ShortSubjectEmptySeparator', [5], [
+ new Benchmark('ShortSubjectEmptySeparator', true, false, 0,
+ ShortSubjectEmptySeparator),
+]);
+
+new BenchmarkSuite('LongSubjectEmptySeparator', [1000], [
+ new Benchmark('LongSubjectEmptySeparator', true, false, 0,
+ LongSubjectEmptySeparator),
+]);
+
+new BenchmarkSuite('ShortTwoBytesSubjectEmptySeparator', [5], [
+ new Benchmark('ShortTwoBytesSubjectEmptySeparator', true, false, 0,
+ ShortTwoBytesSubjectEmptySeparator),
+]);
+
+new BenchmarkSuite('LongTwoBytesSubjectEmptySeparator', [1000], [
+ new Benchmark('LongTwoBytesSubjectEmptySeparator', true, false, 0,
+ LongTwoBytesSubjectEmptySeparator),
+]);
+
+new BenchmarkSuite('ShortSubject', [5], [
+ new Benchmark('ShortSubject', true, false, 0,
+ ShortSubject),
+]);
+
+new BenchmarkSuite('LongSubject', [1000], [
+ new Benchmark('LongSubject', true, false, 0,
+ LongSubject),
+]);
+
+new BenchmarkSuite('ShortTwoBytesSubject', [5], [
+ new Benchmark('ShortTwoBytesSubject', true, false, 0,
+ ShortTwoBytesSubject),
+]);
+
+new BenchmarkSuite('LongTwoBytesSubject', [1000], [
+ new Benchmark('LongTwoBytesSubject', true, false, 0,
+ LongTwoBytesSubject),
+]);
+
+const shortString = "ababaabcdeaaaaaab";
+const shortTwoBytesString = "\u0429\u0428\u0428\u0429\u0429\u0429\u0428\u0429\u0429";
+// Use Array.join to create a flat string
+const longString = new Array(0x500).fill("abcde").join('');
+const longTwoBytesString = new Array(0x500).fill("\u0427\u0428\u0429\u0430").join('');
+
+function ShortSubjectEmptySeparator() {
+ shortString.split('');
+}
+
+function LongSubjectEmptySeparator() {
+ longString.split('');
+}
+
+function ShortTwoBytesSubjectEmptySeparator() {
+ shortTwoBytesString.split('');
+}
+
+function LongTwoBytesSubjectEmptySeparator() {
+ longTwoBytesString.split('');
+}
+
+function ShortSubject() {
+ shortString.split('a');
+}
+
+function LongSubject() {
+ longString.split('a');
+}
+
+function ShortTwoBytesSubject() {
+ shortTwoBytesString.split('\u0428');
+}
+
+function LongTwoBytesSubject() {
+ longTwoBytesString.split('\u0428');
+}
diff --git a/src/v8/test/js-perf-test/Strings/string-startsendswith-comp.js b/src/v8/test/js-perf-test/Strings/string-startsendswith-comp.js
new file mode 100644
index 0000000..71484d2
--- /dev/null
+++ b/src/v8/test/js-perf-test/Strings/string-startsendswith-comp.js
@@ -0,0 +1,47 @@
+// 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 createSuiteWithWarmup( name, count, fn) {
+ new BenchmarkSuite(name, [count], [
+ new Benchmark(name, true, false, 0, fn),
+ ]);
+}
+
+const inputs = [
+ 'I\xF1t\xEBrn\xE2ti\xF4n\xE0liz\xE6ti\xF8n\u2603\uD83D\uDCA9\uFFFD',
+ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
+ 'Integer eu augue suscipit, accumsan ipsum nec, sagittis sem.',
+ 'In vitae pellentesque dolor. Curabitur leo nunc, luctus vitae',
+ 'risus eget, fermentum hendrerit justo.',
+];
+const first = 'I';
+
+function helper(fn) {
+ let sum = 0;
+ for (const input of inputs) {
+ sum += fn(input);
+ }
+ return sum;
+}
+
+function startsWith(string) {
+ return string.startsWith(first);
+}
+
+function startsIndex(string) {
+ return string[0] === first;
+}
+
+function endsWith(string) {
+ return string.endsWith(first);
+}
+
+function endsIndex(string) {
+ return string[string.length - 1] === first;
+}
+
+createSuiteWithWarmup('startsWith', 1, () => helper(startsWith));
+createSuiteWithWarmup('startsIndex', 1, () => helper(startsIndex));
+createSuiteWithWarmup('endsWith', 1, () => helper(endsWith));
+createSuiteWithWarmup('endsIndex', 1, () => helper(endsIndex));
diff --git a/src/v8/test/js-perf-test/Strings/string-startswith.js b/src/v8/test/js-perf-test/Strings/string-startswith.js
new file mode 100644
index 0000000..4b0379b
--- /dev/null
+++ b/src/v8/test/js-perf-test/Strings/string-startswith.js
@@ -0,0 +1,78 @@
+// Copyright 2019 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 createSuite(name, count, fn) {
+ new BenchmarkSuite(name, [count], [new Benchmark(name, true, false, 0, fn)]);
+}
+
+const inputs = [
+ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
+ 'Integer eu augue suscipit, accumsan ipsum nec, sagittis sem.',
+ 'In vitae pellentesque dolor. Curabitur leo nunc, luctus vitae',
+ 'risus eget, fermentum hendrerit justo.',
+ 'hello'.repeat(1024),
+ 'h',
+ ''
+];
+const firsts = ['I', 'Integer', 'Lorem', 'risus', 'hello'];
+
+function simpleHelper() {
+ let sum = 0;
+ for (const input of inputs) {
+ for (const first of firsts) {
+ sum += input.startsWith(first);
+ }
+ }
+ return sum;
+}
+
+function consInputHelper() {
+ let sum = 0;
+ for (const inputOne of inputs) {
+ for (const inputTwo of inputs) {
+ for (const first of firsts) {
+ // Skip if the length is too small for %ConstructConsString
+ if (inputOne.length + inputTwo.length < 13) break;
+ sum += %ConstructConsString(inputOne, inputTwo).startsWith(first);
+ }
+ }
+ }
+ return sum;
+}
+
+function consFirstHelper() {
+ let sum = 0;
+ for (const input of inputs) {
+ for (const firstOne of firsts) {
+ for (const firstTwo of firsts) {
+ // Skip if the length is too small for %ConstructConsString
+ if (firstOne.length + firstTwo.length < 13) break;
+ sum += input.startsWith(%ConstructConsString(firstOne, firstTwo));
+ }
+ }
+ }
+ return sum;
+}
+
+function doubleConsHelper() {
+ let sum = 0;
+ for (const inputOne of inputs) {
+ for (const inputTwo of inputs) {
+ for (const firstOne of firsts) {
+ for (const firstTwo of firsts) {
+ // Skip if the length is too small for %ConstructConsString
+ if (inputOne.length + inputTwo.length < 13 || firstOne.length + firstTwo.length) break;
+ sum += % ConstructConsString(inputOne, inputTwo).startsWith(
+ % ConstructConsString(firstOne, firstTwo)
+ );
+ }
+ }
+ }
+ }
+}
+
+createSuite('DirectStringsDirectSearch', 1000, simpleHelper);
+createSuite('ConsStringsDirectSearch', 1000, consInputHelper);
+createSuite('DirectStringsConsSearch', 1000, consFirstHelper);
+createSuite('ConsStringsConsSearch', 1000, doubleConsHelper);
diff --git a/src/v8/test/js-perf-test/Strings/string-stringat-comp.js b/src/v8/test/js-perf-test/Strings/string-stringat-comp.js
new file mode 100644
index 0000000..deb95e1
--- /dev/null
+++ b/src/v8/test/js-perf-test/Strings/string-stringat-comp.js
@@ -0,0 +1,44 @@
+// 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.
+
+const input = 'äϠ�𝌆 Lorem ipsum test test';
+
+function helper(fn) {
+ var sum = 0;
+ for (var i = 0; i < input.length; i++) {
+ sum += fn(input, i, i);
+ }
+ return sum;
+}
+
+function charCodeAt(str, i) {
+ return str.charCodeAt(i) === 116;
+}
+
+function charCodeAtBoth(str, i, j) {
+ return str.charCodeAt(j) == str.charCodeAt(i);
+}
+
+function charAt(str, i) {
+ return 't' == str.charAt(i);
+}
+
+function charAtNever(str, i) {
+ return '𝌆' == str.charAt(i);
+}
+
+function charAtBoth(str, i, j) {
+ return str.charAt(j) == str.charAt(i);
+}
+
+function stringIndex(str, i) {
+ return str[i] === 't';
+}
+
+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/src/v8/test/js-perf-test/Strings/string-stringat.js b/src/v8/test/js-perf-test/Strings/string-stringat.js
new file mode 100644
index 0000000..1e0be73
--- /dev/null
+++ b/src/v8/test/js-perf-test/Strings/string-stringat.js
@@ -0,0 +1,129 @@
+// 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('StringCharCodeAtConstant', [3], [
+ new Benchmark('StringCharCodeAtConstant', true, false, 0,
+ StringCharCodeAtConstant),
+]);
+
+new BenchmarkSuite('StringCharCodeAtNonConstant', [3], [
+ new Benchmark('StringCharCodeAtNonConstant', true, false, 0,
+ StringCharCodeAtNonConstant),
+]);
+
+new BenchmarkSuite('StringCharCodeAtConstantInbounds', [3], [
+ new Benchmark('StringCharCodeAtConstantInbounds', true, false, 0,
+ StringCharCodeAtConstantInbounds),
+]);
+
+new BenchmarkSuite('StringCharCodeAtNonConstantInbounds', [3], [
+ new Benchmark('StringCharCodeAtNonConstantInbounds', true, false, 0,
+ StringCharCodeAtNonConstantInbounds),
+]);
+
+const string = "qweruiplkjhgfdsazxccvbnm";
+const indices = [1, 13, 32, 100, "xx"];
+const indicesInbounds = [1, 7, 13, 17, "xx"];
+
+function StringCharCodeAtConstant() {
+ var sum = 0;
+
+ for (var j = 0; j < indices.length - 1; ++j) {
+ sum += string.charCodeAt(indices[j] | 0);
+ }
+
+ return sum;
+}
+
+function StringCharCodeAtNonConstant() {
+ var sum = 0;
+
+ for (var j = 0; j < indices.length - 1; ++j) {
+ sum += string.charCodeAt(indices[j]);
+ }
+
+ return sum;
+}
+
+function StringCharCodeAtConstantInbounds() {
+ var sum = 0;
+
+ for (var j = 0; j < indicesInbounds.length - 1; ++j) {
+ sum += string.charCodeAt(indicesInbounds[j] | 0);
+ }
+
+ return sum;
+}
+
+function StringCharCodeAtNonConstantInbounds() {
+ var sum = 0;
+
+ for (var j = 0; j < indicesInbounds.length - 1; ++j) {
+ sum += string.charCodeAt(indicesInbounds[j]);
+ }
+
+ return sum;
+}
+
+new BenchmarkSuite('StringCodePointAtConstant', [3], [
+ new Benchmark('StringCodePointAtConstant', true, false, 0,
+ StringCodePointAtConstant),
+]);
+
+new BenchmarkSuite('StringCodePointAtNonConstant', [3], [
+ new Benchmark('StringCodePointAtNonConstant', true, false, 0,
+ StringCodePointAtNonConstant),
+]);
+
+new BenchmarkSuite('StringCodePointAtConstantInbounds', [3], [
+ new Benchmark('StringCodePointAtConstantInbounds', true, false, 0,
+ StringCodePointAtConstantInbounds),
+]);
+
+new BenchmarkSuite('StringCodePointAtNonConstantInbounds', [3], [
+ new Benchmark('StringCodePointAtNonConstantInbounds', true, false, 0,
+ StringCodePointAtNonConstantInbounds),
+]);
+
+const unicode_string = "qweräϠ�𝌆krefdäϠ�𝌆ccäϠ�𝌆";
+
+function StringCodePointAtConstant() {
+ var sum = 0;
+
+ for (var j = 0; j < indices.length - 1; ++j) {
+ sum += unicode_string.codePointAt(indices[j] | 0);
+ }
+
+ return sum;
+}
+
+function StringCodePointAtNonConstant() {
+ var sum = 0;
+
+ for (var j = 0; j < indices.length - 1; ++j) {
+ sum += unicode_string.codePointAt(indices[j]);
+ }
+
+ return sum;
+}
+
+function StringCodePointAtConstantInbounds() {
+ var sum = 0;
+
+ for (var j = 0; j < indicesInbounds.length - 1; ++j) {
+ sum += unicode_string.codePointAt(indicesInbounds[j] | 0);
+ }
+
+ return sum;
+}
+
+function StringCodePointAtNonConstantInbounds() {
+ var sum = 0;
+
+ for (var j = 0; j < indicesInbounds.length - 1; ++j) {
+ sum += unicode_string.codePointAt(indicesInbounds[j]);
+ }
+
+ return sum;
+}
diff --git a/src/v8/test/js-perf-test/Strings/string-substring.js b/src/v8/test/js-perf-test/Strings/string-substring.js
new file mode 100644
index 0000000..cde6fe6
--- /dev/null
+++ b/src/v8/test/js-perf-test/Strings/string-substring.js
@@ -0,0 +1,198 @@
+// 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.
+
+const subjects = [
+ 'abcde', '123456', 'aqwsde', 'nbvveqxu', 'f03ks-120-3;jfkm;ajp3f',
+ 'sd-93u498thikefnow8y3-0rh1nalksfnwo8y3t19-3r8hoiefnw'
+];
+
+// Drop first element.
+
+function StringDropFirstSlice() {
+ var sum = "";
+
+ for (var j = 0; j < subjects.length; ++j) {
+ let s = subjects[j];
+ sum += s.slice(1);
+ }
+
+ return sum;
+}
+createSuiteWithWarmup('StringDropFirstSlice', 5, StringDropFirstSlice);
+
+function StringDropFirstSubstr() {
+ var sum = "";
+
+ for (var j = 0; j < subjects.length; ++j) {
+ let s = subjects[j];
+ sum += s.substr(1);
+ }
+
+ return sum;
+}
+createSuiteWithWarmup('StringDropFirstSubstr', 5, StringDropFirstSubstr);
+
+function StringDropFirstSubstring() {
+ var sum = "";
+
+ for (var j = 0; j < subjects.length; ++j) {
+ let s = subjects[j];
+ sum += s.substring(1);
+ }
+
+ return sum;
+}
+createSuiteWithWarmup('StringDropFirstSubstring', 5, StringDropFirstSubstring);
+
+// Take first element.
+
+function StringTakeFirstSlice() {
+ var sum = "";
+
+ for (var j = 0; j < subjects.length; ++j) {
+ let s = subjects[j];
+ sum += s.slice(0,1);
+ }
+
+ return sum;
+}
+createSuiteWithWarmup('StringTakeFirstSlice', 5, StringTakeFirstSlice);
+
+function StringTakeFirstSubstr() {
+ var sum = "";
+
+ for (var j = 0; j < subjects.length; ++j) {
+ let s = subjects[j];
+ sum += s.substr(0,1);
+ }
+
+ return sum;
+}
+createSuiteWithWarmup('StringTakeFirstSubstr', 5, StringTakeFirstSubstr);
+
+function StringTakeFirstSubstring() {
+ var sum = "";
+
+ for (var j = 0; j < subjects.length; ++j) {
+ let s = subjects[j];
+ sum += s.substring(0, 1);
+ }
+
+ return sum;
+}
+createSuiteWithWarmup('StringTakeFirstSubstring', 5, StringTakeFirstSubstring);
+
+// Drop last element.
+
+function StringDropLastSlice() {
+ var sum = "";
+
+ for (var j = 0; j < subjects.length; ++j) {
+ let s = subjects[j];
+ sum += s.slice(0, -1);
+ }
+
+ return sum;
+}
+createSuiteWithWarmup('StringDropLastSlice', 5, StringDropLastSlice);
+
+function StringDropLastSubstr() {
+ var sum = "";
+
+ for (var j = 0; j < subjects.length; ++j) {
+ let s = subjects[j];
+ sum += s.substr(0, s.length-1);
+ }
+
+ return sum;
+}
+createSuiteWithWarmup('StringDropLastSubstr', 5, StringDropLastSubstr);
+
+function StringDropLastSubstring() {
+ var sum = "";
+
+ for (var j = 0; j < subjects.length; ++j) {
+ let s = subjects[j];
+ sum += s.substring(0, s.length-1);
+ }
+
+ return sum;
+}
+createSuiteWithWarmup('StringDropLastSubstring', 5, StringDropLastSubstring);
+
+// Take last element.
+
+function StringTakeLastSlice() {
+ var sum = "";
+
+ for (var j = 0; j < subjects.length; ++j) {
+ let s = subjects[j];
+ sum += s.slice(-1);
+ }
+
+ return sum;
+}
+createSuiteWithWarmup('StringTakeLastSlice', 5, StringTakeLastSlice);
+
+function StringTakeLastSubstr() {
+ var sum = "";
+
+ for (var j = 0; j < subjects.length; ++j) {
+ let s = subjects[j];
+ sum += s.substr(-1);
+ }
+
+ return sum;
+}
+createSuiteWithWarmup('StringTakeLastSubstr', 5, StringTakeLastSubstr);
+
+function StringTakeLastSubstring() {
+ var sum = "";
+
+ for (var j = 0; j < subjects.length; ++j) {
+ let s = subjects[j];
+ sum += s.substring(s.length-1, s.length);
+ }
+
+ return sum;
+}
+createSuiteWithWarmup('StringTakeLastSubstring', 5, StringTakeLastSubstring);
+
+// Drop first and last.
+
+function StringDropFirstSlice() {
+ var sum = "";
+
+ for (var j = 0; j < subjects.length; ++j) {
+ let s = subjects[j];
+ sum += s.slice(1, -1);
+ }
+
+ return sum;
+}
+createSuiteWithWarmup('StringDropFirstSlice', 5, StringDropFirstSlice);
+
+function StringDropFirstSubstr() {
+ var sum = "";
+
+ for (var j = 0; j < subjects.length; ++j) {
+ let s = subjects[j]
+ sum += s.substr(1, s.length-2);
+ }
+
+ return sum;
+}
+createSuiteWithWarmup('StringDropFirstSubstr', 5, StringDropFirstSubstr);
+
+function StringDropFirstSubstring() {
+ var sum = "";
+
+ for (var j = 0; j < subjects.length; ++j) {
+ let s = subjects[j];
+ sum += s.substring(1, s.length-1);
+ }
+
+ return sum;
+}
+createSuiteWithWarmup('StringDropFirstSubstring', 5, StringDropFirstSubstring);
diff --git a/src/v8/test/js-perf-test/Strings/string-toLocaleCase.js b/src/v8/test/js-perf-test/Strings/string-toLocaleCase.js
new file mode 100644
index 0000000..67919fd
--- /dev/null
+++ b/src/v8/test/js-perf-test/Strings/string-toLocaleCase.js
@@ -0,0 +1,35 @@
+// Copyright 2019 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('StringToLocaleUpperCaseTR', [5], [
+ new Benchmark('StringToLocaleUpperCaseTR', false, false, 0,
+ StringToLocaleUpperCaseTR)
+]);
+new BenchmarkSuite('StringToLocaleLowerCaseTR', [5], [
+ new Benchmark('StringToLocaleLowerCaseTR', false, false, 0,
+ StringToLocaleLowerCaseTR),
+]);
+new BenchmarkSuite('StringToLocaleUpperCase', [5], [
+ new Benchmark('StringToLocaleUpperCase', false, false, 0,
+ StringToLocaleUpperCase)
+]);
+new BenchmarkSuite('StringToLocaleLowerCase', [5], [
+ new Benchmark('StringToLocaleLowerCase', false, false, 0,
+ StringToLocaleLowerCase),
+]);
+
+var shortString = "Îñţérñåţîöñåļîžåţîöñ Ļöçåļîžåţîöñ החןןם שםוןמ Γρεεκ ισ φθν 一二三";
+
+function StringToLocaleUpperCase() {
+ return shortString.toLocaleUpperCase();
+}
+function StringToLocaleLowerCase() {
+ return shortString.toLocaleLowerCase();
+}
+function StringToLocaleUpperCaseTR() {
+ return shortString.toLocaleUpperCase(["tr"]);
+}
+function StringToLocaleLowerCaseTR() {
+ return shortString.toLocaleLowerCase(["tr"]);
+}
diff --git a/src/v8/test/js-perf-test/TurboFan/run.js b/src/v8/test/js-perf-test/TurboFan/run.js
new file mode 100644
index 0000000..3415262
--- /dev/null
+++ b/src/v8/test/js-perf-test/TurboFan/run.js
@@ -0,0 +1,29 @@
+// 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("../base.js");
+
+const iterations = 100;
+
+load("typedLowering.js");
+
+var success = true;
+
+function PrintResult(name, result) {
+ print(name + "-TurboFan(Score): " + result);
+}
+
+
+function PrintError(name, error) {
+ PrintResult(name, error);
+ success = false;
+}
+
+
+BenchmarkSuite.config.doWarmup = undefined;
+BenchmarkSuite.config.doDeterministic = undefined;
+
+BenchmarkSuite.RunSuites({ NotifyResult: PrintResult,
+ NotifyError: PrintError });
diff --git a/src/v8/test/js-perf-test/TurboFan/typedLowering.js b/src/v8/test/js-perf-test/TurboFan/typedLowering.js
new file mode 100644
index 0000000..663951f
--- /dev/null
+++ b/src/v8/test/js-perf-test/TurboFan/typedLowering.js
@@ -0,0 +1,15 @@
+// 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 NumberToString() {
+ var ret;
+ var num = 10240;
+ var obj = {};
+
+ for ( var i = 0; i < num; i++ ) {
+ ret = obj["test" + num];
+ }
+}
+
+createSuite('NumberToString', 1000, NumberToString);
diff --git a/src/v8/test/js-perf-test/TypedArrays/base.js b/src/v8/test/js-perf-test/TypedArrays/base.js
new file mode 100644
index 0000000..04f65a6
--- /dev/null
+++ b/src/v8/test/js-perf-test/TypedArrays/base.js
@@ -0,0 +1,26 @@
+// 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 typedArrayIntConstructors = [
+ {name: "Uint8", ctor: Uint8Array},
+ {name: "Int8", ctor: Int8Array},
+ {name: "Uint16", ctor: Uint16Array},
+ {name: "Int16", ctor: Int16Array},
+ {name: "Uint32", ctor: Uint32Array},
+ {name: "Int32", ctor: Int32Array},
+ {name: "Uint8Clamped", ctor: Uint8ClampedArray},
+];
+
+const typedArrayFloatConstructors = [
+ {name: "Float32", ctor: Float32Array},
+ {name: "Float64", ctor: Float64Array},
+];
+
+// "ref" builds might not yet have BigInt support, so the benchmark fails
+// gracefully during setup (the constructor will be undefined), instead of
+// a hard fail when this file is loaded.
+const typedArrayBigIntConstructors = [
+ {name: "BigUint64", ctor: this["BigUint64Array"]},
+ {name: "BigInt64", ctor: this["BigInt64Array"]}
+];
diff --git a/src/v8/test/js-perf-test/TypedArrays/filter-nospecies.js b/src/v8/test/js-perf-test/TypedArrays/filter-nospecies.js
new file mode 100644
index 0000000..180fe5b
--- /dev/null
+++ b/src/v8/test/js-perf-test/TypedArrays/filter-nospecies.js
@@ -0,0 +1,55 @@
+// Copyright 2019 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 SIZE = 1024;
+let input;
+let output;
+
+function CreateSetup(TAConstructor) {
+ return () => {
+ // Create an Typed Array with a sequence of number 0 to SIZE.
+ const values = Array.from({ length: SIZE }).map((_, i) =>
+ TAConstructor === BigUint64Array ? BigInt(i) : i
+ );
+ input = new TAConstructor(values);
+ };
+}
+
+// Creates a run function that is unpolluted by IC feedback.
+function CreateRun() {
+ // Filters out every other (odd indexed) elements.
+ return new Function(`
+ output = input.filter((el, i) => el < SIZE && (i % 2) === 0);
+ `);
+}
+
+function isOutputInvalid() {
+ if (output.length !== input.length / 2) return true;
+
+ // Verfies every other (odd indexed) element has been filtered out.
+ for (let i = 0; i < SIZE / 2; i++) {
+ if (output[i] !== input[i * 2]) return true;
+ }
+}
+
+function TearDown() {
+ if (isOutputInvalid()) throw new TypeError(`Unexpected result!\n${output}`);
+
+ input = void 0;
+ output = void 0;
+}
+
+createSuite(
+ 'Uint8Array', 1000, CreateRun(), CreateSetup(Uint8Array), TearDown);
+createSuite(
+ 'Uint16Array', 1000, CreateRun(), CreateSetup(Uint16Array), TearDown);
+createSuite(
+ 'Uint32Array', 1000, CreateRun(), CreateSetup(Uint32Array), TearDown);
+createSuite(
+ 'Float32Array', 1000, CreateRun(), CreateSetup(Float32Array), TearDown);
+createSuite(
+ 'Float64Array', 1000, CreateRun(), CreateSetup(Float64Array), TearDown);
+createSuite(
+ 'BigUint64Array', 1000, CreateRun(), CreateSetup(BigUint64Array),
+ TearDown);
diff --git a/src/v8/test/js-perf-test/TypedArrays/join-bigint.js b/src/v8/test/js-perf-test/TypedArrays/join-bigint.js
new file mode 100644
index 0000000..8f8bb92
--- /dev/null
+++ b/src/v8/test/js-perf-test/TypedArrays/join-bigint.js
@@ -0,0 +1,8 @@
+// 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('join.js');
+
+new BenchmarkSuite('JoinBigIntTypes', [100],
+ CreateBenchmarks(typedArrayBigIntConstructors, false));
diff --git a/src/v8/test/js-perf-test/TypedArrays/join-float.js b/src/v8/test/js-perf-test/TypedArrays/join-float.js
new file mode 100644
index 0000000..e666bfd
--- /dev/null
+++ b/src/v8/test/js-perf-test/TypedArrays/join-float.js
@@ -0,0 +1,8 @@
+// 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('join.js');
+
+new BenchmarkSuite('JoinFloatTypes', [100],
+ CreateBenchmarks(typedArrayFloatConstructors, false));
diff --git a/src/v8/test/js-perf-test/TypedArrays/join-int.js b/src/v8/test/js-perf-test/TypedArrays/join-int.js
new file mode 100644
index 0000000..d08dc5f
--- /dev/null
+++ b/src/v8/test/js-perf-test/TypedArrays/join-int.js
@@ -0,0 +1,8 @@
+// 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('join.js');
+
+new BenchmarkSuite('JoinIntTypes', [100],
+ CreateBenchmarks(typedArrayIntConstructors, false));
diff --git a/src/v8/test/js-perf-test/TypedArrays/join-sep-bigint.js b/src/v8/test/js-perf-test/TypedArrays/join-sep-bigint.js
new file mode 100644
index 0000000..34461b9
--- /dev/null
+++ b/src/v8/test/js-perf-test/TypedArrays/join-sep-bigint.js
@@ -0,0 +1,8 @@
+// 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('join.js');
+
+new BenchmarkSuite('JoinWithSeparatorBigIntTypes', [100],
+ CreateBenchmarks(typedArrayBigIntConstructors, true));
diff --git a/src/v8/test/js-perf-test/TypedArrays/join-sep-float.js b/src/v8/test/js-perf-test/TypedArrays/join-sep-float.js
new file mode 100644
index 0000000..672d2a6
--- /dev/null
+++ b/src/v8/test/js-perf-test/TypedArrays/join-sep-float.js
@@ -0,0 +1,8 @@
+// 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('join.js');
+
+new BenchmarkSuite('JoinWithSeparatorFloatTypes', [100],
+ CreateBenchmarks(typedArrayFloatConstructors, true));
diff --git a/src/v8/test/js-perf-test/TypedArrays/join-sep-int.js b/src/v8/test/js-perf-test/TypedArrays/join-sep-int.js
new file mode 100644
index 0000000..7631299
--- /dev/null
+++ b/src/v8/test/js-perf-test/TypedArrays/join-sep-int.js
@@ -0,0 +1,8 @@
+// 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('join.js');
+
+new BenchmarkSuite('JoinWithSeparatorIntTypes', [100],
+ CreateBenchmarks(typedArrayIntConstructors, true));
diff --git a/src/v8/test/js-perf-test/TypedArrays/join.js b/src/v8/test/js-perf-test/TypedArrays/join.js
new file mode 100644
index 0000000..9f090e4
--- /dev/null
+++ b/src/v8/test/js-perf-test/TypedArrays/join.js
@@ -0,0 +1,38 @@
+// 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('base.js');
+
+function CreateBenchmarks(constructors, withSep) {
+ return constructors.map(({ ctor, name }) =>
+ new Benchmark(`Join${name}`, false, false, 0, CreateJoinFn(withSep),
+ CreateSetupFn(ctor), TearDown)
+ );
+}
+
+const kInitialArray = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16];
+let result;
+let arrayToJoin = [];
+
+function CreateSetupFn(constructor) {
+ return () => {
+ if (constructor == BigUint64Array || constructor == BigInt64Array) {
+ arrayToJoin = constructor.from(kInitialArray, x => BigInt(Math.floor(x)));
+ } else {
+ arrayToJoin = new constructor(kInitialArray);
+ }
+ }
+}
+
+function CreateJoinFn(withSep) {
+ if (withSep) {
+ return () => result = arrayToJoin.join(',');
+ } else {
+ return () => result = arrayToJoin.join('');
+ }
+}
+
+function TearDown() {
+ arrayToJoin = void 0;
+}
diff --git a/src/v8/test/js-perf-test/TypedArrays/sort-bigint.js b/src/v8/test/js-perf-test/TypedArrays/sort-bigint.js
new file mode 100644
index 0000000..cec9605
--- /dev/null
+++ b/src/v8/test/js-perf-test/TypedArrays/sort-bigint.js
@@ -0,0 +1,8 @@
+// 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.js');
+
+new BenchmarkSuite('SortBigIntTypes', [1000],
+ CreateBenchmarks(typedArrayBigIntConstructors));
diff --git a/src/v8/test/js-perf-test/TypedArrays/sort-cmpfn-bigint.js b/src/v8/test/js-perf-test/TypedArrays/sort-cmpfn-bigint.js
new file mode 100644
index 0000000..a94c605
--- /dev/null
+++ b/src/v8/test/js-perf-test/TypedArrays/sort-cmpfn-bigint.js
@@ -0,0 +1,9 @@
+// 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.js');
+
+new BenchmarkSuite('SortCustomCompareFnBigIntTypes', [1000],
+ CreateBenchmarks(typedArrayBigIntConstructors,
+ [cmp_smaller, cmp_greater]));
diff --git a/src/v8/test/js-perf-test/TypedArrays/sort-cmpfn-float.js b/src/v8/test/js-perf-test/TypedArrays/sort-cmpfn-float.js
new file mode 100644
index 0000000..2913cbf
--- /dev/null
+++ b/src/v8/test/js-perf-test/TypedArrays/sort-cmpfn-float.js
@@ -0,0 +1,9 @@
+// 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.js');
+
+new BenchmarkSuite('SortCustomCompareFnFloatTypes', [1000],
+ CreateBenchmarks(typedArrayFloatConstructors,
+ [cmp_smaller, cmp_greater]));
diff --git a/src/v8/test/js-perf-test/TypedArrays/sort-cmpfn-int.js b/src/v8/test/js-perf-test/TypedArrays/sort-cmpfn-int.js
new file mode 100644
index 0000000..3fe04a9
--- /dev/null
+++ b/src/v8/test/js-perf-test/TypedArrays/sort-cmpfn-int.js
@@ -0,0 +1,9 @@
+// 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.js');
+
+new BenchmarkSuite('SortCustomCompareFnIntTypes', [1000],
+ CreateBenchmarks(typedArrayIntConstructors,
+ [cmp_smaller, cmp_greater]));
diff --git a/src/v8/test/js-perf-test/TypedArrays/sort-float.js b/src/v8/test/js-perf-test/TypedArrays/sort-float.js
new file mode 100644
index 0000000..7d1ee77
--- /dev/null
+++ b/src/v8/test/js-perf-test/TypedArrays/sort-float.js
@@ -0,0 +1,8 @@
+// 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.js');
+
+new BenchmarkSuite('SortFloatTypes', [1000],
+ CreateBenchmarks(typedArrayFloatConstructors));
diff --git a/src/v8/test/js-perf-test/TypedArrays/sort-int.js b/src/v8/test/js-perf-test/TypedArrays/sort-int.js
new file mode 100644
index 0000000..fbb4f67
--- /dev/null
+++ b/src/v8/test/js-perf-test/TypedArrays/sort-int.js
@@ -0,0 +1,8 @@
+// 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.js');
+
+new BenchmarkSuite('SortIntTypes', [1000],
+ CreateBenchmarks(typedArrayIntConstructors));
diff --git a/src/v8/test/js-perf-test/TypedArrays/sort.js b/src/v8/test/js-perf-test/TypedArrays/sort.js
index aebc981..c98ac05 100644
--- a/src/v8/test/js-perf-test/TypedArrays/sort.js
+++ b/src/v8/test/js-perf-test/TypedArrays/sort.js
@@ -1,33 +1,58 @@
-// Copyright 2017 the V8 project authors. All rights reserved.
+// 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.
-new BenchmarkSuite('Sort', [1000], [
- new Benchmark('Sort', false, false, 0,
- sortLarge, sortLargeSetup, sortLargeTearDown),
-]);
+load('base.js');
-var size = 3000;
-var initialLargeFloat64Array = new Array(size);
-for (var i = 0; i < size; ++i) {
- initialLargeFloat64Array[i] = Math.random();
-}
-initialLargeFloat64Array = new Float64Array(initialLargeFloat64Array);
-var largeFloat64Array;
-
-function sortLarge() {
- largeFloat64Array.sort();
+function CreateBenchmarks(constructors, comparefns = []) {
+ var benchmarks = [];
+ for (let constructor of constructors) {
+ benchmarks.push(new Benchmark('Sort' + constructor.name, false, false, 0,
+ CreateSortFn(comparefns),
+ CreateSetupFn(constructor.ctor), TearDown));
+ }
+ return benchmarks;
}
-function sortLargeSetup() {
- largeFloat64Array = new Float64Array(initialLargeFloat64Array);
+const kArraySize = 3000;
+const initialLargeArray = new Array(kArraySize);
+for (let i = 0; i < kArraySize; ++i) {
+ initialLargeArray[i] = Math.random() * kArraySize;
}
-function sortLargeTearDown() {
- for (var i = 0; i < size - 1; ++i) {
- if (largeFloat64Array[i] > largeFloat64Array[i+1]) {
- throw new TypeError("Unexpected result!\n" + largeFloat64Array);
+let array_to_sort = [];
+
+function CreateSetupFn(constructor) {
+ return () => {
+ if (constructor == BigUint64Array || constructor == BigInt64Array) {
+ array_to_sort = constructor.from(initialLargeArray,
+ x => BigInt(Math.floor(x)));
+ } else {
+ array_to_sort = new constructor(initialLargeArray);
}
}
- largeFloat64Array = void 0;
}
+
+function CreateSortFn(comparefns) {
+ if (comparefns.length == 0) {
+ return () => array_to_sort.sort();
+ }
+
+ return () => {
+ for (let cmpfn of comparefns) {
+ array_to_sort.sort(cmpfn);
+ }
+ }
+}
+
+function TearDown() {
+ array_to_sort = void 0;
+}
+
+function cmp_smaller(a, b) {
+ if (a < b) return -1;
+ if (b < a) return 1;
+ return 0;
+}
+
+function cmp_greater(a, b) { cmp_smaller(b, a); }
diff --git a/src/v8/test/js-perf-test/base.js b/src/v8/test/js-perf-test/base.js
index cef2867..66a15c0 100644
--- a/src/v8/test/js-perf-test/base.js
+++ b/src/v8/test/js-perf-test/base.js
@@ -54,7 +54,6 @@
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 @@
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 = [];
@@ -97,7 +105,8 @@
Math.random = (function() {
var seed = 49734321;
return function() {
- // Robert Jenkins' 32 bit integer hash function.
+ // Robert Jenkins' 32-bit integer hash function.
+ seed = seed & 0xffffffff;
seed = ((seed + 0x7ed55d16) + (seed << 12)) & 0xffffffff;
seed = ((seed ^ 0xc761c23c) ^ (seed >>> 19)) & 0xffffffff;
seed = ((seed + 0x165667b1) + (seed << 5)) & 0xffffffff;
@@ -365,3 +374,23 @@
// Start out running the setup.
return RunNextSetup();
}
+
+
+
+function assert(condition, message) {
+ if (!condition) throw Error(message);
+}
+
+
+function assertEquals(expected, actual, message) {
+ var isSame =
+ expected === actual || typeof expected !== expected && actual !== actual;
+ if (isSame) return true;
+ var details = `Expected: ${String(expected)}\n` +
+ `But found: ${String(actual)}`;
+ var lines = ["Benchmark Error:", details];
+ if (message !== undefined) {
+ lines = ["Benchmark Error:", details, "", String(message)];
+ }
+ throw new Error(lines.join("\n"));
+}