Home | History | Annotate | Download | only in webkit
      1 // Copyright 2013 the V8 project authors. All rights reserved.
      2 // Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
      3 //
      4 // Redistribution and use in source and binary forms, with or without
      5 // modification, are permitted provided that the following conditions
      6 // are met:
      7 // 1.  Redistributions of source code must retain the above copyright
      8 //     notice, this list of conditions and the following disclaimer.
      9 // 2.  Redistributions in binary form must reproduce the above copyright
     10 //     notice, this list of conditions and the following disclaimer in the
     11 //     documentation and/or other materials provided with the distribution.
     12 //
     13 // THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
     14 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
     15 // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
     16 // DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
     17 // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
     18 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
     19 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
     20 // ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     21 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
     22 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     23 
     24 description("Ensures that we pass exceptions to the correct codeblock when throwing from the DFG to the LLInt.");
     25 var o = {
     26     toString: function() { if (shouldThrow) throw {}; return ""; }
     27 };
     28 
     29 var shouldThrow = false;
     30 function h(o) {
     31     return String(o);
     32 }
     33 
     34 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
     35 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
     36 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
     37 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
     38 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
     39 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
     40 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
     41 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
     42 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
     43 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
     44 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
     45 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
     46 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
     47 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
     48 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
     49 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
     50 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
     51 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
     52 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
     53 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
     54 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
     55 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
     56 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
     57 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
     58 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
     59 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
     60 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
     61 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
     62 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
     63 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
     64 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
     65 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
     66 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
     67 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
     68 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
     69 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
     70 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
     71 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
     72 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
     73 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
     74 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
     75 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
     76 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
     77 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
     78 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
     79 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
     80 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
     81 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
     82 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
     83 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
     84 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
     85 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
     86 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
     87 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
     88 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
     89 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
     90 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
     91 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
     92 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
     93 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
     94 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
     95 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
     96 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
     97 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
     98 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
     99 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
    100 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
    101 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
    102 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
    103 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
    104 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
    105 try { shouldThrow = !shouldThrow; h(o); } catch (e) {}
    106 
    107 
    108 function g() {
    109     with({})
    110         h(o);
    111 }
    112 
    113 function f1() {
    114     try {
    115         g();
    116     } catch (e) {
    117         testFailed("Caught exception in wrong codeblock");
    118     }
    119 }
    120 
    121 function f2() {
    122     try {
    123         g();
    124     } catch (e) {
    125         testPassed("Caught exception in correct codeblock");
    126     }
    127 }
    128 
    129 f1();
    130 f1();
    131 f1();
    132 f1();
    133 f1();
    134 f1();
    135 f1();
    136 f1();
    137 f1();
    138 f1();
    139 f1();
    140 f1();
    141 f1();
    142 f1();
    143 f1();
    144 f1();
    145 f1();
    146 f1();
    147 f1();
    148 f1();
    149 f1();
    150 f1();
    151 f1();
    152 f1();
    153 f1();
    154 f1();
    155 f1();
    156 f1();
    157 f1();
    158 f1();
    159 f1();
    160 f1();
    161 f1();
    162 f1();
    163 f1();
    164 f1();
    165 f1();
    166 f1();
    167 f1();
    168 f1();
    169 f1();
    170 f1();
    171 f1();
    172 f1();
    173 f1();
    174 f1();
    175 f1();
    176 f1();
    177 f1();
    178 f1();
    179 f1();
    180 f1();
    181 f1();
    182 f1();
    183 f1();
    184 f1();
    185 f1();
    186 f1();
    187 f1();
    188 f1();
    189 f1();
    190 f1();
    191 f1();
    192 f1();
    193 f1();
    194 f1();
    195 f1();
    196 f1();
    197 f1();
    198 f1();
    199 f1();
    200 f1();
    201 f1();
    202 f1();
    203 f1();
    204 f1();
    205 f1();
    206 f1();
    207 f1();
    208 shouldThrow = true;
    209 f2();
    210 var successfullyParsed = true;
    211