Add micro-benchmark for Proxy get property
Bug: v8:6559, v8:6557 Change-Id: Ide0114a5cdcce3cf948a070465460662c56bad8d Reviewed-on: https://chromium-review.googlesource.com/577527 Reviewed-by: Benedikt Meurer <bmeurer@chromium.org> Reviewed-by: Franziska Hinkelmann <franzih@chromium.org> Commit-Queue: Maya Lekova <mslekova@google.com> Cr-Commit-Position: refs/heads/master@{#46757}
This commit is contained in:
parent
ae9a2d38f3
commit
2f991819f9
@ -22,7 +22,9 @@
|
||||
{"name": "CallProxyWithoutTrap"},
|
||||
{"name": "CallProxyWithTrap"},
|
||||
{"name": "ConstructProxyWithoutTrap"},
|
||||
{"name": "ConstructProxyWithTrap"}
|
||||
{"name": "ConstructProxyWithTrap"},
|
||||
{"name": "GetPropertyOfProxyWithoutTrap"},
|
||||
{"name": "GetPropertyOfProxyWithTrap"}
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -42,7 +42,7 @@ newBenchmark("ProxyConstructorWithClass", {
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
var obj = {};
|
||||
let obj = {};
|
||||
|
||||
newBenchmark("ProxyConstructorWithObject", {
|
||||
setup() { },
|
||||
@ -151,3 +151,44 @@ newBenchmark("ConstructProxyWithTrap", {
|
||||
return instance instanceof MyClass;
|
||||
}
|
||||
});
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
obj = {
|
||||
prop: SOME_NUMBER
|
||||
}
|
||||
let value;
|
||||
|
||||
newBenchmark("GetPropertyOfProxyWithoutTrap", {
|
||||
setup() {
|
||||
p = new Proxy(obj, {});
|
||||
},
|
||||
run() {
|
||||
for(var i = 0; i < ITERATIONS; i++) {
|
||||
value = p.prop;
|
||||
}
|
||||
},
|
||||
teardown() {
|
||||
return value === SOME_NUMBER;
|
||||
}
|
||||
});
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
newBenchmark("GetPropertyOfProxyWithTrap", {
|
||||
setup() {
|
||||
p = new Proxy(obj, {
|
||||
get: function(target, propertyKey, receiver) {
|
||||
return SOME_OTHER_NUMBER;
|
||||
}
|
||||
});
|
||||
},
|
||||
run() {
|
||||
for(var i = 0; i < ITERATIONS; i++) {
|
||||
value = p.prop;
|
||||
}
|
||||
},
|
||||
teardown() {
|
||||
return value === SOME_OTHER_NUMBER;
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user