summaryrefslogtreecommitdiffstats
path: root/devtools/client/performance/components/test/test_jit_optimizations_01.html
blob: edc9c34cd81ae37755dcbdadcadc688c77ea6a11 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<!DOCTYPE HTML>
<html>
<!--
Test the rendering of the JIT Optimizations tree. Tests when jit data has observed types, multiple observed types, multiple sites, a site with a successful strategy, site with no successful strategy.
-->
<head>
  <meta charset="utf-8">
  <title>JITOptimizations component test</title>
  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
</head>
<body style="height: 10000px;">
<pre id="test">
<script src="head.js" type="application/javascript;version=1.8"></script>
<script type="application/javascript;version=1.8">
window.onload = Task.async(function* () {
  try {
    let ReactDOM = browserRequire("devtools/client/shared/vendor/react-dom");
    let React = browserRequire("devtools/client/shared/vendor/react");
    let JITOptimizations = React.createFactory(browserRequire("devtools/client/performance/components/jit-optimizations"));
    ok(JITOptimizations, "Should get JITOptimizations");
    let opts;

    opts = ReactDOM.render(JITOptimizations({
      onViewSourceInDebugger: function(){},
      frameData: {
        isMetaCategory: false,
        url: "http://internet.com/file.js",
        line: 1,
        functionName: "myfunc",
      },
      optimizationSites: OPTS_DATA_GENERAL,
      autoExpandDepth: 1000,
    }), window.document.body);
    yield forceRender(opts);

    checkOptimizationHeader("myfunc", "file.js", "1");

    checkOptimizationTree([
      { type: "site", strategy: "GetElem_TypedArray", samples: "90" },
      { type: "types", count: "2" },
      { type: "type", site: "Receiver", mirType: "Object" },
      { type: "observedtype", keyedBy: "constructor", name: "MyView" },
      { type: "type", site: "Index", mirType: "Int32" },
      { type: "attempts", count: "4" },
      { type: "attempt", strategy: "GetElem_TypedObject", outcome: "AccessNotTypedObject" },
      { type: "attempt", strategy: "GetElem_Dense", outcome: "AccessNotDense" },
      { type: "attempt", strategy: "GetElem_TypedStatic", outcome: "Disabled" },
      { type: "attempt", strategy: "GetElem_TypedArray", outcome: "GenericSuccess", success: true },
      { type: "site", strategy: "Call_Inline", samples: "100", failureIcon: true },
      { type: "types", count: "1" },
      { type: "type", site: "Call_Target", mirType: "Object" },
      { type: "observedtype", keyedBy: "primitive" },
      { type: "observedtype", keyedBy: "constructor", name: "B" },
      { type: "observedtype", keyedBy: "constructor", name: "C" },
      { type: "observedtype", keyedBy: "constructor", name: "D" },
      { type: "attempts", count: "1" },
      { type: "attempt", strategy: "Call_Inline", outcome: "CantInlineBigData" },
    ]);

  } catch(e) {
    ok(false, "Got an error: " + DevToolsUtils.safeErrorString(e));
  } finally {
    SimpleTest.finish();
  }
});
</script>
</pre>
</body>
</html>