Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(188)

Side by Side Diff: src/ia32/code-stubs-ia32.cc

Issue 8520006: Optimize the equality check case of ICCompare stubs. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 6484 matching lines...) Expand 10 before | Expand all | Expand 10 after
6495 6495
6496 ASSERT(GetCondition() == equal); 6496 ASSERT(GetCondition() == equal);
6497 __ sub(eax, edx); 6497 __ sub(eax, edx);
6498 __ ret(0); 6498 __ ret(0);
6499 6499
6500 __ bind(&miss); 6500 __ bind(&miss);
6501 GenerateMiss(masm); 6501 GenerateMiss(masm);
6502 } 6502 }
6503 6503
6504 6504
6505 void ICCompareStub::GenerateKnownObjects(MacroAssembler* masm, Map* map) {
6506 Label miss;
6507 __ mov(ecx, edx);
6508 __ and_(ecx, eax);
6509 __ JumpIfSmi(ecx, &miss, Label::kNear);
6510
6511 __ mov(ecx, FieldOperand(eax, HeapObject::kMapOffset));
6512 __ mov(ebx, FieldOperand(edx, HeapObject::kMapOffset));
6513 __ cmp(ecx, Handle<Map>(map));
6514 __ j(not_equal, &miss, Label::kNear);
6515 __ cmp(ebx, Handle<Map>(map));
6516 __ j(not_equal, &miss, Label::kNear);
6517
6518 __ sub(eax, edx);
6519 __ ret(0);
6520
6521 __ 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.
6522
6523 // Save the registers.
6524 __ 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
6525 __ push(edx);
6526 __ push(eax);
6527 __ push(ecx);
6528
6529 // Call the runtime system in a fresh internal frame.
6530 ExternalReference runtime = ExternalReference(IC_Utility(IC::kCompareIC_Miss),
6531 masm->isolate());
6532 {
6533 FrameScope scope(masm, StackFrame::INTERNAL);
6534 __ push(edx);
6535 __ push(eax);
6536 __ push(Immediate(Smi::FromInt(Token::EQ)));
6537 __ CallExternalReference(runtime, 3);
6538 }
6539
6540 // Compute the entry point of the rewritten stub.
6541 __ lea(edi, FieldOperand(eax, Code::kHeaderSize));
6542
6543 // Restore registers.
6544 __ pop(ecx);
6545 __ pop(eax);
6546 __ pop(edx);
6547 __ push(ecx);
6548
6549 // Do a tail call to the rewritten stub.
6550 __ jmp(edi);
6551 }
6552
6553
6505 void ICCompareStub::GenerateMiss(MacroAssembler* masm) { 6554 void ICCompareStub::GenerateMiss(MacroAssembler* masm) {
6506 // Save the registers. 6555 // Save the registers.
6507 __ pop(ecx); 6556 __ pop(ecx);
6508 __ push(edx); 6557 __ push(edx);
6509 __ push(eax); 6558 __ push(eax);
6510 __ push(ecx); 6559 __ push(ecx);
6511 6560
6512 { 6561 {
6513 // Call the runtime system in a fresh internal frame. 6562 // Call the runtime system in a fresh internal frame.
6514 ExternalReference miss = ExternalReference(IC_Utility(IC::kCompareIC_Miss), 6563 ExternalReference miss = ExternalReference(IC_Utility(IC::kCompareIC_Miss),
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
7111 __ bind(&element_done); 7160 __ bind(&element_done);
7112 __ ret(0); 7161 __ ret(0);
7113 } 7162 }
7114 } 7163 }
7115 7164
7116 #undef __ 7165 #undef __
7117 7166
7118 } } // namespace v8::internal 7167 } } // namespace v8::internal
7119 7168
7120 #endif // V8_TARGET_ARCH_IA32 7169 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698