Bug 851067 - Box non-matching argument types. r=h4writer

This commit is contained in:
Nicolas B. Pierron 2013-03-19 14:41:49 -07:00
parent 28aeb1f5c4
commit f5a3040883
2 changed files with 16 additions and 0 deletions

View File

@ -3060,6 +3060,16 @@ IonBuilder::addTypeBarrier(uint32_t i, CallInfo &callinfo, types::StackTypeSet *
if (needsBarrier) {
MTypeBarrier *barrier = MTypeBarrier::New(ins, cloneTypeSet(calleeObs), Bailout_Normal);
current->add(barrier);
// Non-matching types are boxed such as the MIRType does not conflict
// with the inferred type.
if (callerObs->getKnownTypeTag() != calleeObs->getKnownTypeTag() &&
ins->type() != MIRType_Value)
{
MBox *box = MBox::New(ins);
current->add(box);
ins = box;
}
}
if (i == 0)

View File

@ -0,0 +1,6 @@
function toPrinted(value) {
value = String(value);
}
String = Array;
toPrinted(123);
evaluate('toPrinted("foo");');