Add micro-benchmark for Proxy has property
Bug: v8:6664, v8:6557 Change-Id: Ib0f9b258d49f96bee041cbcfc589f3ec91e013ed Reviewed-on: https://chromium-review.googlesource.com/597859 Reviewed-by: Benedikt Meurer <bmeurer@chromium.org> Commit-Queue: Maya Lekova <mslekova@google.com> Cr-Commit-Position: refs/heads/master@{#47110}
This commit is contained in:
parent
3bccb99557
commit
c772d8d983
@ -24,7 +24,9 @@
|
|||||||
{"name": "ConstructProxyWithoutTrap"},
|
{"name": "ConstructProxyWithoutTrap"},
|
||||||
{"name": "ConstructProxyWithTrap"},
|
{"name": "ConstructProxyWithTrap"},
|
||||||
{"name": "GetPropertyOfProxyWithoutTrap"},
|
{"name": "GetPropertyOfProxyWithoutTrap"},
|
||||||
{"name": "GetPropertyOfProxyWithTrap"}
|
{"name": "GetPropertyOfProxyWithTrap"},
|
||||||
|
{"name": "HasOnProxyWithoutTrap"},
|
||||||
|
{"name": "HasOnProxyWithTrap"}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -192,3 +192,40 @@ newBenchmark("GetPropertyOfProxyWithTrap", {
|
|||||||
return value === SOME_OTHER_NUMBER;
|
return value === SOME_OTHER_NUMBER;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
obj = {};
|
||||||
|
|
||||||
|
newBenchmark("HasOnProxyWithoutTrap", {
|
||||||
|
setup() {
|
||||||
|
p = new Proxy(obj, {});
|
||||||
|
},
|
||||||
|
run() {
|
||||||
|
for(var i = 0; i < ITERATIONS; i++) {
|
||||||
|
value = ('prop' in p);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
teardown() {
|
||||||
|
return value === true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
newBenchmark("HasOnProxyWithTrap", {
|
||||||
|
setup() {
|
||||||
|
p = new Proxy(obj, {
|
||||||
|
has: function(target, propertyKey) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
run() {
|
||||||
|
for(var i = 0; i < ITERATIONS; i++) {
|
||||||
|
value = ('prop' in p);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
teardown() {
|
||||||
|
return value === true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user