MIPS: Reland 10216 - Optimize the equality check case of ICCompare stubs.

Port r10219 (56686b).

Original commit message:

Now with arm and x64 support. Additionally, added default unreachable case to switch statement in CompareIC::TargetState to make win and mac compilers happy.

Reviewer guide:
This is an exact copy of 10216 except:
src/arm/*
src/x64/*
src/ic.cc (added default case to swith in CompareIC::TargetState)

BUG=
TEST=
Review URL: http://codereview.chromium.org/8896022

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@10232 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
ricow@chromium.org 2011-12-12 06:38:29 +00:00
parent 3e3827bd83
commit c64fe2ecae
2 changed files with 28 additions and 12 deletions

View File

@ -6869,26 +6869,39 @@ void ICCompareStub::GenerateObjects(MacroAssembler* masm) {
}
void ICCompareStub::GenerateMiss(MacroAssembler* masm) {
__ Push(a1, a0);
__ push(ra);
void ICCompareStub::GenerateKnownObjects(MacroAssembler* masm) {
Label miss;
__ And(a2, a1, a0);
__ JumpIfSmi(a2, &miss);
__ lw(a2, FieldMemOperand(a0, HeapObject::kMapOffset));
__ lw(a3, FieldMemOperand(a1, HeapObject::kMapOffset));
__ Branch(&miss, ne, a2, Operand(known_map_));
__ Branch(&miss, ne, a3, Operand(known_map_));
// Call the runtime system in a fresh internal frame.
ExternalReference miss = ExternalReference(IC_Utility(IC::kCompareIC_Miss),
masm->isolate());
__ Ret(USE_DELAY_SLOT);
__ subu(v0, a0, a1);
__ bind(&miss);
GenerateMiss(masm);
}
void ICCompareStub::GenerateMiss(MacroAssembler* masm) {
{
// Call the runtime system in a fresh internal frame.
ExternalReference miss =
ExternalReference(IC_Utility(IC::kCompareIC_Miss), masm->isolate());
FrameScope scope(masm, StackFrame::INTERNAL);
__ Push(a1, a0);
__ push(ra);
__ Push(a1, a0);
__ li(t0, Operand(Smi::FromInt(op_)));
__ push(t0);
__ CallExternalReference(miss, 3);
// Compute the entry point of the rewritten stub.
__ Addu(a2, v0, Operand(Code::kHeaderSize - kHeapObjectTag));
// Restore registers.
__ Pop(a1, a0, ra);
}
// Compute the entry point of the rewritten stub.
__ Addu(a2, v0, Operand(Code::kHeaderSize - kHeapObjectTag));
// Restore registers.
__ pop(ra);
__ pop(a0);
__ pop(a1);
__ Jump(a2);
}

View File

@ -1587,6 +1587,9 @@ void CompareIC::UpdateCaches(Handle<Object> x, Handle<Object> y) {
rewritten = stub.GetCode();
} else {
ICCompareStub stub(op_, state);
if (state == KNOWN_OBJECTS) {
stub.set_known_map(Handle<Map>(Handle<JSObject>::cast(x)->map()));
}
rewritten = stub.GetCode();
}
set_target(*rewritten);