Imported Upstream version 1.0.0
[platform/upstream/js.git] / js / src / jit-test / lib / prolog.js
1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3 const HAVE_TM = 'tracemonkey' in this;
4
5 const HOTLOOP = HAVE_TM ? tracemonkey.HOTLOOP : 8;
6 const RECORDLOOP = HOTLOOP;
7 const RUNLOOP = HOTLOOP + 1;
8
9 var checkStats;
10 if (HAVE_TM) {
11     checkStats = function(stats)
12     {
13         // Temporarily disabled while we work on heuristics.
14         return;
15         function jit(on)
16         {
17           if (on && !options().match(/tracejit/))
18           {
19             options('tracejit');
20           }
21           else if (!on && options().match(/tracejit/))
22           {
23             options('tracejit');
24           }
25         }
26
27         jit(false);
28         for (var name in stats) {
29             var expected = stats[name];
30             var actual = tracemonkey[name];
31             if (expected != actual) {
32                 print('Trace stats check failed: got ' + actual + ', expected ' + expected + ' for ' + name);
33             }
34         }
35         jit(true);
36     };
37 } else {
38     checkStats = function() {};
39 }
40
41 var appendToActual = function(s) {
42     actual += s + ',';
43 }
44
45 if (!("gczeal" in this)) {
46   gczeal = function() { }
47 }
48