[super] Rewrite perf tests

- Add tests comparing super property access to normal property access
- Shift the work so that the framework takes less time and the thing
we're trying to measure takes more time.
- Optimize / disable the optimization for the target function, not the
whole test framework.
- Reduce the amount of boilerplate code in the tests.

Bug: v8:9237
Change-Id: Idde133298c9b8ffb3d49945ef9c67f5039634598
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2536635
Reviewed-by: Shu-yu Guo <syg@chromium.org>
Commit-Queue: Marja Hölttä <marja@chromium.org>
Cr-Commit-Position: refs/heads/master@{#71196}
This commit is contained in:
Marja Hölttä 2020-11-16 09:00:32 +01:00 committed by Commit Bot
parent b71769761c
commit 7ed989817a
13 changed files with 347 additions and 747 deletions

View File

@ -11,352 +11,202 @@
"resources": ["base.js"],
"tests": [
{
"name": "Monomorphic",
"name": "Compare-Monomorphic-1-opt",
"path": ["SuperIC"],
"results_regexp": "^%s\\(Score\\): (.+)$",
"test_flags": ["monomorphic"],
"resources": ["compare-super-and-normal-property-access.js"],
"flags": ["--allow-natives-syntax"],
"tests": [
{
"name": "baseline",
"main": "run.js",
"resources": ["monomorphic.js"],
"test_flags": ["baseline"]
"name": "normal-opt",
"main": "compare-super-and-normal-property-access.js",
"test_flags": ["normal-opt", "normal_1", "opt"]
},
{
"name": "baseline-noopt",
"main": "run.js",
"resources": ["monomorphic.js"],
"test_flags": ["baseline-noopt"],
"flags": ["--noopt"]
"name": "super-baseline-opt",
"main": "compare-super-and-normal-property-access.js",
"test_flags": ["super-baseline-opt", "super_1", "opt"]
},
{
"name": "superic",
"main": "run.js",
"resources": ["monomorphic.js"],
"test_flags": ["superic"],
"flags": ["--super-ic"]
},
{
"name": "superic-noopt",
"main": "run.js",
"resources": ["monomorphic.js"],
"test_flags": ["superic-noopt"],
"flags": ["--super-ic", "--noopt"]
"name": "super-super-ic-opt",
"main": "compare-super-and-normal-property-access.js",
"flags": ["--super-ic"],
"test_flags": ["super-super-ic-opt", "super_1", "opt"]
}
]
},
{
"name": "Monomorphic-MegaReceivers",
"name": "Compare-Monomorphic-1-noopt",
"path": ["SuperIC"],
"results_regexp": "^%s\\(Score\\): (.+)$",
"test_flags": ["monomorphic-mega-receivers"],
"resources": ["compare-super-and-normal-property-access.js"],
"flags": ["--allow-natives-syntax"],
"tests": [
{
"name": "baseline",
"main": "run.js",
"resources": ["monomorphic-mega-receivers.js"],
"test_flags": ["baseline"]
"name": "normal-noopt",
"main": "compare-super-and-normal-property-access.js",
"test_flags": ["normal-noopt", "normal_1", "noopt"]
},
{
"name": "baseline-noopt",
"main": "run.js",
"resources": ["monomorphic-mega-receivers.js"],
"test_flags": ["baseline-noopt"],
"flags": ["--noopt"]
"name": "super-baseline-noopt",
"main": "compare-super-and-normal-property-access.js",
"test_flags": ["super-baseline-noopt", "super_1", "noopt"]
},
{
"name": "superic",
"main": "run.js",
"resources": ["monomorphic-mega-receivers.js"],
"test_flags": ["superic"],
"flags": ["--super-ic"]
},
{
"name": "superic-noopt",
"main": "run.js",
"resources": ["monomorphic-mega-receivers.js"],
"test_flags": ["superic-noopt"],
"flags": ["--super-ic", "--noopt"]
"name": "super-super-ic-noopt",
"main": "compare-super-and-normal-property-access.js",
"flags": ["--super-ic"],
"test_flags": ["super-super-ic-noopt", "super_1", "noopt"]
}
]
},
{
"name": "Polymorphic-Mixin",
"name": "Compare-Monomorphic-2-opt",
"path": ["SuperIC"],
"results_regexp": "^%s\\(Score\\): (.+)$",
"test_flags": ["polymorphic-mixin"],
"resources": ["compare-super-and-normal-property-access.js"],
"flags": ["--allow-natives-syntax"],
"tests": [
{
"name": "baseline",
"main": "run.js",
"resources": ["polymorphic-mixin.js"],
"test_flags": ["baseline"]
"name": "normal-opt",
"main": "compare-super-and-normal-property-access.js",
"test_flags": ["normal-opt", "normal_2", "opt"]
},
{
"name": "baseline-noopt",
"main": "run.js",
"resources": ["polymorphic-mixin.js"],
"test_flags": ["baseline-noopt"],
"flags": ["--noopt"]
"name": "super-baseline-opt",
"main": "compare-super-and-normal-property-access.js",
"test_flags": ["super-baseline-opt", "super_2", "opt"]
},
{
"name": "superic",
"main": "run.js",
"resources": ["polymorphic-mixin.js"],
"test_flags": ["superic"],
"flags": ["--super-ic"]
},
{
"name": "superic-noopt",
"main": "run.js",
"resources": ["polymorphic-mixin.js"],
"test_flags": ["superic-noopt"],
"flags": ["--super-ic", "--noopt"]
"name": "super-super-ic-opt",
"main": "compare-super-and-normal-property-access.js",
"flags": ["--super-ic"],
"test_flags": ["super-super-ic-opt", "super_2", "opt"]
}
]
},
{
"name": "Polymorphic-Mixin-MegaReceivers",
"name": "Compare-Monomorphic-2-noopt",
"path": ["SuperIC"],
"results_regexp": "^%s\\(Score\\): (.+)$",
"test_flags": ["polymorphic-mixin-mega-receivers"],
"resources": ["compare-super-and-normal-property-access.js"],
"flags": ["--allow-natives-syntax"],
"tests": [
{
"name": "baseline",
"main": "run.js",
"resources": ["polymorphic-mixin-mega-receivers.js"],
"test_flags": ["baseline"]
"name": "normal-noopt",
"main": "compare-super-and-normal-property-access.js",
"test_flags": ["normal-noopt", "normal_2", "noopt"]
},
{
"name": "baseline-noopt",
"main": "run.js",
"resources": ["polymorphic-mixin-mega-receivers.js"],
"test_flags": ["baseline-noopt"],
"flags": ["--noopt"]
"name": "super-baseline-noopt",
"main": "compare-super-and-normal-property-access.js",
"test_flags": ["super-baseline-noopt", "super_2", "noopt"]
},
{
"name": "superic",
"main": "run.js",
"resources": ["polymorphic-mixin-mega-receivers.js"],
"test_flags": ["superic"],
"flags": ["--super-ic"]
},
{
"name": "superic-noopt",
"main": "run.js",
"resources": ["polymorphic-mixin-mega-receivers.js"],
"test_flags": ["superic-noopt"],
"flags": ["--super-ic", "--noopt"]
"name": "super-super-ic-noopt",
"main": "compare-super-and-normal-property-access.js",
"flags": ["--super-ic"],
"test_flags": ["super-super-ic-noopt", "super_2", "noopt"]
}
]
},
{
"name": "Megamorphic-Mixin",
"name": "Compare-Megamorphic-1-opt",
"path": ["SuperIC"],
"results_regexp": "^%s\\(Score\\): (.+)$",
"test_flags": ["polymorphic-mixin"],
"resources": ["compare-super-and-normal-property-access.js"],
"flags": ["--allow-natives-syntax"],
"tests": [
{
"name": "baseline",
"main": "run.js",
"resources": ["megamorphic-mixin.js"],
"test_flags": ["baseline"]
"name": "normal-opt",
"main": "compare-super-and-normal-property-access.js",
"test_flags": ["normal-opt", "normal_3", "opt"]
},
{
"name": "baseline-noopt",
"main": "run.js",
"resources": ["megamorphic-mixin.js"],
"test_flags": ["baseline-noopt"],
"flags": ["--noopt"]
"name": "super-baseline-opt",
"main": "compare-super-and-normal-property-access.js",
"test_flags": ["super-baseline-opt", "super_3", "opt"]
},
{
"name": "superic",
"main": "run.js",
"resources": ["megamorphic-mixin.js"],
"test_flags": ["superic"],
"flags": ["--super-ic"]
},
{
"name": "superic-noopt",
"main": "run.js",
"resources": ["megamorphic-mixin.js"],
"test_flags": ["superic-noopt"],
"flags": ["--super-ic", "--noopt"]
"name": "super-super-ic-opt",
"main": "compare-super-and-normal-property-access.js",
"flags": ["--super-ic"],
"test_flags": ["super-super-ic-opt", "super_3", "opt"]
}
]
},
{
"name": "Monomorphic-Getter",
"name": "Compare-Megamorphic-1-noopt",
"path": ["SuperIC"],
"results_regexp": "^%s\\(Score\\): (.+)$",
"test_flags": ["monomorphic-getter"],
"resources": ["compare-super-and-normal-property-access.js"],
"flags": ["--allow-natives-syntax"],
"tests": [
{
"name": "baseline",
"main": "run.js",
"resources": ["monomorphic-getter.js"],
"test_flags": ["baseline"]
"name": "normal-noopt",
"main": "compare-super-and-normal-property-access.js",
"test_flags": ["normal-noopt", "normal_3", "noopt"]
},
{
"name": "baseline-noopt",
"main": "run.js",
"resources": ["monomorphic-getter.js"],
"test_flags": ["baseline-noopt"],
"flags": ["--noopt"]
"name": "super-baseline-noopt",
"main": "compare-super-and-normal-property-access.js",
"test_flags": ["super-baseline-noopt", "super_3", "noopt"]
},
{
"name": "superic",
"main": "run.js",
"resources": ["monomorphic-getter.js"],
"test_flags": ["superic"],
"flags": ["--super-ic"]
},
{
"name": "superic-noopt",
"main": "run.js",
"resources": ["monomorphic-getter.js"],
"test_flags": ["superic-noopt"],
"flags": ["--super-ic", "--noopt"]
"name": "super-super-ic-noopt",
"main": "compare-super-and-normal-property-access.js",
"flags": ["--super-ic"],
"test_flags": ["super-super-ic-noopt", "super_3", "noopt"]
}
]
},
{
"name": "Monomorphic-MegaReceivers-Getter",
"name": "Compare-Megamorphic-2-opt",
"path": ["SuperIC"],
"results_regexp": "^%s\\(Score\\): (.+)$",
"test_flags": ["monomorphic-mega-receivers-getter"],
"resources": ["compare-super-and-normal-property-access.js"],
"flags": ["--allow-natives-syntax"],
"tests": [
{
"name": "baseline",
"main": "run.js",
"resources": ["monomorphic-mega-receivers-getter.js"],
"test_flags": ["baseline"]
"name": "normal-opt",
"main": "compare-super-and-normal-property-access.js",
"test_flags": ["normal-opt", "normal_4", "opt"]
},
{
"name": "baseline-noopt",
"main": "run.js",
"resources": ["monomorphic-mega-receivers-getter.js"],
"test_flags": ["baseline-noopt"],
"flags": ["--noopt"]
"name": "super-baseline-opt",
"main": "compare-super-and-normal-property-access.js",
"test_flags": ["super-baseline-opt", "super_4", "opt"]
},
{
"name": "superic",
"main": "run.js",
"resources": ["monomorphic-mega-receivers-getter.js"],
"test_flags": ["superic"],
"flags": ["--super-ic"]
},
{
"name": "superic-noopt",
"main": "run.js",
"resources": ["monomorphic-mega-receivers-getter.js"],
"test_flags": ["superic-noopt"],
"flags": ["--super-ic", "--noopt"]
"name": "super-super-ic-opt",
"main": "compare-super-and-normal-property-access.js",
"flags": ["--super-ic"],
"test_flags": ["super-super-ic-opt", "super_4", "opt"]
}
]
},
{
"name": "Polymorphic-Mixin-Getter",
"name": "Compare-Megamorphic-2-noopt",
"path": ["SuperIC"],
"results_regexp": "^%s\\(Score\\): (.+)$",
"test_flags": ["polymorphic-mixin-getter"],
"resources": ["compare-super-and-normal-property-access.js"],
"flags": ["--allow-natives-syntax"],
"tests": [
{
"name": "baseline",
"main": "run.js",
"resources": ["polymorphic-mixin-getter.js"],
"test_flags": ["baseline"]
"name": "normal-noopt",
"main": "compare-super-and-normal-property-access.js",
"test_flags": ["normal-noopt", "normal_4", "noopt"]
},
{
"name": "baseline-noopt",
"main": "run.js",
"resources": ["polymorphic-mixin-getter.js"],
"test_flags": ["baseline-noopt"],
"flags": ["--noopt"]
"name": "super-baseline-noopt",
"main": "compare-super-and-normal-property-access.js",
"test_flags": ["super-baseline-noopt", "super_4", "noopt"]
},
{
"name": "superic",
"main": "run.js",
"resources": ["polymorphic-mixin-getter.js"],
"test_flags": ["superic"],
"flags": ["--super-ic"]
},
{
"name": "superic-noopt",
"main": "run.js",
"resources": ["polymorphic-mixin-getter.js"],
"test_flags": ["superic-noopt"],
"flags": ["--super-ic", "--noopt"]
}
]
},
{
"name": "Polymorphic-Mixin-MegaReceivers-Getter",
"path": ["SuperIC"],
"results_regexp": "^%s\\(Score\\): (.+)$",
"test_flags": ["polymorphic-mixin-mega-receivers-getter"],
"tests": [
{
"name": "baseline",
"main": "run.js",
"resources": ["polymorphic-mixin-mega-receivers-getter.js"],
"test_flags": ["baseline"]
},
{
"name": "baseline-noopt",
"main": "run.js",
"resources": ["polymorphic-mixin-mega-receivers-getter.js"],
"test_flags": ["baseline-noopt"],
"flags": ["--noopt"]
},
{
"name": "superic",
"main": "run.js",
"resources": ["polymorphic-mixin-mega-receivers-getter.js"],
"test_flags": ["superic"],
"flags": ["--super-ic"]
},
{
"name": "superic-noopt",
"main": "run.js",
"resources": ["polymorphic-mixin-mega-receivers-getter.js"],
"test_flags": ["superic-noopt"],
"flags": ["--super-ic", "--noopt"]
}
]
},
{
"name": "Megamorphic-Mixin-Getter",
"path": ["SuperIC"],
"results_regexp": "^%s\\(Score\\): (.+)$",
"test_flags": ["polymorphic-mixin-getter"],
"tests": [
{
"name": "baseline",
"main": "run.js",
"resources": ["megamorphic-mixin-getter.js"],
"test_flags": ["baseline"]
},
{
"name": "baseline-noopt",
"main": "run.js",
"resources": ["megamorphic-mixin-getter.js"],
"test_flags": ["baseline-noopt"],
"flags": ["--noopt"]
},
{
"name": "superic",
"main": "run.js",
"resources": ["megamorphic-mixin-getter.js"],
"test_flags": ["superic"],
"flags": ["--super-ic"]
},
{
"name": "superic-noopt",
"main": "run.js",
"resources": ["megamorphic-mixin-getter.js"],
"test_flags": ["superic-noopt"],
"flags": ["--super-ic", "--noopt"]
"name": "super-super-ic-noopt",
"main": "compare-super-and-normal-property-access.js",
"flags": ["--super-ic"],
"test_flags": ["super-super-ic-noopt", "super_4", "noopt"]
}
]
}

View File

@ -0,0 +1,243 @@
// 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.
load('../base.js');
const BENCHMARK_NAME = arguments[0];
const TEST_TYPE = arguments[1];
const optimize_param = arguments[2];
let optimize;
if (optimize_param == "opt") {
optimize = true;
} else if (optimize_param == "noopt"){
optimize = false;
} else {
throw new Error("Test configuration error");
}
const DETERMINISTIC_RUNS = 1;
const LOCAL_ITERATIONS = 10000;
new BenchmarkSuite(BENCHMARK_NAME, [1000], [
new Benchmark(BENCHMARK_NAME, false, false, DETERMINISTIC_RUNS, runBenchmark)
]);
// Classes for monomorphic super property access.
class A { };
A.prototype.super_prop_a0 = 10;
A.prototype.super_prop_a1 = 10;
A.prototype.super_prop_a2 = 10;
A.prototype.super_prop_a3 = 10;
A.prototype.super_prop_a4 = 10;
A.prototype.super_prop_a5 = 10;
A.prototype.super_prop_a6 = 10;
A.prototype.super_prop_a7 = 10;
A.prototype.super_prop_a8 = 10;
A.prototype.super_prop_a9 = 10;
class B extends A { }
B.prototype.super_prop_b0 = 10;
B.prototype.super_prop_b1 = 10;
B.prototype.super_prop_b2 = 10;
B.prototype.super_prop_b3 = 10;
B.prototype.super_prop_b4 = 10;
B.prototype.super_prop_b5 = 10;
B.prototype.super_prop_b6 = 10;
B.prototype.super_prop_b7 = 10;
B.prototype.super_prop_b8 = 10;
B.prototype.super_prop_b9 = 10;
class C extends B {
test_super_a(unused) {
// Do many property accesses to increase the time taken by the thing we want
// to measure, in comparison to the overhead of calling this function.
return (super.super_prop_a0 + super.super_prop_a1 + super.super_prop_a2 +
super.super_prop_a3 + super.super_prop_a4 + super.super_prop_a5 +
super.super_prop_a6 + super.super_prop_a7 + super.super_prop_a8 +
super.super_prop_a9);
}
test_super_b(unused) {
return (super.super_prop_b0 + super.super_prop_b1 + super.super_prop_b2 +
super.super_prop_b3 + super.super_prop_b4 + super.super_prop_b5 +
super.super_prop_b6 + super.super_prop_b7 + super.super_prop_b8 +
super.super_prop_b9);
}
};
// Classes for megamorphic super property access.
function createClasses(base) {
class B extends base { };
B.prototype.super_prop_b0 = 10;
B.prototype.super_prop_b1 = 10;
B.prototype.super_prop_b2 = 10;
B.prototype.super_prop_b3 = 10;
B.prototype.super_prop_b4 = 10;
B.prototype.super_prop_b5 = 10;
B.prototype.super_prop_b6 = 10;
B.prototype.super_prop_b7 = 10;
B.prototype.super_prop_b8 = 10;
B.prototype.super_prop_b9 = 10;
class C extends B {
test_super_a(unused) {
return (super.super_prop_a0 + super.super_prop_a1 + super.super_prop_a2 +
super.super_prop_a3 + super.super_prop_a4 + super.super_prop_a5 +
super.super_prop_a6 + super.super_prop_a7 + super.super_prop_a8 +
super.super_prop_a9);
}
test_super_b(unused) {
return (super.super_prop_b0 + super.super_prop_b1 + super.super_prop_b2 +
super.super_prop_b3 + super.super_prop_b4 + super.super_prop_b5 +
super.super_prop_b6 + super.super_prop_b7 + super.super_prop_b8 +
super.super_prop_b9);
}
}
return C;
}
function test_property_access(o) {
return (o.prop0 + o.prop1 + o.prop2 + o.prop3 + o.prop4 + o.prop5 + o.prop6 +
o.prop7 + o.prop8 + o.prop9);
}
// Set up "objects" and "tested_functions" based on which test we're running.
let objects;
let tested_functions;
switch (TEST_TYPE) {
case "super_1":
// Monomorphic super property lookup, property is a constant, found 1 step
// above the lookup start object in the prototype chain.
objects = [new C()];
tested_functions = [C.prototype.test_super_a];
break;
case "normal_1":
// Monomorphic normal property lookup, property is a constant, found 1 step
// above the lookup start object in the prototype chain.
objects = [{__proto__: {"prop0": 10, "prop1": 10, "prop2": 10, "prop3": 10,
"prop4": 10, "prop5": 10, "prop6": 10, "prop7": 10,
"prop8": 10, "prop9": 10}}];
tested_functions = [test_property_access];
break;
case "super_2":
// Monomorphic super property lookup, property is a constant, found in the
// lookup start object.
objects = [new C()];
tested_functions = [C.prototype.test_super_b];
break;
case "normal_2":
// Monomorphic normal property lookup, property is a constant, found in the
// lookup start object.
objects = [{"prop0": 10, "prop1": 10, "prop2": 10, "prop3": 10, "prop4": 10,
"prop5": 10, "prop6": 10, "prop7": 10, "prop8": 10,
"prop9": 10}];
tested_functions = [test_property_access];
break;
case "super_3":
// Megamorphic super property lookup, property is a constant, found 1 step
// above the lookup start object in the prototype chain. The holder is
// the same in all cases though.
objects = [];
tested_functions = [];
for (let i = 0; i < 5; ++i) {
const c = createClasses(A);
objects.push(new c());
tested_functions.push(c.prototype.test_super_a);
}
break;
case "normal_3":
// Megamorphic normal property lookup, property is a constant, found 1 step
// above the lookup start object in the prototype chain. The holder is
// the same in all cases though.
const proto = {"prop0": 10, "prop1": 10, "prop2": 10, "prop3": 10,
"prop4": 10, "prop5": 10, "prop6": 10, "prop7": 10,
"prop8": 10, "prop9": 10};
objects = [{__proto__: proto}, {__proto__: proto, "a": 1},
{__proto__: proto, "a": 1, "b": 1},
{__proto__: proto, "a": 1, "b": 1, "c": 1},
{__proto__: proto, "a": 1, "b": 1, "c": 1, "d": 1}];
tested_functions = [test_property_access, test_property_access,
test_property_access, test_property_access,
test_property_access];
break;
case "super_4":
// Megamorphic super property lookup, property is a constant, found in the
// lookup start object. The holder is always a different object.
objects = [];
tested_functions = [];
for (let i = 0; i < 5; ++i) {
const c = createClasses(A);
objects.push(new c());
tested_functions.push(c.prototype.test_super_b);
}
break;
case "normal_4":
// Megamorphic normal property lookup, property is a constant, found in the
// lookup start object. The holder is always a different object.
objects = [{"prop0": 10, "prop1": 10, "prop2": 10, "prop3": 10, "prop4": 10,
"prop5": 10, "prop6": 10, "prop7": 10, "prop8": 10,
"prop9": 10},
{"a": 0, "prop0": 10, "prop1": 10, "prop2": 10, "prop3": 10,
"prop4": 10, "prop5": 10, "prop6": 10, "prop7": 10, "prop8": 10,
"prop9": 10},
{"a": 0, "b": 0, "prop0": 10, "prop1": 10, "prop2": 10,
"prop3": 10, "prop4": 10, "prop5": 10, "prop6": 10, "prop7": 10,
"prop8": 10, "prop9": 10},
{"a": 0, "b": 0, "c": 0, "prop0": 10, "prop1": 10, "prop2": 10,
"prop3": 10, "prop4": 10, "prop5": 10, "prop6": 10, "prop7": 10,
"prop8": 10, "prop9": 10},
{"a": 0, "b": 0, "c": 0, "d": 0, "prop0": 10, "prop1": 10,
"prop2": 10, "prop3": 10, "prop4": 10, "prop5": 10, "prop6": 10,
"prop7": 10, "prop8": 10, "prop9": 10}];
tested_functions = [test_property_access, test_property_access,
test_property_access, test_property_access,
test_property_access];
break;
default:
throw new Error("Test configuration error");
}
for (f of tested_functions) {
if (optimize) {
%PrepareFunctionForOptimization(f);
} else {
%NeverOptimizeFunction(f);
}
}
function runBenchmark() {
const expected_value = 10 * 10;
let ix = 0;
for (let i = 0; i < LOCAL_ITERATIONS; ++i) {
const object = objects[ix];
const r = tested_functions[ix].call(object, object);
if (r != expected_value) {
throw new Error("Test error");
}
if (++ix == objects.length) {
ix = 0;
if (optimize) {
for (f of tested_functions) {
%OptimizeFunctionOnNextCall(f);
}
}
}
}
}
var success = true;
function PrintResult(name, result) {
print(name + '(Score): ' + result);
}
function PrintError(name, error) {
PrintResult(name, error);
success = false;
}
BenchmarkSuite.config.doWarmup = false;
BenchmarkSuite.config.doDeterministic = true;
BenchmarkSuite.RunSuites({NotifyResult: PrintResult, NotifyError: PrintError});

View File

@ -1,43 +0,0 @@
// 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;
}
}

