Bug 774257 - Fix accessor inlining for watched objects. (r=dvander)

This commit is contained in:
Eric Faust 2012-07-17 17:26:37 -07:00
parent 5380036e57
commit 374edb776d
3 changed files with 26 additions and 0 deletions

View File

@ -4962,6 +4962,14 @@ IonBuilder::TestCommonPropFunc(JSContext *cx, types::TypeSet *types, HandleId id
while (curObj != foundProto) {
if (curObj->getType(cx)->unknownProperties())
return true;
// If anyone on the chain is watched, TI thinks they have an own
// property, which means if they were to actually overwrite the
// property accessors, we would never know, since we are freezing on
// setting that flag.
if (!isGetter && curObj->watched())
return true;
curObj = curObj->getProto();
}
}

View File

@ -0,0 +1,8 @@
Object.defineProperty(Object.prototype, 'x', {
set: function() { evalcx('lazy'); }
});
var obj = {};
obj.watch("x", function (id, oldval, newval) {});
for (var str in 'A') {
obj.x = 1;
}

View File

@ -0,0 +1,10 @@
Object.defineProperty(Object.prototype, 'x', {
set: function() { evalcx('lazy'); }
});
var obj = {};
var prot = {};
obj.__proto__ = prot;
obj.watch("x", function (id, oldval, newval) {});
for (var str in 'A') {
obj.x = 1;
}