1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 new BenchmarkSuite('Untagged', [1000], [
6 new Benchmark('Untagged-Simple', false, false, 0,
7 Untagged, UntaggedSetup, UntaggedTearDown),
10 new BenchmarkSuite('LargeUntagged', [1000], [
11 new Benchmark('Untagged-Large', false, false, 0,
12 UntaggedLarge, UntaggedLargeSetup, UntaggedLargeTearDown),
15 new BenchmarkSuite('Tagged', [1000], [
16 new Benchmark('TaggedRawSimple', false, false, 0,
17 TaggedRaw, TaggedRawSetup, TaggedRawTearDown),
25 function UntaggedSetup() {
30 result = `${SUBJECT} gives ${TARGET} an ${OBJECT}.`;
33 function UntaggedTearDown() {
34 var expected = '' + SUBJECT + ' gives ' + TARGET + ' an ' + OBJECT + '.';
35 return result === expected;
39 // ----------------------------------------------------------------------------
41 function UntaggedLargeSetup() {
45 function UntaggedLarge() {
46 result = `Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus
47 aliquam, elit euismod vestibulum ${0}lacinia, arcu odio sagittis mauris, id
48 blandit dolor felis pretium nisl. Maecenas porttitor, nunc ut accumsan mollis,
49 arcu metus rutrum arcu, ${1}ut varius dolor lorem nec risus. Integer convallis
50 tristique ante, non pretium ante suscipit at. Sed egestas massa enim, convallis
51 fermentum neque vehicula ac. Donec imperdiet a tortor ac semper. Morbi accumsan
52 quam nec erat viverra iaculis. ${2}Donec a scelerisque cras amet.`;
55 function UntaggedLargeTearDown() {
56 var expected = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. " +
57 "Vivamus\n aliquam, elit euismod vestibulum " + 0 + "lacinia, arcu odio" +
58 " sagittis mauris, id\n blandit dolor felis pretium nisl. Maecenas " +
59 "porttitor, nunc ut accumsan mollis,\n arcu metus rutrum arcu, " + 1 +
60 "ut varius dolor lorem nec risus. Integer convallis\n tristique ante, " +
61 "non pretium ante suscipit at. Sed egestas massa enim, convallis\n " +
62 "fermentum neque vehicula ac. Donec imperdiet a tortor ac semper. Morbi" +
63 " accumsan\n quam nec erat viverra iaculis. " + 2 + "Donec a " +
64 "scelerisque cras amet.";
65 return result === expected;
69 // ----------------------------------------------------------------------------
72 function TaggedRawSetup() {
76 function TaggedRaw() {
77 result = String.raw `${SUBJECT} gives ${TARGET} an ${OBJECT} \ud83c\udf4f.`;
80 function TaggedRawTearDown() {
82 '' + SUBJECT + ' gives ' + TARGET + ' an ' + OBJECT + ' \\ud83c\\udf4f.';
83 return result === expected;
87 // ----------------------------------------------------------------------------