4ab4bbd828
This reverts commit 81dd67db09
.
Reason for revert: Breaks gc-stress: https://ci.chromium.org/p/v8/builders/ci/V8%20Linux%20-%20gc%20stress/22111
Original change's description:
> Improve test coverage for non-extensible holey array in optimized code
>
> Bug: v8:6831
> Change-Id: Icb4b504771e623b3c9503c6daffd7b771fbef3a6
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1575036
> Reviewed-by: Toon Verwaest <verwaest@chromium.org>
> Commit-Queue: Z Nguyen-Huu <duongn@microsoft.com>
> Cr-Commit-Position: refs/heads/master@{#60990}
TBR=verwaest@chromium.org,duongn@microsoft.com
Change-Id: I0a581c1e47d9883a2727000843ad4e9ede2e411d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: v8:6831
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1581648
Reviewed-by: Clemens Hammacher <clemensh@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#60991}
44 lines
1.6 KiB
JavaScript
44 lines
1.6 KiB
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.
|
|
|
|
// Flags: --allow-natives-syntax
|
|
|
|
// Basic loop peeling test case with Array.prototype.find().
|
|
(function() {
|
|
function foo(a, o) {
|
|
return a.find(x => x === o.x);
|
|
}
|
|
|
|
%PrepareFunctionForOptimization(foo);
|
|
assertEquals(3, foo([1, 2, 3], {x:3}));
|
|
assertEquals(undefined, foo([0, 1, 2], {x:3}));
|
|
%OptimizeFunctionOnNextCall(foo);
|
|
assertEquals(3, foo([1, 2, 3], {x:3}));
|
|
assertEquals(undefined, foo([0, 1, 2], {x:3}));
|
|
|
|
// Non-extensible
|
|
%PrepareFunctionForOptimization(foo);
|
|
assertEquals(3, foo(Object.preventExtensions([1, 2, 3]), {x:3}));
|
|
assertEquals(undefined, foo(Object.preventExtensions([0, 1, 2]), {x:3}));
|
|
%OptimizeFunctionOnNextCall(foo);
|
|
assertEquals(3, foo(Object.preventExtensions([1, 2, 3]), {x:3}));
|
|
assertEquals(undefined, foo(Object.preventExtensions([0, 1, 2]), {x:3}));
|
|
|
|
// Sealed
|
|
%PrepareFunctionForOptimization(foo);
|
|
assertEquals(3, foo(Object.seal([1, 2, 3]), {x:3}));
|
|
assertEquals(undefined, foo(Object.seal([0, 1, 2]), {x:3}));
|
|
%OptimizeFunctionOnNextCall(foo);
|
|
assertEquals(3, foo(Object.seal([1, 2, 3]), {x:3}));
|
|
assertEquals(undefined, foo(Object.seal([0, 1, 2]), {x:3}));
|
|
|
|
// Frozen
|
|
%PrepareFunctionForOptimization(foo);
|
|
assertEquals(3, foo(Object.freeze([1, 2, 3]), {x:3}));
|
|
assertEquals(undefined, foo(Object.freeze([0, 1, 2]), {x:3}));
|
|
%OptimizeFunctionOnNextCall(foo);
|
|
assertEquals(3, foo(Object.freeze([1, 2, 3]), {x:3}));
|
|
assertEquals(undefined, foo(Object.freeze([0, 1, 2]), {x:3}));
|
|
})();
|