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: Jakob Gruber <jgruber@chromium.org> Reviewed-by: Maya Lekova <mslekova@chromium.org> Cr-Commit-Position: refs/heads/master@{#62363}
This commit is contained in:
parent
5ff38bae08
commit
139f83110c
@ -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() {}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user