View File

@ -1,40 +0,0 @@
// 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 { };
A.prototype.super_prop = 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;
}
}

View File

@ -1,35 +0,0 @@
// 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)
]);
class A {
get super_prop() {
return 10;
}
};
class B extends A {
test() {
return super.super_prop;
}
};
const objects = [new B(), new B(), new B(), new B()];
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;
}
}

View File

@ -1,57 +0,0 @@
// 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)
]);
class A {
get super_prop() {
return 10;
}
};
class B extends A {
test() {
return super.super_prop;
}
};
class C0 extends B { };
class C1 extends B { };
class C2 extends B { };
class C3 extends B { };
class C4 extends B { };
class C5 extends B { };
class C6 extends B { };
class C7 extends B { };
class C8 extends B { };
class C9 extends B { };
const objects = [
new C0(),
new C1(),
new C2(),
new C3(),
new C4(),
new C5(),
new C6(),
new C7(),
new C8(),
new C9(),
];
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;
}
}

View File

@ -1,55 +0,0 @@
// 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)
]);
class A { };
A.prototype.super_prop = 10;
class B extends A {
test() {
return super.super_prop;
}
};
class C0 extends B { };
class C1 extends B { };
class C2 extends B { };
class C3 extends B { };
class C4 extends B { };
class C5 extends B { };
class C6 extends B { };
class C7 extends B { };
class C8 extends B { };
class C9 extends B { };
const objects = [
new C0(),
new C1(),
new C2(),
new C3(),
new C4(),
new C5(),
new C6(),
new C7(),
new C8(),
new C9(),
];
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;
}
}

