v8/test/mjsunit/check-bounds-string-from-char-code-at.js
Jakob Kummerow b5a33ebafe [test] Make a few tests robust to GC stress
A recent unrelated change caused these tests to get unlucky in
GC stress mode. Their "assertOptimized" expectations rely on
certain type feedback data not getting flushed at the wrong time.

Bug: v8:10846
Change-Id: I86d0b0c049539e4a69aa764cc6ec92465ca12beb
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2381458
Reviewed-by: Maya Lekova <mslekova@chromium.org>
Commit-Queue: Maya Lekova <mslekova@chromium.org>
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#69617}
2020-08-31 08:37:16 +00:00

33 lines
666 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
// Flags: --no-stress-flush-bytecode
let string = "foobar";
function f(useArrayIndex) {
let index = useArrayIndex ? '1': '4294967296';
return string.charCodeAt(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);