OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 6874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6885 STATIC_ASSERT(kSmiTag == 0); | 6885 STATIC_ASSERT(kSmiTag == 0); |
6886 __ Set(eax, Immediate(Smi::FromInt(EQUAL))); | 6886 __ Set(eax, Immediate(Smi::FromInt(EQUAL))); |
6887 __ bind(&done); | 6887 __ bind(&done); |
6888 __ ret(0); | 6888 __ ret(0); |
6889 | 6889 |
6890 __ bind(&miss); | 6890 __ bind(&miss); |
6891 GenerateMiss(masm); | 6891 GenerateMiss(masm); |
6892 } | 6892 } |
6893 | 6893 |
6894 | 6894 |
| 6895 void ICCompareStub::GenerateUniqueNames(MacroAssembler* masm) { |
| 6896 ASSERT(state_ == CompareIC::UNIQUE_NAME); |
| 6897 ASSERT(GetCondition() == equal); |
| 6898 |
| 6899 // Registers containing left and right operands respectively. |
| 6900 Register left = edx; |
| 6901 Register right = eax; |
| 6902 Register tmp1 = ecx; |
| 6903 Register tmp2 = ebx; |
| 6904 |
| 6905 // Check that both operands are heap objects. |
| 6906 Label miss; |
| 6907 __ mov(tmp1, left); |
| 6908 STATIC_ASSERT(kSmiTag == 0); |
| 6909 __ and_(tmp1, right); |
| 6910 __ JumpIfSmi(tmp1, &miss, Label::kNear); |
| 6911 |
| 6912 // Check that both operands are unique names. This leaves the instance |
| 6913 // types loaded in tmp1 and tmp2. |
| 6914 STATIC_ASSERT(kInternalizedTag != 0); |
| 6915 __ mov(tmp1, FieldOperand(left, HeapObject::kMapOffset)); |
| 6916 __ mov(tmp2, FieldOperand(right, HeapObject::kMapOffset)); |
| 6917 __ movzx_b(tmp1, FieldOperand(tmp1, Map::kInstanceTypeOffset)); |
| 6918 __ movzx_b(tmp2, FieldOperand(tmp2, Map::kInstanceTypeOffset)); |
| 6919 |
| 6920 Label succeed1; |
| 6921 __ test(tmp1, Immediate(kIsInternalizedMask)); |
| 6922 __ j(not_zero, &succeed1); |
| 6923 __ cmpb(tmp1, static_cast<int8_t>(SYMBOL_TYPE)); |
| 6924 __ j(not_equal, &miss); |
| 6925 __ bind(&succeed1); |
| 6926 |
| 6927 Label succeed2; |
| 6928 __ test(tmp2, Immediate(kIsInternalizedMask)); |
| 6929 __ j(not_zero, &succeed2); |
| 6930 __ cmpb(tmp2, static_cast<int8_t>(SYMBOL_TYPE)); |
| 6931 __ j(not_equal, &miss); |
| 6932 __ bind(&succeed2); |
| 6933 |
| 6934 // Unique names are compared by identity. |
| 6935 Label done; |
| 6936 __ cmp(left, right); |
| 6937 // Make sure eax is non-zero. At this point input operands are |
| 6938 // guaranteed to be non-zero. |
| 6939 ASSERT(right.is(eax)); |
| 6940 __ j(not_equal, &done, Label::kNear); |
| 6941 STATIC_ASSERT(EQUAL == 0); |
| 6942 STATIC_ASSERT(kSmiTag == 0); |
| 6943 __ Set(eax, Immediate(Smi::FromInt(EQUAL))); |
| 6944 __ bind(&done); |
| 6945 __ ret(0); |
| 6946 |
| 6947 __ bind(&miss); |
| 6948 GenerateMiss(masm); |
| 6949 } |
| 6950 |
| 6951 |
6895 void ICCompareStub::GenerateStrings(MacroAssembler* masm) { | 6952 void ICCompareStub::GenerateStrings(MacroAssembler* masm) { |
6896 ASSERT(state_ == CompareIC::STRING); | 6953 ASSERT(state_ == CompareIC::STRING); |
6897 Label miss; | 6954 Label miss; |
6898 | 6955 |
6899 bool equality = Token::IsEqualityOp(op_); | 6956 bool equality = Token::IsEqualityOp(op_); |
6900 | 6957 |
6901 // Registers containing left and right operands respectively. | 6958 // Registers containing left and right operands respectively. |
6902 Register left = edx; | 6959 Register left = edx; |
6903 Register right = eax; | 6960 Register right = eax; |
6904 Register tmp1 = ecx; | 6961 Register tmp1 = ecx; |
(...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7687 // Restore ecx. | 7744 // Restore ecx. |
7688 __ pop(ecx); | 7745 __ pop(ecx); |
7689 __ ret(0); | 7746 __ ret(0); |
7690 } | 7747 } |
7691 | 7748 |
7692 #undef __ | 7749 #undef __ |
7693 | 7750 |
7694 } } // namespace v8::internal | 7751 } } // namespace v8::internal |
7695 | 7752 |
7696 #endif // V8_TARGET_ARCH_IA32 | 7753 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |