Bug 1187511 - IonMonkey: Make use of callsite type information when refining |this| parameter. r=jandem

This commit is contained in:
Spenser Andrew Bauman 2015-07-28 10:33:00 -04:00
parent df37acf297
commit eb06b5c771

View File

@ -10116,6 +10116,27 @@ IonBuilder::maybeUnboxForPropertyAccess(MDefinition* def)
MUnbox* unbox = MUnbox::New(alloc(), def, type, MUnbox::Fallible);
current->add(unbox);
// Fixup type information for a common case where a property call
// is converted to the following bytecodes
//
// a.foo()
// ================= Compiles to ================
// LOAD "a"
// DUP
// CALLPROP "foo"
// SWAP
// CALL 0
//
// If we have better type information to unbox the first copy going into
// the CALLPROP operation, we can replace the duplicated copy on the
// stack as well.
if (*pc == JSOP_CALLPROP || *pc == JSOP_CALLELEM) {
uint32_t idx = current->stackDepth() - 1;
MOZ_ASSERT(current->getSlot(idx) == def);
current->setSlot(idx, unbox);
}
return unbox;
}