Skip to content

Commit

Permalink
[jsperf] Add benchmark for LoadConstantFromPrototype
Browse files Browse the repository at this point in the history
Bug: v8:9616
Change-Id: Ieca74f8df90b342672c8904beef2c2298f0ba597
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1755991
Reviewed-by: Igor Sheludko <ishell@chromium.org>
Commit-Queue: Sathya Gunasekaran  <gsathya@chromium.org>
Cr-Commit-Position: refs/heads/master@{#63221}
  • Loading branch information
gsathya authored and Commit Bot committed Aug 16, 2019
1 parent dd6af4e commit b464b62
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test/js-perf-test/IC/loadconstantfromprototype.js
@@ -0,0 +1,23 @@
// 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.

new BenchmarkSuite('LoadConstantFromPrototype', [1000], [
new Benchmark('LoadConstantFromPrototype', false, false, 0, LoadConstantFromPrototype)
]);

function Foo() {};

Foo.prototype.bar = {};
Foo.prototype.covfefe = function() {};
Foo.prototype.baz = 1;

function LoadConstantFromPrototype() {
let foo = new Foo();

for (let i = 0; i < 1000; ++i) {
foo.bar;
foo.covfefe;
foo.baz;
}
}
24 changes: 24 additions & 0 deletions test/js-perf-test/IC/run.js
@@ -0,0 +1,24 @@
// 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('loadconstantfromprototype.js');

function PrintResult(name, result) {
print(name + '-IC(Score): ' + result);
}

function PrintStep(name) {}

function PrintError(name, error) {
PrintResult(name, error);
}

BenchmarkSuite.config.doWarmup = undefined;
BenchmarkSuite.config.doDeterministic = undefined;

BenchmarkSuite.RunSuites({ NotifyResult: PrintResult,
NotifyError: PrintError,
NotifyStep: PrintStep });
12 changes: 12 additions & 0 deletions test/js-perf-test/JSTests5.json
Expand Up @@ -618,6 +618,18 @@
{"name": "Inline-Serialize-Error.stack"},
{"name": "Recursive-Serialize-Error.stack"}
]
},
{
"name": "IC",
"path": ["IC"],
"main": "run.js",
"flags": ["--no-opt"],
"resources": ["loadconstantfromprototype.js"],
"results_regexp": "^%s\\-IC\\(Score\\): (.+)$",
"tests": [
{"name": "LoadConstantFromPrototype"
}
]
}
]
}

0 comments on commit b464b62

Please sign in to comment.