aboutsummaryrefslogtreecommitdiff
path: root/deps/v8/test/mjsunit/regress/regress-612146.js
blob: 1bd3f0b1f0ccab43a6103715f69e69fa409d51b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Copyright 2016 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.

// Flags: --allow-natives-syntax

function f() {
  var arguments_ = arguments;
  if (undefined) {
    while (true) {
      arguments_[0];
    }
  } else {
    %DeoptimizeNow();
    return arguments_[0];
  }
};

f(0);
f(0);
%OptimizeFunctionOnNextCall(f);
assertEquals(1, f(1));

function g() {
    var a = arguments;
    %DeoptimizeNow();
    return a.length;
}

g(1);
g(1);
%OptimizeFunctionOnNextCall(g);
assertEquals(1, g(1));