v8/test/mjsunit/baseline/batch-compilation.js
Victor Gomes b54f1360b7 [baseline] Remove SP-on-the-GC-heap
Compiling Sparkplug on the heap saved 10% of the CompileBaseline
RCS metric, but that came with too much code complexity.
Since in the end that corresponds to < 1% of the entire compilation
time, we decided to revert this project.

This reverts:
commit e29b2ae48a
commit d1f2a83b7d
commit 4666e18206
commit a1147408e4
commit e0d4254f97
commit 9ab8422da7
commit a3b24ecc51
commit 1eb8770691
commit fe5c9dfd90
commit 7ac3b55a20
commit 7e95f30ec9
commit 323b596212
commit 6bf0b70490
commit e82b368b67
commit 5020d83e05
commit 642a467338
commit ec7b99d5c6
commit fb4f89aede
commit 208854bb14
commit 63be6dde31

Bug: v8:12158
Change-Id: I9f2539be6c7d80c6e243c9ab173e3c5bb0dff97d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3136453
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Reviewed-by: Camillo Bruni <cbruni@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#77319}
2021-10-11 13:34:45 +00:00

74 lines
2.0 KiB
JavaScript

// Copyright 2021 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: --sparkplug --no-always-sparkplug --sparkplug-filter="test*"
// Flags: --allow-natives-syntax --expose-gc --no-always-opt
// Flags: --baseline-batch-compilation --baseline-batch-compilation-threshold=200
// Flags: --scale-factor-for-feedback-allocation=4
// Flags to drive Fuzzers into the right direction
// TODO(v8:11853): Remove these flags once fuzzers handle flag implications
// better.
// Flags: --lazy-feedback-allocation --no-stress-concurrent-inlining
// Basic test
(function() {
// Bytecode length 24 -> estimated instruction size 120 - 168.
function test1 (a,b) {
return (a + b + 11) * 42 / a % b;
}
// Bytecode length 24 -> estimated instruction size 120 - 168.
function test2 (a,b) {
return (a + b + 11) * 42 / a % b;
}
%NeverOptimizeFunction(test1);
// Trigger bytecode budget interrupt for test1.
for (let i=0; i<5; ++i) {
test1(i,4711);
}
// Shouldn't be compiled because of batch compilation.
assertFalse(isBaseline(test1));
%NeverOptimizeFunction(test2);
// Trigger bytecode budget interrupt for test2.
for (let i=0; i<5; ++i) {
test2(i,4711);
}
// Call test1 again so baseline code gets installed on the function.
test1(1,2);
// Both functions should be compiled with baseline now.
assertTrue(isBaseline(test1));
assertTrue(isBaseline(test2));
})();
// Test function weak handle.
(function() {
function test_weak (a,b) {
return (a + b + 11) * 42 / a % b;
}
function test2 (a,b) {
return (a + b + 11) * 42 / a % b;
}
%NeverOptimizeFunction(test_weak);
for (let i=0; i<5; ++i) {
test_weak(i,4711);
}
gc(); // GC should cause the handle to test_weak to be freed.
%NeverOptimizeFunction(test2);
// Trigger bytecode budget interrupt for test2.
for (let i=0; i<5; ++i) {
test2(i,4711);
}
assertTrue(isBaseline(test2));
})();