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

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

Issue 6960011: Compare IC: add SYMBOLS state. (Closed)
Patch Set: Created 9 years, 7 months 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
« no previous file with comments | « src/code-stubs.cc ('k') | src/ic.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 5836 matching lines...) Expand 10 before | Expand all | Expand 10 after
5847 5847
5848 CompareStub stub(GetCondition(), strict(), NO_COMPARE_FLAGS); 5848 CompareStub stub(GetCondition(), strict(), NO_COMPARE_FLAGS);
5849 __ bind(&generic_stub); 5849 __ bind(&generic_stub);
5850 __ jmp(stub.GetCode(), RelocInfo::CODE_TARGET); 5850 __ jmp(stub.GetCode(), RelocInfo::CODE_TARGET);
5851 5851
5852 __ bind(&miss); 5852 __ bind(&miss);
5853 GenerateMiss(masm); 5853 GenerateMiss(masm);
5854 } 5854 }
5855 5855
5856 5856
5857 void ICCompareStub::GenerateSymbols(MacroAssembler* masm) {
5858 ASSERT(state_ == CompareIC::SYMBOLS);
5859 ASSERT(GetCondition() == equal);
5860
5861 // Registers containing left and right operands respectively.
5862 Register left = edx;
5863 Register right = eax;
5864 Register tmp1 = ecx;
5865 Register tmp2 = ebx;
5866
5867 // Check that both operands are heap objects.
5868 NearLabel miss;
5869 __ mov(tmp1, Operand(left));
5870 STATIC_ASSERT(kSmiTag == 0);
5871 __ and_(tmp1, Operand(right));
5872 __ test(tmp1, Immediate(kSmiTagMask));
5873 __ j(zero, &miss);
5874
5875 // Check that both operands are symbols.
5876 __ mov(tmp1, FieldOperand(left, HeapObject::kMapOffset));
5877 __ mov(tmp2, FieldOperand(right, HeapObject::kMapOffset));
5878 __ movzx_b(tmp1, FieldOperand(tmp1, Map::kInstanceTypeOffset));
5879 __ movzx_b(tmp2, FieldOperand(tmp2, Map::kInstanceTypeOffset));
5880 STATIC_ASSERT(kSymbolTag != 0);
5881 __ and_(tmp1, Operand(tmp2));
5882 __ test(tmp1, Immediate(kIsSymbolMask));
5883 __ j(zero, &miss);
5884
5885 // Symbols are compared by identity.
5886 NearLabel done;
5887 __ cmp(left, Operand(right));
5888 // Make sure eax is non-zero. At this point input operands are
5889 // guaranteed to be non-zero.
5890 ASSERT(right.is(eax));
5891 __ j(not_equal, &done);
5892 STATIC_ASSERT(EQUAL == 0);
5893 STATIC_ASSERT(kSmiTag == 0);
5894 __ Set(eax, Immediate(Smi::FromInt(EQUAL)));
5895 __ bind(&done);
5896 __ ret(0);
5897
5898 __ bind(&miss);
5899 GenerateMiss(masm);
5900 }
5901
5902
5857 void ICCompareStub::GenerateStrings(MacroAssembler* masm) { 5903 void ICCompareStub::GenerateStrings(MacroAssembler* masm) {
5858 ASSERT(state_ == CompareIC::STRINGS); 5904 ASSERT(state_ == CompareIC::STRINGS);
5859 ASSERT(GetCondition() == equal); 5905 ASSERT(GetCondition() == equal);
5860 Label miss; 5906 Label miss;
5861 5907
5862 // Registers containing left and right operands respectively. 5908 // Registers containing left and right operands respectively.
5863 Register left = edx; 5909 Register left = edx;
5864 Register right = eax; 5910 Register right = eax;
5865 Register tmp1 = ecx; 5911 Register tmp1 = ecx;
5866 Register tmp2 = ebx; 5912 Register tmp2 = ebx;
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
6191 __ Drop(1); 6237 __ Drop(1);
6192 __ ret(2 * kPointerSize); 6238 __ ret(2 * kPointerSize);
6193 } 6239 }
6194 6240
6195 6241
6196 #undef __ 6242 #undef __
6197 6243
6198 } } // namespace v8::internal 6244 } } // namespace v8::internal
6199 6245
6200 #endif // V8_TARGET_ARCH_IA32 6246 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/code-stubs.cc ('k') | src/ic.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698