[class] add microbenchmarks for private methods

Bug: v8:10793
Change-Id: If9e4884ae1817121d9661eedc1e8806ab7f68214
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3256998
Commit-Queue: Joyee Cheung <joyee@igalia.com>
Reviewed-by: Shu-yu Guo <syg@chromium.org>
Cr-Commit-Position: refs/heads/main@{#77748}
This commit is contained in:
Joyee Cheung 2021-11-06 12:49:50 +08:00 committed by V8 LUCI CQ
parent 34b09dbefe
commit 1ec4c33457
5 changed files with 59 additions and 0 deletions

View File

@ -23,6 +23,8 @@
{"name": "EvaluateMultiPublicFieldClassOpt"},
{"name": "EvaluateSinglePrivateFieldClassOpt"},
{"name": "EvaluateMultiPrivateFieldClassOpt"},
{"name": "EvaluateSinglePrivateMethodClassOpt"},
{"name": "EvaluateMultiPrivateMethodClassOpt"},
{"name": "EvaluateSingleComputedFieldClassOpt"},
{"name": "EvaluateMultiComputedFieldClassOpt"}
]
@ -39,6 +41,8 @@
{"name": "EvaluateMultiPublicFieldClassNoOpt"},
{"name": "EvaluateSinglePrivateFieldClassNoOpt"},
{"name": "EvaluateMultiPrivateFieldClassNoOpt"},
{"name": "EvaluateSinglePrivateMethodClassNoOpt"},
{"name": "EvaluateMultiPrivateMethodClassNoOpt"},
{"name": "EvaluateSingleComputedFieldClassNoOpt"},
{"name": "EvaluateMultiComputedFieldClassNoOpt"}
]
@ -55,6 +59,8 @@
{"name": "InitializeMultiPublicFieldClassOpt"},
{"name": "InitializeSinglePrivateFieldClassOpt"},
{"name": "InitializeMultiPrivateFieldClassOpt"},
{"name": "InitializeSinglePrivateMethodClassOpt"},
{"name": "InitializeMultiPrivateMethodClassOpt"},
{"name": "InitializeSingleComputedFieldClassOpt"},
{"name": "InitializeMultiComputedFieldClassOpt"}
]
@ -71,6 +77,8 @@
{"name": "InitializeMultiPublicFieldClassNoOpt"},
{"name": "InitializeSinglePrivateFieldClassNoOpt"},
{"name": "InitializeMultiPrivateFieldClassNoOpt"},
{"name": "InitializeSinglePrivateMethodClassNoOpt"},
{"name": "InitializeMultiPrivateMethodClassNoOpt"},
{"name": "InitializeSingleComputedFieldClassNoOpt"},
{"name": "InitializeMultiComputedFieldClassNoOpt"}
]

View File

@ -58,6 +58,33 @@ function EvaluateMultiPrivateFieldClass() {
};
}
function EvaluateSinglePrivateMethodClass() {
return class PrivateSingleMethodClass {
#x() { return 0; }
check() {
return this.#x() === 0;
}
};
}
function EvaluateMultiPrivateMethodClass() {
return class PrivateMultiMethodClass {
#x() { return 0; }
#y() { return 1; }
#z() { return 2; }
#q() { return 3; }
#r() { return 4; }
#a() { return 5; }
check() {
return this.#x() + 1 === this.#y() && this.#y() + 1 === this.#z() &&
this.#z() + 1 === this.#q() && this.#q() + 1 === this.#r() &&
this.#r() + 1 === this.#a();
}
};
}
function key(i) {
return 'abcdefghijklmnopqrstuvwxyz'[i];
}

View File

