Updates:
Status: Accepted
Owner: [email protected]
Comment #1 on issue 2071 by [email protected]: with statement is
broken since Chrome 19
http://code.google.com/p/v8/issues/detail?id=2071
Reduced and d8-compatible test case:
test = {};
test.Tag = "ok";
with(test) {
test.Div = (function out1() {
function out2() {
print(Tag);
};
return out2;
})();
}
for(var i = 0; i < 10000; i++) {
test.Div();
}
Somehow the fact that the function out2 depends on the with-statement to
resolve "Tag" gets lost (due to the nesting?) when we optimize it.
Definitely something we should fix, probably by disabling optimization for
out2.
That said, there's an easy workaround: "with" is evil, don't use "with".
Ever.
Another workaround is to remove the encapsulation of out2 in out1 when
assigning test.Div:
with(test) {
test.Div = function() {
print(Tag);
}
}
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev