925effd045
The goal is to have one graph per test case, and inside the graph, 4 different lines: - baseline - baseline noopt - super-ic - super-ic noopt Bug: v8:9237 Change-Id: I511b5555487a3d96698a3fb648abf76a13f76858 No-Try: True Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2384770 Reviewed-by: Peter Marshall <petermarshall@chromium.org> Commit-Queue: Marja Hölttä <marja@chromium.org> Cr-Commit-Position: refs/heads/master@{#69618}
44 lines
895 B
JavaScript
44 lines
895 B
JavaScript
// Copyright 2020 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.
|
|
|
|
const DETERMINISTIC_RUNS = 10000;
|
|
new BenchmarkSuite(BENCHMARK_NAME, [1000], [
|
|
new Benchmark(BENCHMARK_NAME, false, false, DETERMINISTIC_RUNS,
|
|
runBenchmark)
|
|
]);
|
|
|
|
function createSubclass() {
|
|
class A {
|
|
get super_prop() {
|
|
return 10;
|
|
}
|
|
};
|
|
class B extends A {
|
|
test() {
|
|
return super.super_prop;
|
|
}
|
|
};
|
|
return B;
|
|
}
|
|
|
|
const NO_CLASSES = 10;
|
|
let objects = [];
|
|
for (let i = 0; i < NO_CLASSES; ++i) {
|
|
const klass = createSubclass();
|
|
objects.push(new klass());
|
|
}
|
|
|
|
let ix = 0;
|
|
const EXPECTED_VALUE = 10;
|
|
|
|
function runBenchmark() {
|
|
const r = objects[ix].test();
|
|
if (r != EXPECTED_VALUE) {
|
|
throw new Error("Test error");
|
|
}
|
|
if (++ix == objects.length) {
|
|
ix = 0;
|
|
}
|
|
}
|