dom/bindings/test/test_throwing_method_noDCE.html

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     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