v8/test/mjsunit/compiler/regress-1070892.js
Georg Neis 53c1525df2 [turbofan] Distinguish two further modes of CheckBounds
Extend the flag parameter with a bit that decides if the input should
be converted (-0 to 0, and a string to the array index it represents).
Instruct redundancy elimination to never replace x with CheckBounds(x)
when this CheckBounds is of the converting kind.

Bug: chromium:1070892, chromium:1071743
Change-Id: I3125a6e267d56dae6bf6cb2f5f52d27ef65d7c79
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2157365
Commit-Queue: Georg Neis <neis@chromium.org>
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Reviewed-by: Nico Hartmann <nicohartmann@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67408}
2020-04-27 19:45:35 +00:00

18 lines
516 B
JavaScript

// Copyright 2020 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
var v = {0: 0, 1: 1, '01': 7};
function foo(index) {
return [v[index], v[index + 1], index + 1];
};
%PrepareFunctionForOptimization(foo);
assertEquals(foo(0), [0, 1, 1]);
assertEquals(foo(0), [0, 1, 1]);
%OptimizeFunctionOnNextCall(foo);
assertEquals(foo(0), [0, 1, 1]);
assertEquals(foo('0'), [0, 7, '01']);