Home | History | Annotate | Download | only in mjsunit
      1 // Copyright 2014 the V8 project authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 // Flags: --allow-natives-syntax
      6 
      7 function mod1() {
      8   var v_1 = 1;
      9   var v_2 = 1;
     10   v_1++;
     11   v_2 = {valueOf: function() { throw "gagh"; }};
     12 
     13   function bug1() {
     14     for (var i = 0; i < 1; v_2++) {
     15       if (v_1 == 1) ;
     16     }
     17   }
     18 
     19   return bug1;
     20 }
     21 
     22 var f = mod1();
     23 assertThrows(f);
     24 %OptimizeFunctionOnNextCall(f);
     25 assertThrows(f);
     26 
     27 
     28 var v_3 = 1;
     29 var v_4 = 1;
     30 v_3++;
     31 v_4 = {valueOf: function() { throw "gagh"; }};
     32 
     33 function bug2() {
     34   for (var i = 0; i < 1; v_4++) {
     35     if (v_3 == 1) ;
     36   }
     37 }
     38 
     39 assertThrows(bug2);
     40 %OptimizeFunctionOnNextCall(bug2);
     41 assertThrows(bug2);
     42