[perf-test] Add a performance test for LdaGlobal bytecodes

Bug: v8:8394
Change-Id: Idd8f3a4a096c94b355ff0ef491281da31a1c960b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1849529
Reviewed-by: Santiago Aboy Solanes <solanes@chromium.org>
Commit-Queue: Mythri Alle <mythria@chromium.org>
Cr-Commit-Position: refs/heads/master@{#64198}
This commit is contained in:
Mythri A 2019-10-09 16:37:09 +01:00 committed by Commit Bot
parent 84ec511b10
commit 566ba7928c
2 changed files with 71 additions and 0 deletions

View File

@ -0,0 +1,60 @@
// 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('LoadGlobal', ldaGlobal);
addBenchmark('LoadGlobalInsideTypeof', ldaGlobalInsideTypeof);
var g_var = 10;
function ldaGlobal() {
for (var i = 0; i < 1000; ++i) {
g_var; g_var; g_var; g_var; g_var; g_var; g_var; g_var; g_var; g_var;
g_var; g_var; g_var; g_var; g_var; g_var; g_var; g_var; g_var; g_var;
g_var; g_var; g_var; g_var; g_var; g_var; g_var; g_var; g_var; g_var;
g_var; g_var; g_var; g_var; g_var; g_var; g_var; g_var; g_var; g_var;
g_var; g_var; g_var; g_var; g_var; g_var; g_var; g_var; g_var; g_var;
g_var; g_var; g_var; g_var; g_var; g_var; g_var; g_var; g_var; g_var;
g_var; g_var; g_var; g_var; g_var; g_var; g_var; g_var; g_var; g_var;
g_var; g_var; g_var; g_var; g_var; g_var; g_var; g_var; g_var; g_var;
g_var; g_var; g_var; g_var; g_var; g_var; g_var; g_var; g_var; g_var;
g_var; g_var; g_var; g_var; g_var; g_var; g_var; g_var; g_var; g_var;
}
}
function ldaGlobalInsideTypeof() {
for (var i = 0; i < 1000; ++i) {
typeof(g_var); typeof(g_var); typeof(g_var); typeof(g_var);
typeof(g_var); typeof(g_var); typeof(g_var); typeof(g_var);
typeof(g_var); typeof(g_var); typeof(g_var); typeof(g_var);
typeof(g_var); typeof(g_var); typeof(g_var); typeof(g_var);
typeof(g_var); typeof(g_var); typeof(g_var); typeof(g_var);
typeof(g_var); typeof(g_var); typeof(g_var); typeof(g_var);
typeof(g_var); typeof(g_var); typeof(g_var); typeof(g_var);
typeof(g_var); typeof(g_var); typeof(g_var); typeof(g_var);
typeof(g_var); typeof(g_var); typeof(g_var); typeof(g_var);
typeof(g_var); typeof(g_var); typeof(g_var); typeof(g_var);
typeof(g_var); typeof(g_var); typeof(g_var); typeof(g_var);
typeof(g_var); typeof(g_var); typeof(g_var); typeof(g_var);
typeof(g_var); typeof(g_var); typeof(g_var); typeof(g_var);
typeof(g_var); typeof(g_var); typeof(g_var); typeof(g_var);
typeof(g_var); typeof(g_var); typeof(g_var); typeof(g_var);
typeof(g_var); typeof(g_var); typeof(g_var); typeof(g_var);
typeof(g_var); typeof(g_var); typeof(g_var); typeof(g_var);
typeof(g_var); typeof(g_var); typeof(g_var); typeof(g_var);
typeof(g_var); typeof(g_var); typeof(g_var); typeof(g_var);
typeof(g_var); typeof(g_var); typeof(g_var); typeof(g_var);
typeof(g_var); typeof(g_var); typeof(g_var); typeof(g_var);
typeof(g_var); typeof(g_var); typeof(g_var); typeof(g_var);
typeof(g_var); typeof(g_var); typeof(g_var); typeof(g_var);
typeof(g_var); typeof(g_var); typeof(g_var); typeof(g_var);
typeof(g_var); typeof(g_var); typeof(g_var); typeof(g_var);
}
}

View File

@ -371,6 +371,17 @@
{"name": "Object-Lookup-Index-Number"},
{"name": "Object-Lookup-Index-String"}
]
},
{
"name": "LdaGlobal",
"main": "run.js",
"resources": [ "LdaGlobal.js" ],
"test_flags": [ "LdaGlobal" ],
"results_regexp": "^%s\\-BytecodeHandler\\(Score\\): (.+)$",
"tests": [
{"name": "LoadGlobal"},
{"name": "LoadGlobalInsideTypeof"}
]
}
]
},