add micro-benchmark for proxy trap getPrototypeOf

Bug: v8:664
Change-Id: I180a59462bd22a1f2378a59fd31edbb539603a1f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1659569
Commit-Queue: Z Nguyen-Huu <duongn@microsoft.com>
Reviewed-by: Maya Lekova <mslekova@chromium.org>
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62227}
This commit is contained in:
Z Nguyen-Huu 2019-06-17 10:43:30 -07:00 committed by Commit Bot
parent b8474e7022
commit f021c622a9
2 changed files with 37 additions and 1 deletions

View File

@ -37,7 +37,9 @@
{"name": "IsExtensibleWithoutTrap"},
{"name": "IsExtensibleWithTrap"},
{"name": "PreventExtensionsWithoutTrap"},
{"name": "PreventExtensionsWithTrap"}
{"name": "PreventExtensionsWithTrap"},
{"name": "GetPrototypeOfWithoutTrap"},
{"name": "GetPrototypeOfWithTrap"}
]
},
{

View File

@ -591,3 +591,37 @@ newBenchmark("PreventExtensionsWithTrap", {
},
teardown() {}
});
// ----------------------------------------------------------------------------
newBenchmark("GetPrototypeOfWithoutTrap", {
setup() {
p = new Proxy({}, {});
},
run() {
for(var i = 0; i < ITERATIONS; i++) {
value = Object.getPrototypeOf(p);
}
return value;
},
teardown() {}
});
// ----------------------------------------------------------------------------
newBenchmark("GetPrototypeOfWithTrap", {
setup() {
p = new Proxy({}, {
getPrototypeOf: function(target) {
return Array.prototype;
}
});
},
run() {
for(var i = 0; i < ITERATIONS; i++) {
value = Object.getPrototypeOf(p);
}
return value;
},
teardown() {}
});