v8/test/mjsunit/compiler/osr-literals.js
Mythri A 289b25765a [Test] Update tests to work with lazy feedback allocation.
This adds either %EnsureFeedbackVectorForFunction or
%PrepareFunctionForOptimization to allocate feedback vectors when testing
optimization, allocation sites, IC transitions etc.,

Bug: v8:8394
Change-Id: I6ad1b6d460e4abda693b326cddb87754e080a0a1
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1593303
Commit-Queue: Mythri Alle <mythria@chromium.org>
Auto-Submit: Mythri Alle <mythria@chromium.org>
Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61212}
2019-05-03 15:21:22 +00:00

62 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 --use-osr
function mod() {
function f0() {
for (var i = 0; i < 3; i = i + 1 | 0) {
%OptimizeOsr();
}
return {blah: i};
}
%PrepareFunctionForOptimization(f0);
function f1(a) {
for (var i = 0; i < 3; i = i + 1 | 0) {
%OptimizeOsr();
}
return {blah: i};
}
%PrepareFunctionForOptimization(f1);
function f2(a,b) {
for (var i = 0; i < 3; i = i + 1 | 0) {
%OptimizeOsr();
}
return {blah: i};
}
%PrepareFunctionForOptimization(f2);
function f3(a,b,c) {
for (var i = 0; i < 3; i = i + 1 | 0) {
%OptimizeOsr();
}
return {blah: i};
}
%PrepareFunctionForOptimization(f3);
function f4(a,b,c,d) {
for (var i = 0; i < 3; i = i + 1 | 0) {
%OptimizeOsr();
}
return {blah: i};
}
%PrepareFunctionForOptimization(f4);
function bar() {
assertEquals(3, f0().blah);
assertEquals(3, f1(1).blah);
assertEquals(3, f2(1,2).blah);
assertEquals(3, f3(1,2,3).blah);
assertEquals(3, f4(1,2,3,4).blah);
}
bar();
}
mod();
mod();
mod();