Commit 2f991819 authored by Maya Lekova's avatar Maya Lekova Committed by Commit Bot

Add micro-benchmark for Proxy get property

Bug: v8:6559, v8:6557
Change-Id: Ide0114a5cdcce3cf948a070465460662c56bad8d
Reviewed-on: https://chromium-review.googlesource.com/577527Reviewed-by: 's avatarBenedikt Meurer <bmeurer@chromium.org>
Reviewed-by: 's avatarFranziska Hinkelmann <franzih@chromium.org>
Commit-Queue: Maya Lekova <mslekova@google.com>
Cr-Commit-Position: refs/heads/master@{#46757}
parent ae9a2d38
...@@ -22,7 +22,9 @@ ...@@ -22,7 +22,9 @@
{"name": "CallProxyWithoutTrap"}, {"name": "CallProxyWithoutTrap"},
{"name": "CallProxyWithTrap"}, {"name": "CallProxyWithTrap"},
{"name": "ConstructProxyWithoutTrap"}, {"name": "ConstructProxyWithoutTrap"},
{"name": "ConstructProxyWithTrap"} {"name": "ConstructProxyWithTrap"},
{"name": "GetPropertyOfProxyWithoutTrap"},
{"name": "GetPropertyOfProxyWithTrap"}
] ]
}, },
{ {
......
...@@ -42,7 +42,7 @@ newBenchmark("ProxyConstructorWithClass", { ...@@ -42,7 +42,7 @@ newBenchmark("ProxyConstructorWithClass", {
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
var obj = {}; let obj = {};
newBenchmark("ProxyConstructorWithObject", { newBenchmark("ProxyConstructorWithObject", {
setup() { }, setup() { },
...@@ -151,3 +151,44 @@ newBenchmark("ConstructProxyWithTrap", { ...@@ -151,3 +151,44 @@ newBenchmark("ConstructProxyWithTrap", {
return instance instanceof MyClass; 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;
}
});
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