escape-analysis-phi-type.js 557 Bytes
Newer Older
1 2 3 4
// Copyright 2017 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

5
// Flags: --allow-natives-syntax --turbo-escape --no-turbo-loop-peeling
6 7 8 9 10 11 12 13 14 15 16 17 18

function f(x) {
  var o = {a : 0};
  var l = [1,2,3,4];
  var res;
  for (var i = 0; i < 3; ++i) {
    if (x%2 == 0) { o.a = 1; b = false}
    res = l[o.a];
    o.a = x;
  }
  return res;
}

19
%PrepareFunctionForOptimization(f);
20 21 22 23 24 25
f(0);
f(1);
f(0);
f(1);
%OptimizeFunctionOnNextCall(f);
assertEquals(undefined, f(101));