summaryrefslogtreecommitdiff
path: root/deps/v8/test/mjsunit/compiler/regress-944062-1.js
blob: 268999c8814598e09e13d567c89689da789e40db (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
// Copyright 2019 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

const array = [42, 2.1];  // non-stable map (PACKED_DOUBLE)
let b = false;

function f() {
  if (b) array[100000] = 4.2;  // go to dictionary mode
  return 42
};
%NeverOptimizeFunction(f);

function includes() {
  return array.includes(f());
}

assertTrue(includes());
assertTrue(includes());
%OptimizeFunctionOnNextCall(includes);
assertTrue(includes());
b = true;
assertTrue(includes());