Auto merge of #12980 - jdm:proxychanges, r=nox

Fix ridiculous DOM proxy getter performance

This implements the missing shadowing checks that were causing us to take many slow paths when dealing with proxy objects. Verified by running `tests/html/binding_perf.html` before and after and observing a 12x improvement.

---
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #12357
- [X] These changes do not require tests because we can't test performance yet.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12980)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-08-25 06:31:46 -05:00 committed by GitHub
commit 7834475482
6 changed files with 51 additions and 16 deletions

View file

@ -1,6 +1,7 @@
<button onclick="void_method()">measure void method</button>
<button onclick="int_getter()">measure int getter</button>
<button onclick="firstChild_getter()">measure firstChild getter</button>
<button onclick="proxy_firstChild_getter()">measure proxy firstChild getter</button>
<script>
var t = 'TestBinding' in window ? (new TestBinding()) : (new TextEncoder());
function void_method() {
@ -33,4 +34,15 @@ function firstChild_getter() {
var stop = new Date();
console.log('firstChild getter: ' + ((stop - start) / count * 1e6) + 'ns');
}
function proxy_firstChild_getter() {
var n = document;
var start = new Date();
var count = 1000000;
for (var i = 0; i < count; i++) {
var a = n.firstChild;
}
var stop = new Date();
console.log('proxy firstChild getter: ' + ((stop - start) / count * 1e6) + 'ns');
}
</script>