Index: src/ia32/code-stubs-ia32.cc |
=================================================================== |
--- src/ia32/code-stubs-ia32.cc (revision 9957) |
+++ src/ia32/code-stubs-ia32.cc (working copy) |
@@ -6502,6 +6502,55 @@ |
} |
+void ICCompareStub::GenerateKnownObjects(MacroAssembler* masm, Map* map) { |
+ Label miss; |
+ __ mov(ecx, edx); |
+ __ and_(ecx, eax); |
+ __ JumpIfSmi(ecx, &miss, Label::kNear); |
+ |
+ __ mov(ecx, FieldOperand(eax, HeapObject::kMapOffset)); |
+ __ mov(ebx, FieldOperand(edx, HeapObject::kMapOffset)); |
+ __ cmp(ecx, Handle<Map>(map)); |
+ __ j(not_equal, &miss, Label::kNear); |
+ __ cmp(ebx, Handle<Map>(map)); |
+ __ j(not_equal, &miss, Label::kNear); |
+ |
+ __ sub(eax, edx); |
+ __ ret(0); |
+ |
+ __ bind(&miss); |
Kevin Millikin (Chromium)
2011/11/10 19:08:42
All the code from here and below looks like it cou
Rico
2011/11/11 08:49:11
Done.
|
+ |
+ // Save the registers. |
+ __ pop(ecx); |
Kevin Millikin (Chromium)
2011/11/10 19:08:42
And come to think of it, I don't know why we prese
Kevin Millikin (Chromium)
2011/11/10 19:11:18
Actually, that code has a bug. You need lea befor
|
+ __ push(edx); |
+ __ push(eax); |
+ __ push(ecx); |
+ |
+ // Call the runtime system in a fresh internal frame. |
+ ExternalReference runtime = ExternalReference(IC_Utility(IC::kCompareIC_Miss), |
+ masm->isolate()); |
+ { |
+ FrameScope scope(masm, StackFrame::INTERNAL); |
+ __ push(edx); |
+ __ push(eax); |
+ __ push(Immediate(Smi::FromInt(Token::EQ))); |
+ __ CallExternalReference(runtime, 3); |
+ } |
+ |
+ // Compute the entry point of the rewritten stub. |
+ __ lea(edi, FieldOperand(eax, Code::kHeaderSize)); |
+ |
+ // Restore registers. |
+ __ pop(ecx); |
+ __ pop(eax); |
+ __ pop(edx); |
+ __ push(ecx); |
+ |
+ // Do a tail call to the rewritten stub. |
+ __ jmp(edi); |
+} |
+ |
+ |
void ICCompareStub::GenerateMiss(MacroAssembler* masm) { |
// Save the registers. |
__ pop(ecx); |