v8/test/js-perf-test/InterpreterEntryTrampoline/arguments.js
Santiago Aboy Solanes c7966ad5a0 [test] Add micro-benchmark tests for calls with local vars
Reorganized folder as well.

Bug: v8:9451
Change-Id: I65203aa88791dd05d6ca0127d5b832ccd898aa52
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1695901
Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
Reviewed-by: Dan Elphick <delphick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62690}
2019-07-12 16:54:01 +00:00

120 lines
4.9 KiB
JavaScript

// Copyright 2019 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.
function addBenchmark(name, test) {
new BenchmarkSuite(name, [1000],
[
new Benchmark(name, false, false, 0, test)
]);
}
addBenchmark('Calls-No-Argument', callsNoArgument);
addBenchmark('Calls-One-Argument', callsOneArgument);
addBenchmark('Calls-Six-Arguments', callsSixArguments);
addBenchmark('Calls-With-Receiver', callsWithReceiver);
function callsNoArgument() {
function f() {
return 0;
}
for (var i = 0; i < 1000; ++i) {
f(); f(); f(); f(); f(); f(); f(); f(); f();
f(); f(); f(); f(); f(); f(); f(); f(); f();
f(); f(); f(); f(); f(); f(); f(); f(); f();
f(); f(); f(); f(); f(); f(); f(); f(); f();
f(); f(); f(); f(); f(); f(); f(); f(); f();
f(); f(); f(); f(); f(); f(); f(); f(); f();
f(); f(); f(); f(); f(); f(); f(); f(); f();
f(); f(); f(); f(); f(); f(); f(); f(); f();
f(); f(); f(); f(); f(); f(); f(); f(); f();
f(); f(); f(); f(); f(); f(); f(); f(); f();
f(); f(); f(); f(); f(); f(); f(); f(); f();
}
}
function callsOneArgument() {
function f(a) {
return a;
}
let z = 0;
for (var i = 0; i < 1000; ++i) {
f(z); f(z); f(z); f(z); f(z); f(z); f(z); f(z);
f(z); f(z); f(z); f(z); f(z); f(z); f(z); f(z);
f(z); f(z); f(z); f(z); f(z); f(z); f(z); f(z);
f(z); f(z); f(z); f(z); f(z); f(z); f(z); f(z);
f(z); f(z); f(z); f(z); f(z); f(z); f(z); f(z);
f(z); f(z); f(z); f(z); f(z); f(z); f(z); f(z);
f(z); f(z); f(z); f(z); f(z); f(z); f(z); f(z);
f(z); f(z); f(z); f(z); f(z); f(z); f(z); f(z);
f(z); f(z); f(z); f(z); f(z); f(z); f(z); f(z);
f(z); f(z); f(z); f(z); f(z); f(z); f(z); f(z);
f(z); f(z); f(z); f(z); f(z); f(z); f(z); f(z);
f(z); f(z); f(z); f(z); f(z); f(z); f(z); f(z);
}
}
function callsSixArguments() {
function g(a,b,c,d,e,f) {
return c;
}
let a = 0;
let b = 1;
let c = 2;
let d = 3;
let e = 4;
let f = 5;
for (var i = 0; i < 1000; ++i) {
g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f);
g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f);
g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f);
g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f);
g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f);
g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f);
g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f);
g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f);
g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f);
g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f);
g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f);
g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f);
g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f);
g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f);
g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f);
g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f);
g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f);
g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f);
g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f);
g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f);
g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f);
g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f);
g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f);
g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f); g(a,b,c,d,e,f);
}
}
function callsWithReceiver() {
function constructObject() {
this.f = function() {
return 0;
};
}
let o = new constructObject();
for (var i = 0; i < 1000; ++i) {
o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f(); o.f();
}
}