36421dc467
By creating the boilerplate only on the second instantiation we cannot propagate back the elements transitions early enough. The resulting literals would change the initial ElementsKind one step too late and already pollute ICs that went to monomorphic state. - Disable lazy AllocationSites for literals containing arrays - Introduce new ComplexLiteral class to share code between ObjectLiteral and ArrayLiteral - RegexpLiteral now no longer needs a depth_ field Bug: v8:6517, v8:6519, v8:6211 Change-Id: Ia88d1878954e8895c3d00a7dda8d71e95bba005c Reviewed-on: https://chromium-review.googlesource.com/563305 Reviewed-by: Adam Klein <adamk@chromium.org> Reviewed-by: Ross McIlroy <rmcilroy@chromium.org> Reviewed-by: Benedikt Meurer <bmeurer@chromium.org> Commit-Queue: Camillo Bruni <cbruni@chromium.org> Cr-Commit-Position: refs/heads/master@{#46603}
43 lines
1.2 KiB
JavaScript
43 lines
1.2 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() {
|
|
var warmup = true;
|
|
for (var i = 0; i < 3; i++) {
|
|
print("iter: " + i + ", warmup: "+ warmup);
|
|
literals_sharing_test(warmup, false);
|
|
warmup = false;
|
|
}
|
|
print("iter: " + i + ", opt: true");
|
|
literals_sharing_test(warmup, true);
|
|
}
|
|
|
|
test();
|