b342cbb20b
This reverts commit b8f9166664
.
Reason for revert: Fails gc-stress (https://ci.chromium.org/p/v8/builders/ci/V8%20Linux%20-%20gc%20stress/28341).
Original change's description:
> [flags] warn about contradictory flags
>
> Design Doc: https://docs.google.com/document/d/1lkvu8crkK7Ei39qjkPCFijpNyxWXsOktG9GB-7K34jM/
>
> Bug: v8:10577
> Change-Id: Ib9cfdffa401c48c895bf31caed5ee03545beddab
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2154792
> Reviewed-by: Clemens Backes <clemensb@chromium.org>
> Reviewed-by: Michael Achenbach <machenbach@chromium.org>
> Reviewed-by: Georg Neis <neis@chromium.org>
> Reviewed-by: Tamer Tas <tmrts@chromium.org>
> Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#68168}
TBR=machenbach@chromium.org,neis@chromium.org,clemensb@chromium.org,tebbi@chromium.org,tmrts@chromium.org
Change-Id: Ia1e3373fbb4c369594ceb98eb560e3ccf2cb8780
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: v8:10577
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2230523
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68169}
89 lines
2.3 KiB
JavaScript
89 lines
2.3 KiB
JavaScript
// Copyright 2015 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 --noverify-heap --noenable-slow-asserts
|
|
// Flags: --opt --no-always-opt
|
|
|
|
// --noverify-heap and --noenable-slow-asserts are set because the test is too
|
|
// slow with it on.
|
|
|
|
// Ensure that keyed stores work, and optimized functions learn if the
|
|
// store required change to dictionary mode. Verify that stores that grow
|
|
// the array into large object space don't cause a deopt.
|
|
(function() {
|
|
var a = [];
|
|
|
|
function foo(a, i) {
|
|
a[i] = 5.3;
|
|
}
|
|
|
|
%PrepareFunctionForOptimization(foo);
|
|
foo(a, 1);
|
|
foo(a, 2);
|
|
foo(a, 3);
|
|
%OptimizeFunctionOnNextCall(foo);
|
|
a[3] = 0;
|
|
foo(a, 3);
|
|
assertEquals(a[3], 5.3);
|
|
foo(a, 50000);
|
|
assertUnoptimized(foo);
|
|
assertTrue(%HasDictionaryElements(a));
|
|
|
|
%PrepareFunctionForOptimization(foo);
|
|
var b = [];
|
|
foo(b, 1);
|
|
foo(b, 2);
|
|
// Put b in dictionary mode.
|
|
b[10000] = 5;
|
|
assertTrue(%HasDictionaryElements(b));
|
|
foo(b, 3);
|
|
%PrepareFunctionForOptimization(foo);
|
|
%OptimizeFunctionOnNextCall(foo);
|
|
foo(b, 50000);
|
|
assertOptimized(foo);
|
|
assertTrue(%HasDictionaryElements(b));
|
|
|
|
// Clearing feedback for the StoreIC in foo is important for runs with
|
|
// flag --stress-opt.
|
|
%ClearFunctionFeedback(foo);
|
|
})();
|
|
|
|
|
|
(function() {
|
|
var a = new Array(10);
|
|
|
|
function foo2(a, i) {
|
|
a[i] = 50;
|
|
}
|
|
|
|
// The KeyedStoreIC will learn GROW_MODE.
|
|
%PrepareFunctionForOptimization(foo2);
|
|
foo2(a, 10);
|
|
foo2(a, 12);
|
|
foo2(a, 31);
|
|
%OptimizeFunctionOnNextCall(foo2);
|
|
foo2(a, 40);
|
|
|
|
assertOptimized(foo2);
|
|
assertTrue(%HasSmiElements(a));
|
|
|
|
// Grow a large array into large object space through the keyed store
|
|
// without deoptimizing. Grow by 9s. If we set elements too sparsely, the
|
|
// array will convert to dictionary mode.
|
|
a = new Array(99999);
|
|
assertTrue(%HasSmiElements(a));
|
|
for (var i = 0; i < 263000; i += 9) {
|
|
foo2(a, i);
|
|
}
|
|
|
|
// Verify that we are over 1 page in size, and foo2 remains optimized.
|
|
// This means we've smoothly transitioned to allocating in large object
|
|
// space.
|
|
assertTrue(%HasSmiElements(a));
|
|
assertTrue(a.length * 4 > (1024 * 1024));
|
|
assertOptimized(foo2);
|
|
|
|
%ClearFunctionFeedback(foo2);
|
|
})();
|