Enable HAVE_AVFOUNDATION_VIDEO_OUTPUT on PLATFORM(IOSMAC)
[WebKit-https.git] / PerformanceTests / ARES-6 / air_benchmark.js
1 /*
2  * Copyright (C) 2016 Apple Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in the
11  *    documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
17  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
24  */
25 "use strict";
26
27 const AirBenchmarkCode = String.raw`
28 <script src="Air/symbols.js"></script>
29 <script src="Air/tmp_base.js"></script>
30 <script src="Air/arg.js"></script>
31 <script src="Air/basic_block.js"></script>
32 <script src="Air/code.js"></script>
33 <script src="Air/frequented_block.js"></script>
34 <script src="Air/inst.js"></script>
35 <script src="Air/opcode.js"></script>
36 <script src="Air/reg.js"></script>
37 <script src="Air/stack_slot.js"></script>
38 <script src="Air/tmp.js"></script>
39 <script src="Air/util.js"></script>
40 <script src="Air/custom.js"></script>
41 <script src="Air/liveness.js"></script>
42 <script src="Air/insertion_set.js"></script>
43 <script src="Air/allocate_stack.js"></script>
44 <script src="Air/payload-gbemu-executeIteration.js"></script>
45 <script src="Air/payload-imaging-gaussian-blur-gaussianBlur.js"></script>
46 <script src="Air/payload-airjs-ACLj8C.js"></script>
47 <script src="Air/payload-typescript-scanIdentifier.js"></script>
48 <script src="Air/benchmark.js"></script>
49 <script>
50 var results = [];
51 var benchmark = new AirBenchmark();
52 var numIterations = 200;
53 for (var i = 0; i < numIterations; ++i) {
54     var before = currentTime();
55     benchmark.runIteration();
56     var after = currentTime();
57     results.push(after - before);
58 }
59 reportResult(results);
60 </script>`;
61
62 let runAirBenchmark = null;
63 if (!isInBrowser) {
64     let sources = [
65         "Air/symbols.js"
66         , "Air/tmp_base.js"
67         , "Air/arg.js"
68         , "Air/basic_block.js"
69         , "Air/code.js"
70         , "Air/frequented_block.js"
71         , "Air/inst.js"
72         , "Air/opcode.js"
73         , "Air/reg.js"
74         , "Air/stack_slot.js"
75         , "Air/tmp.js"
76         , "Air/util.js"
77         , "Air/custom.js"
78         , "Air/liveness.js"
79         , "Air/insertion_set.js"
80         , "Air/allocate_stack.js"
81         , "Air/payload-gbemu-executeIteration.js"
82         , "Air/payload-imaging-gaussian-blur-gaussianBlur.js"
83         , "Air/payload-airjs-ACLj8C.js"
84         , "Air/payload-typescript-scanIdentifier.js"
85         , "Air/benchmark.js"
86     ];
87
88     runAirBenchmark = makeBenchmarkRunner(sources, "AirBenchmark");
89 }
90
91 const AirBenchmarkRunner = {
92     code: AirBenchmarkCode,
93     run: runAirBenchmark,
94     cells: { },
95     name: "Air"
96 };
97
98 if (isInBrowser) {
99     AirBenchmarkRunner.cells = {
100         firstIteration: document.getElementById("AirFirstIteration"),
101         averageWorstCase: document.getElementById("AirAverageWorstCase"),
102         steadyState: document.getElementById("AirSteadyState"),
103         message: document.getElementById("AirMessage")
104     }
105 }