v8/test/mjsunit/regress/regress-4121.js
Mathias Bynens 7915cf939e [elements] Rename Has*Elements and Is*ElementsKind methods
Commit 26c00f4a4c improved the names of
most FAST_* elements kinds in the enum. This patch updates the matching
Has*Elements and Is*ElementsKind method names accordingly.

- HasFastSmiElements => HasSmiElements
- IsFastSmiElementsKind => IsSmiElementsKind
- HasFastObjectElements => HasObjectElements
- IsFastObjectElementsKind => IsObjectElementsKind
- HasFastSmiOrObjectElements => HasSmiOrObjectElements
- IsFastSmiOrObjectElementsKind => IsSmiOrObjectElementsKind
- HasFastDoubleElements => HasDoubleElements
- IsFastDoubleElementsKind => IsDoubleElementsKind
- HasFastHoleyElements => HasHoleyElements
- IsFastHoleyElementsKind => IsHoleyElementsKind

Additionally, FastHoleyElementsUsage is renamed to HoleyElementsUsage.

BUG=v8:6548

Cq-Include-Trybots: master.tryserver.chromium.linux:linux_chromium_rel_ng
Change-Id: Ie8f3d01eb43e909cbc6c372d88c5fbc4dfc2ac04
Reviewed-on: https://chromium-review.googlesource.com/558356
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Commit-Queue: Mathias Bynens <mathias@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46376}
2017-07-03 09:25:53 +00:00

44 lines
1.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 --no-always-opt
function literals_sharing_test(warmup, optimize) {
function closure() {
// Ensure small array literals start in specific element kind mode.
assertTrue(%HasSmiElements([]));
assertTrue(%HasSmiElements([1]));
assertTrue(%HasSmiElements([1,2]));
assertTrue(%HasDoubleElements([1.1]));
assertTrue(%HasDoubleElements([1.1,2]));
var a = [1, 2, 3];
if (warmup) {
// Transition elements kind during warmup...
assertTrue(%HasSmiElements(a));
assertEquals(4, a.push(1.3));
}
// ... and ensure that the information about transitioning is
// propagated to the next closure.
assertTrue(%HasDoubleElements(a));
};
if (optimize) %OptimizeFunctionOnNextCall(closure);
closure();
}
function test() {
for (var i = 0; i < 3; i++) {
// We only start tracking allocation information with the second
// instantiation.
var warmup = i < 2;
print("iter: " + i + ", warmup: "+ warmup);
literals_sharing_test(warmup, false);
}
print("iter: " + i + ", opt: true");
literals_sharing_test(warmup, true);
}
test();