Commit 139f8311 authored by Z Nguyen-Huu's avatar Z Nguyen-Huu Committed by Commit Bot

add micro-benchmark for proxy trap setPrototypeOf

Bug: v8:6664
Change-Id: If5a8a85a7537fa429fb58d1e0654ffe5f6a5897f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1669788
Commit-Queue: Z Nguyen-Huu <duongn@microsoft.com>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Reviewed-by: 's avatarMaya Lekova <mslekova@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62363}
parent 5ff38bae
......@@ -39,7 +39,9 @@
{"name": "PreventExtensionsWithoutTrap"},
{"name": "PreventExtensionsWithTrap"},
{"name": "GetPrototypeOfWithoutTrap"},
{"name": "GetPrototypeOfWithTrap"}
{"name": "GetPrototypeOfWithTrap"},
{"name": "SetPrototypeOfWithoutTrap"},
{"name": "SetPrototypeOfWithTrap"}
]
},
{
......
......@@ -625,3 +625,42 @@ newBenchmark("GetPrototypeOfWithTrap", {
},
teardown() {}
});
// ----------------------------------------------------------------------------
newBenchmark("SetPrototypeOfWithoutTrap", {
setup() {
var obj = { x: 1 };
obj.__proto__ = {};
p = new Proxy(obj, {});
},
run() {
for(var i = 0; i < ITERATIONS; i++) {
value = Object.setPrototypeOf(p, [1]);
}
return value;
},
teardown() {}
});
// ----------------------------------------------------------------------------
newBenchmark("SetPrototypeOfWithTrap", {
setup() {
var obj = { x: 1 };
obj.__proto__ = {};
p = new Proxy(obj, {
setPrototypeOf: function(target, proto) {
Object.setPrototypeOf(target, proto);
return true;
}
});
},
run() {
for(var i = 0; i < ITERATIONS; i++) {
value = Object.setPrototypeOf(p, [1]);
}
return value;
},
teardown() {}
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment