Only emit alias check in for *PROP if the object's shape matches the global object's shape (475048, r=brendan, relanding).

This commit is contained in:
Andreas Gal 2009-01-23 10:41:44 -08:00
parent 56155f4e54
commit 991e37f6f1
2 changed files with 21 additions and 5 deletions

View File

@ -7001,12 +7001,15 @@ JS_REQUIRES_STACK bool
TraceRecorder::prop(JSObject* obj, LIns* obj_ins, uint32& slot, LIns*& v_ins)
{
/*
* Can't specialize to assert obj != global, must guard to avoid aliasing
* stale homes of stacked global variables.
* If the shape of the object matches the global object's shape, we
* have to guard against aliasing to avoid aliasing stale homes of stacked
* global variables.
*/
if (obj == globalObj)
ABORT_TRACE("prop op aliases global");
guard(false, lir->ins2(LIR_eq, obj_ins, globalObj_ins), MISMATCH_EXIT);
if (OBJ_SHAPE(obj) == OBJ_SHAPE(globalObj)) {
if (obj == globalObj)
ABORT_TRACE("prop op aliases global");
guard(false, lir->ins2(LIR_eq, obj_ins, globalObj_ins), MISMATCH_EXIT);
}
/*
* Property cache ensures that we are dealing with an existing property,

View File

@ -4034,6 +4034,19 @@ function testBug474769() {
testBug474769.expected = 1;
test(testBug474769);
undeclaredGlobal = -1;
function testGlobalAliasCheck() {
var q;
for (var i = 0; i < 10; ++i) {
undeclaredGlobal = i;
q = this.undeclaredGlobal;
}
return q;
}
testGlobalAliasCheck.expected = 9;
test(testGlobalAliasCheck);
delete undeclaredGlobal;
/*****************************************************************************
* *
* _____ _ _ _____ ______ _____ _______ *