[api] Add benchmark for api accessors

Bug: v8:11321
Change-Id: I330fb8ee7d915f99f9b82f7187be40ac33043f62
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2883625
Reviewed-by: Camillo Bruni <cbruni@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#77340}
This commit is contained in:
Sathya Gunasekaran 2021-05-10 14:31:12 +01:00 committed by V8 LUCI CQ
parent f19ee5e093
commit 196a527504
3 changed files with 44 additions and 0 deletions

View File

@ -0,0 +1,14 @@
// 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 LoadNodeType() {
let node = new d8.dom.Div();
let result = 0;
for (var i = 0; i < 10e5; i++) {
result += node.nodeType;
}
return result;
}
createSuite('nodeType', 1, LoadNodeType, ()=>{});

View File

@ -0,0 +1,19 @@
// 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.
load('../base.js');
load('accessor.js');
function PrintResult(name, result) {
console.log(name + '-ApiAccessors(Score): ' + result);
}
function PrintError(name, error) {
PrintResult(name, error);
}
BenchmarkSuite.config.doWarmup = undefined;
BenchmarkSuite.config.doDeterministic = undefined;
BenchmarkSuite.RunSuites({ NotifyResult: PrintResult,
NotifyError: PrintError });

View File

@ -509,6 +509,17 @@
{"name": "NewIntlLocaleWithOptions"}
]
},
{
"name": "ApiAccessors",
"path": ["ApiAccessors"],
"main": "run.js",
"resources": [ "accessor.js" ],
"flags": [],
"results_regexp": "^%s\\-ApiAccessors\\(Score\\): (.+)$",
"tests": [
{"name": "nodeType"}
]
},
{
"name": "Inspector",
"path": ["Inspector"],