test_throwing_method_noDCE.html (878B)
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 /* global test, assert_true */ 9 test(function() { 10 function test(root) { 11 var threw = false; 12 try { 13 root.querySelectorAll(""); 14 } catch (e) { threw = true; } 15 // Hot loop to make sure the JIT heuristics ion-compile this function even 16 // though it's throwing exceptions (which would normally make us back off 17 // of ion compilation). 18 for (var i = 0; i < 1500; i++) { 19 // empty 20 } 21 return threw; 22 } 23 24 var threw = false; 25 var el = document.createElement("div"); 26 for (var i = 0; i < 200; i++) 27 threw = test(el); 28 assert_true(threw); 29 }, "Shouldn't optimize away throwing functions"); 30 </script>