b8f144ec4f
The Typer put the wrong type on String#index and String#lastIndexOf builtins, with an off by one on the upper bound. Bug: chromium:762874 Change-Id: Ia4c29bc2e8e1c85b6a7ae0b99f8aaabf839a5932 Reviewed-on: https://chromium-review.googlesource.com/660000 Reviewed-by: Jaroslav Sevcik <jarin@chromium.org> Commit-Queue: Benedikt Meurer <bmeurer@chromium.org> Cr-Commit-Position: refs/heads/master@{#47942}
19 lines
455 B
JavaScript
19 lines
455 B
JavaScript
// Copyright 2017 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 maxLength = %StringMaxLength();
|
|
const s = 'A'.repeat(maxLength);
|
|
|
|
function foo(s) {
|
|
let x = s.lastIndexOf("", maxLength);
|
|
return x === maxLength;
|
|
}
|
|
|
|
assertTrue(foo(s));
|
|
assertTrue(foo(s));
|
|
%OptimizeFunctionOnNextCall(foo);
|
|
assertTrue(foo(s));
|