View File

@ -1,32 +0,0 @@
// 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)
]);
class A { };
A.prototype.super_prop = 10;
class B extends A {
test() {
return super.super_prop;
}
};
const objects = [new B(), new B(), new B(), new B()];
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;
}
}

View File

@ -1,44 +0,0 @@
// 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 b1 = createSubclass();
const b2 = createSubclass();
const objects = [
new b1(),
new b2()
];
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;
}
}

View File

@ -1,63 +0,0 @@
// 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 b1 = createSubclass();
const b2 = createSubclass();
class C0 extends b1 { };
class C1 extends b2 { };
class C2 extends b1 { };
class C3 extends b2 { };
class C4 extends b1 { };
class C5 extends b2 { };
class C6 extends b1 { };
class C7 extends b2 { };
class C8 extends b1 { };
class C9 extends b2 { };
const objects = [
new C0(),
new C1(),
new C2(),
new C3(),
new C4(),
new C5(),
new C6(),
new C7(),
new C8(),
new C9(),
];
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;
}
}

View File

@ -1,59 +0,0 @@
// 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 { };
A.prototype.super_prop = 10;
class B extends A {
test() {
return super.super_prop;
}
};
return B;
}
const b1 = createSubclass();
const b2 = createSubclass();
class C0 extends b1 { };
class C1 extends b2 { };
class C2 extends b1 { };
class C3 extends b2 { };
class C4 extends b1 { };
class C5 extends b2 { };
class C6 extends b1 { };
class C7 extends b2 { };
class C8 extends b1 { };
class C9 extends b2 { };
const objects = [
new C0(),
new C1(),
new C2(),
new C3(),
new C4(),
new C5(),
new C6(),
new C7(),
new C8(),
new C9(),
];
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;
}
}

View File

@ -1,41 +0,0 @@
// 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 { };
A.prototype.super_prop = 10;
class B extends A {
test() {
return super.super_prop;
}
};
return B;
}
const b1 = createSubclass();
const b2 = createSubclass();
const objects = [
new b1(),
new b2()
];
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;
}
}

View File

@ -1,24 +0,0 @@
// 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.
load('../base.js');
BENCHMARK_NAME = arguments[1];
load(arguments[0] + '.js');
var success = true;
function PrintResult(name, result) {
print(name + '(Score): ' + result);
}
function PrintError(name, error) {
PrintResult(name, error);
success = false;
}
BenchmarkSuite.config.doWarmup = false;
BenchmarkSuite.config.doDeterministic = true;
BenchmarkSuite.RunSuites({NotifyResult: PrintResult, NotifyError: PrintError});