v8/test/mjsunit/regress/regress-crbug-878845.js
Simon Zünd b9540d447f [array] Fix side-effect for 'from' argument in Array.p.lastIndexOf
This CL fixes a bug if the second argument ('from') for lastIndexOf
changes the array when its converted to an integer.

R=jgruber@chromium.org

Bug: chromium:878845
Change-Id: I8759dd19381c63f0dde1d4c5abc1b6c7291c6048
Reviewed-on: https://chromium-review.googlesource.com/1196507
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Commit-Queue: Simon Zünd <szuend@google.com>
Cr-Commit-Position: refs/heads/master@{#55525}
2018-08-30 13:34:25 +00:00

12 lines
275 B
JavaScript

// Copyright 2018 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.
let arr = [, 0.1];
Array.prototype.lastIndexOf.call(arr, 100, {
valueOf() {
arr.length = 0;
}
});