Home | History | Annotate | Download | only in regress
      1 // Copyright 2016 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 dummy() { }
      8 
      9 (function InlinedFunctionTestContext() {
     10   var f = function() { }
     11 
     12   function g() {
     13    var s = "hey";
     14    dummy();  // Force a deopt point.
     15    if (f()) return s;
     16   }
     17 
     18   g();
     19   g();
     20   g();
     21   %OptimizeFunctionOnNextCall(g);
     22   f = function() { return true; }
     23   assertEquals("hey", g());
     24 })();
     25 
     26 (function InlinedConstructorReturnTestContext() {
     27   function c() { return 1; }
     28 
     29   var f = function() { return !(new c());  }
     30 
     31   function g() {
     32    var s = "hey";
     33    dummy();  // Force a deopt point.
     34    if (f()) return s;
     35   }
     36 
     37   g();
     38   g();
     39   g();
     40   %OptimizeFunctionOnNextCall(g);
     41   f = function() { return true; }
     42   assertEquals("hey", g());
     43 })();
     44 
     45 (function InlinedConstructorNoReturnTestContext() {
     46   function c() { }
     47 
     48   var f = function() { return !(new c());  }
     49 
     50   function g() {
     51    var s = "hey";
     52    dummy();  // Force a deopt point.
     53    if (f()) return s;
     54   }
     55 
     56   g();
     57   g();
     58   g();
     59   %OptimizeFunctionOnNextCall(g);
     60   f = function() { return true; }
     61   assertEquals("hey", g());
     62 })();
     63