a1a45f4caa
Updates CSA::TryToIntptr to handle array indices that are less than INT_MAX which allows to handle string keys in the ICs. Updates ICs to go monomorphic for string keys that are array indices. Updates Turbofan to handle array indices when lowering element access. Change-Id: Ibdde20130e075d0d645ab4a8266a968335eaad84 Bug: v8:9449 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1813018 Reviewed-by: Tobias Tebbi <tebbi@chromium.org> Reviewed-by: Toon Verwaest <verwaest@chromium.org> Reviewed-by: Georg Neis <neis@chromium.org> Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org> Cr-Commit-Position: refs/heads/master@{#64320}
32 lines
613 B
JavaScript
32 lines
613 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 --opt --no-always-opt
|
|
|
|
let arr = [1, 2, 3];
|
|
|
|
function f(useArrayIndex) {
|
|
let index = useArrayIndex ? '1': '4294967296';
|
|
return arr[index];
|
|
}
|
|
|
|
%PrepareFunctionForOptimization(f);
|
|
f(true);
|
|
f(true);
|
|
|
|
%OptimizeFunctionOnNextCall(f);
|
|
f(false);
|
|
assertUnoptimized(f);
|
|
|
|
%PrepareFunctionForOptimization(f);
|
|
f(true);
|
|
f(true);
|
|
|
|
%OptimizeFunctionOnNextCall(f);
|
|
f(true);
|
|
|
|
// no deopt here
|
|
f(false);
|
|
assertOptimized(f);
|