[ic] Add benchmark for LdaKeyedLoad

Bug: v8:9449
Change-Id: I7c50db92459df2a8a7da7b0bd2efdd2f3bed3e46
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1690952
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Auto-Submit: Sathya Gunasekaran <gsathya@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62671}
This commit is contained in:
Sathya Gunasekaran 2019-07-12 10:42:36 +01:00 committed by Commit Bot
parent 3f3625f3cf
commit cc9964bb65
2 changed files with 52 additions and 0 deletions

View File

@ -0,0 +1,40 @@
// 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)
]);
}
function objectLookupStringConstant() {
const x = { 1: "foo" };
for (var i = 0; i < 1000; ++i) {
const p = x["1"];
}
}
function objectLookupIndexNumber() {
const x = { 1: "foo" };
const a = 1;
for (var i = 0; i < 1000; ++i) {
const p = x[a];
}
}
function objectLookupIndexString() {
const x = { 1: "foo" };
const a = "1";
for (var i = 0; i < 1000; ++i) {
const p = x[a];
}
}
addBenchmark('Object-Lookup-String-Constant', objectLookupStringConstant);
addBenchmark('Object-Lookup-Index-Number', objectLookupIndexNumber);
addBenchmark('Object-Lookup-Index-String', objectLookupIndexString);

View File

@ -359,6 +359,18 @@
{"name": "Smi-Value"},
{"name": "Prototype-Chain-Value"}
]
},
{
"name": "LdaKeyedProperty",
"main": "run.js",
"resources": [ "LdaKeyedProperty.js" ],
"test_flags": [ "LdaKeyedProperty" ],
"results_regexp": "^%s\\-BytecodeHandler\\(Score\\): (.+)$",
"tests": [
{"name": "Object-Lookup-String-Constant"},
{"name": "Object-Lookup-Index-Number"},
{"name": "Object-Lookup-Index-String"}
]
}
]
},