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

add micro-benchmark for Proxy with PreventExtensions trap

Bug: v8:6664
Change-Id: Iaef787b3b0c2a24de57b7c3a5c4e75e5a723228e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1652061
Commit-Queue: Z Nguyen-Huu <duongn@microsoft.com>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62101}
parent f8ec0ac5
...@@ -35,7 +35,9 @@ ...@@ -35,7 +35,9 @@
{"name": "SetSymbolWithTrap"}, {"name": "SetSymbolWithTrap"},
{"name": "HasInIdiom"}, {"name": "HasInIdiom"},
{"name": "IsExtensibleWithoutTrap"}, {"name": "IsExtensibleWithoutTrap"},
{"name": "IsExtensibleWithTrap"} {"name": "IsExtensibleWithTrap"},
{"name": "PreventExtensionsWithoutTrap"},
{"name": "PreventExtensionsWithTrap"}
] ]
}, },
{ {
......
...@@ -550,3 +550,44 @@ newBenchmark("IsExtensibleWithTrap", { ...@@ -550,3 +550,44 @@ newBenchmark("IsExtensibleWithTrap", {
return value === true; return value === true;
} }
}); });
// ----------------------------------------------------------------------------
obj = {};
value = false;
newBenchmark("PreventExtensionsWithoutTrap", {
setup() {
p = new Proxy(obj, {});
},
run() {
for(var i = 0; i < ITERATIONS; i++) {
value = Object.preventExtensions(p);
}
return value;
},
teardown() {}
});
// ----------------------------------------------------------------------------
obj = {};
value = false;
newBenchmark("PreventExtensionsWithTrap", {
setup() {
p = new Proxy(obj, {
preventExtensions: function(target) {
Object.preventExtensions(target);
return true;
}
});
},
run() {
for(var i = 0; i < ITERATIONS; i++) {
value = Object.preventExtensions(p);
}
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