@ -22,6 +22,12 @@ function CreateBenchmark(name, optimize) {
case "EvaluateMultiPrivateFieldClass":
factory = EvaluateMultiPrivateFieldClass;
break;
case "EvaluateSinglePrivateMethodClass":
factory = EvaluateSinglePrivateMethodClass;
break;
case "EvaluateMultiPrivateMethodClass":
factory = EvaluateMultiPrivateMethodClass;
break;
case "EvaluateSingleComputedFieldClass":
factory = EvaluateSingleComputedFieldClass;
break;
@ -95,5 +101,7 @@ CreateBenchmark("EvaluateSinglePublicFieldClass", optimize);
CreateBenchmark("EvaluateMultiPublicFieldClass", optimize);
CreateBenchmark("EvaluateSinglePrivateFieldClass", optimize);
CreateBenchmark("EvaluateMultiPrivateFieldClass", optimize);
CreateBenchmark("EvaluateSinglePrivateMethodClass", optimize);
CreateBenchmark("EvaluateMultiPrivateMethodClass", optimize);
CreateBenchmark("EvaluateSingleComputedFieldClass", optimize);
CreateBenchmark("EvaluateMultiComputedFieldClass", optimize);

View File

@ -22,6 +22,12 @@ function CreateBenchmark(name, optimize) {
case "InitializeMultiPrivateFieldClass":
klass = EvaluateMultiPrivateFieldClass();
break;
case "InitializeSinglePrivateMethodClass":
klass = EvaluateSinglePrivateMethodClass();
break;
case "InitializeMultiPrivateMethodClass":
klass = EvaluateMultiPrivateMethodClass();
break;
case "InitializeSingleComputedFieldClass":
klass = EvaluateSingleComputedFieldClass();
break;
@ -94,5 +100,7 @@ CreateBenchmark("InitializeSinglePublicFieldClass", optimize);
CreateBenchmark("InitializeMultiPublicFieldClass", optimize);
CreateBenchmark("InitializeSinglePrivateFieldClass", optimize);
CreateBenchmark("InitializeMultiPrivateFieldClass", optimize);
CreateBenchmark("InitializeSinglePrivateMethodClass", optimize);
CreateBenchmark("InitializeMultiPrivateMethodClass", optimize);
CreateBenchmark("InitializeSingleComputedFieldClass", optimize);
CreateBenchmark("InitializeMultiComputedFieldClass", optimize);

View File

@ -26,6 +26,8 @@
{"name": "EvaluateMultiPublicFieldClassOpt"},
{"name": "EvaluateSinglePrivateFieldClassOpt"},
{"name": "EvaluateMultiPrivateFieldClassOpt"},
{"name": "EvaluateSinglePrivateMethodClassOpt"},
{"name": "EvaluateMultiPrivateMethodClassOpt"},
{"name": "EvaluateSingleComputedFieldClassOpt"},
{"name": "EvaluateMultiComputedFieldClassOpt"}
]
@ -40,6 +42,8 @@
{"name": "EvaluateMultiPublicFieldClassNoOpt"},
{"name": "EvaluateSinglePrivateFieldClassNoOpt"},
{"name": "EvaluateMultiPrivateFieldClassNoOpt"},
{"name": "EvaluateSinglePrivateMethodClassNoOpt"},
{"name": "EvaluateMultiPrivateMethodClassNoOpt"},
{"name": "EvaluateSingleComputedFieldClassNoOpt"},
{"name": "EvaluateMultiComputedFieldClassNoOpt"}
]
@ -54,6 +58,8 @@
{"name": "InitializeMultiPublicFieldClassOpt"},
{"name": "InitializeSinglePrivateFieldClassOpt"},
{"name": "InitializeMultiPrivateFieldClassOpt"},
{"name": "InitializeSinglePrivateMethodClassOpt"},
{"name": "InitializeMultiPrivateMethodClassOpt"},
{"name": "InitializeSingleComputedFieldClassOpt"},
{"name": "InitializeMultiComputedFieldClassOpt"}
]
@ -68,6 +74,8 @@
{"name": "InitializeMultiPublicFieldClassNoOpt"},
{"name": "InitializeSinglePrivateFieldClassNoOpt"},
{"name": "InitializeMultiPrivateFieldClassNoOpt"},
{"name": "InitializeSinglePrivateMethodClassNoOpt"},
{"name": "InitializeMultiPrivateMethodClassNoOpt"},
{"name": "InitializeSingleComputedFieldClassNoOpt"},
{"name": "InitializeMultiComputedFieldClassNoOpt"}
]