dom/bindings/test/test_throwing_method_noDCE.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 <!DOCTYPE html>
     2 <meta charset=utf-8>
     3 <title>Test that we don't DCE functions that can throw</title>
     4 <script src="/resources/testharness.js"></script>
     5 <script src="/resources/testharnessreport.js"></script>
     6 <div id="log"></div>
     7 <script>
     8 test(function() {
     9   function test(root) {
    10     var threw = false;
    11     try {
    12         root.querySelectorAll("");
    13     } catch(e){ threw = true; };
    14     // Hot loop to make sure the JIT heuristics ion-compile this function even
    15     // though it's throwing exceptions (which would normally make us back off
    16     // of ion compilation).
    17     for (var i=0; i<1500; i++) {}
    18     return threw;
    19   }
    21   var threw = false;
    22   var el = document.createElement("div");
    23   for (var i=0; i<200; i++)
    24       threw = test(el);
    25   assert_true(threw);
    26 }, "Shouldn't optimize away throwing functions");
    27 </script>

mercurial