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

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 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) {
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, known_map_);
6514 __ j(not_equal, &miss, Label::kNear);
6515 __ cmp(ebx, known_map_);
6516 __ j(not_equal, &miss, Label::kNear);
6517
6518 __ sub(eax, edx);
6519 __ ret(0);
6520
6521 __ bind(&miss);
6522 GenerateMiss(masm);
6523 }
6524
6525
6505 void ICCompareStub::GenerateMiss(MacroAssembler* masm) { 6526 void ICCompareStub::GenerateMiss(MacroAssembler* masm) {
6506 // Save the registers.
6507 __ pop(ecx);
6508 __ push(edx);
6509 __ push(eax);
6510 __ push(ecx);
6511
6512 { 6527 {
6513 // Call the runtime system in a fresh internal frame. 6528 // Call the runtime system in a fresh internal frame.
6514 ExternalReference miss = ExternalReference(IC_Utility(IC::kCompareIC_Miss), 6529 ExternalReference miss = ExternalReference(IC_Utility(IC::kCompareIC_Miss),
6515 masm->isolate()); 6530 masm->isolate());
6516 FrameScope scope(masm, StackFrame::INTERNAL); 6531 FrameScope scope(masm, StackFrame::INTERNAL);
6517 __ push(edx); 6532 __ push(edx); // Preserve edx and eax.
6533 __ push(eax);
6534 __ push(edx); // And also use them as the arguments.
6518 __ push(eax); 6535 __ push(eax);
6519 __ push(Immediate(Smi::FromInt(op_))); 6536 __ push(Immediate(Smi::FromInt(op_)));
6520 __ CallExternalReference(miss, 3); 6537 __ CallExternalReference(miss, 3);
6538 // Compute the entry point of the rewritten stub.
6539 __ lea(edi, FieldOperand(eax, Code::kHeaderSize));
6540 __ pop(eax);
6541 __ pop(edx);
6521 } 6542 }
6522 6543
6523 // Compute the entry point of the rewritten stub.
6524 __ lea(edi, FieldOperand(eax, Code::kHeaderSize));
6525
6526 // Restore registers.
6527 __ pop(ecx);
6528 __ pop(eax);
6529 __ pop(edx);
6530 __ push(ecx);
6531
6532 // Do a tail call to the rewritten stub. 6544 // Do a tail call to the rewritten stub.
6533 __ jmp(edi); 6545 __ jmp(edi);
6534 } 6546 }
6535 6547
6536 6548
6537 // Helper function used to check that the dictionary doesn't contain 6549 // Helper function used to check that the dictionary doesn't contain
6538 // the property. This function may return false negatives, so miss_label 6550 // the property. This function may return false negatives, so miss_label
6539 // must always call a backup property check that is complete. 6551 // must always call a backup property check that is complete.
6540 // This function is safe to call if the receiver has fast properties. 6552 // This function is safe to call if the receiver has fast properties.
6541 // Name must be a symbol and receiver must be a heap object. 6553 // Name must be a symbol and receiver must be a heap object.
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after
7111 __ bind(&element_done); 7123 __ bind(&element_done);
7112 __ ret(0); 7124 __ ret(0);
7113 } 7125 }
7114 } 7126 }
7115 7127
7116 #undef __ 7128 #undef __
7117 7129
7118 } } // namespace v8::internal 7130 } } // namespace v8::internal
7119 7131
7120 #endif // V8_TARGET_ARCH_IA32 7132 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« src/heap.h ('K') | « src/hydrogen.cc ('k') | src/ia32/ic-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698