v8/test/mjsunit/compiler/regress-944062-1.js
Georg Neis e80082bf54 [turbofan] Add missing map checks in a reducer
ReduceArrayIndexOfIncludes didn't account for kUnreliableReceiverMaps.
Will think about a more robust mechanism for this.

Bug: chromium:944062
Change-Id: Ib2bdaf4399225de4413e12c5684f58dfe524a2cd
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1532331
Commit-Queue: Jaroslav Sevcik <jarin@chromium.org>
Reviewed-by: Jaroslav Sevcik <jarin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#60400}
2019-03-21 21:25:01 +00:00

26 lines
592 B
JavaScript

// 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());