1 // Copyright 2015 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 foo(expected, x) { 8 var passed = expected.length == x.length; 9 for (var i = 0; i < expected.length; i++) { 10 if (passed) 11 passed = expected[i] == x[i]; 12 } 13 print("a"); 14 print(passed); 15 16 %DeoptimizeFunction(foo); 17 18 print("b"); 19 print(passed); 20 return passed; 21 } 22 23 assertTrue(foo([0,1], [0,1])); 24 assertTrue(foo([0,2], [0,2])); 25 assertFalse(foo([0,2.25], [0,2.75])); 26 27 %OptimizeFunctionOnNextCall(foo); 28 29 assertTrue(foo([0,1], [0,1])); 30 assertTrue(foo([0,2], [0,2])); 31 assertFalse(foo([0,2.25], [0,2.75])); 32