Bug 1171945: IonMonkey - Part 6: Use binarystub in jsop_binary_arith, r=jandem

This commit is contained in:
Hannes Verschore 2015-08-19 15:15:57 +02:00
parent bcce8e03e1
commit e8e1df926c
2 changed files with 34 additions and 0 deletions

View File

@ -4671,6 +4671,36 @@ IonBuilder::binaryArithTrySpecializedOnBaselineInspector(bool* emitted, JSOp op,
return true;
}
bool
IonBuilder::binaryArithTrySharedStub(bool* emitted, JSOp op,
MDefinition* left, MDefinition* right)
{
MOZ_ASSERT(*emitted == false);
// Try to emit a shared stub cache.
if (js_JitOptions.disableSharedStubs)
return true;
// It is not possible for shared stubs to impersonate another op.
if (JSOp(*pc) != op)
return true;
MBinarySharedStub *stub = MBinarySharedStub::New(alloc(), left, right);
current->add(stub);
current->push(stub);
// Decrease type from 'any type' to 'empty type' when one of the operands
// is 'empty typed'.
maybeMarkEmpty(stub);
if (!resumeAfter(stub))
return false;
*emitted = true;
return true;
}
bool
IonBuilder::jsop_binary_arith(JSOp op, MDefinition* left, MDefinition* right)
{
@ -4687,6 +4717,9 @@ IonBuilder::jsop_binary_arith(JSOp op, MDefinition* left, MDefinition* right)
return emitted;
}
if (!binaryArithTrySharedStub(&emitted, op, left, right) || emitted)
return emitted;
// Not possible to optimize. Do a slow vm call.
MDefinition::Opcode def_op = JSOpToMDefinition(op);
MBinaryArithInstruction* ins = MBinaryArithInstruction::New(alloc(), def_op, left, right);

View File

@ -489,6 +489,7 @@ class IonBuilder
bool binaryArithTrySpecialized(bool* emitted, JSOp op, MDefinition* left, MDefinition* right);
bool binaryArithTrySpecializedOnBaselineInspector(bool* emitted, JSOp op, MDefinition* left,
MDefinition* right);
bool binaryArithTrySharedStub(bool* emitted, JSOp op, MDefinition* left, MDefinition* right);
// binary data lookup helpers.
TypedObjectPrediction typedObjectPrediction(MDefinition* typedObj);