|
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 } |
|
20 |
|
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> |