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 5878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5889 STATIC_ASSERT(kSmiTag == 0); | 5889 STATIC_ASSERT(kSmiTag == 0); |
5890 __ Move(rax, Smi::FromInt(EQUAL)); | 5890 __ Move(rax, Smi::FromInt(EQUAL)); |
5891 __ bind(&done); | 5891 __ bind(&done); |
5892 __ ret(0); | 5892 __ ret(0); |
5893 | 5893 |
5894 __ bind(&miss); | 5894 __ bind(&miss); |
5895 GenerateMiss(masm); | 5895 GenerateMiss(masm); |
5896 } | 5896 } |
5897 | 5897 |
5898 | 5898 |
| 5899 void ICCompareStub::GenerateUniqueNames(MacroAssembler* masm) { |
| 5900 ASSERT(state_ == CompareIC::UNIQUE_NAME); |
| 5901 ASSERT(GetCondition() == equal); |
| 5902 |
| 5903 // Registers containing left and right operands respectively. |
| 5904 Register left = rdx; |
| 5905 Register right = rax; |
| 5906 Register tmp1 = rcx; |
| 5907 Register tmp2 = rbx; |
| 5908 |
| 5909 // Check that both operands are heap objects. |
| 5910 Label miss; |
| 5911 Condition cond = masm->CheckEitherSmi(left, right, tmp1); |
| 5912 __ j(cond, &miss, Label::kNear); |
| 5913 |
| 5914 // Check that both operands are unique names. This leaves the instance |
| 5915 // types loaded in tmp1 and tmp2. |
| 5916 STATIC_ASSERT(kInternalizedTag != 0); |
| 5917 __ movq(tmp1, FieldOperand(left, HeapObject::kMapOffset)); |
| 5918 __ movq(tmp2, FieldOperand(right, HeapObject::kMapOffset)); |
| 5919 __ movzxbq(tmp1, FieldOperand(tmp1, Map::kInstanceTypeOffset)); |
| 5920 __ movzxbq(tmp2, FieldOperand(tmp2, Map::kInstanceTypeOffset)); |
| 5921 |
| 5922 Label succeed1; |
| 5923 __ testb(tmp1, Immediate(kIsInternalizedMask)); |
| 5924 __ j(not_zero, &succeed1, Label::kNear); |
| 5925 __ cmpb(tmp1, Immediate(static_cast<int8_t>(SYMBOL_TYPE))); |
| 5926 __ j(not_equal, &miss, Label::kNear); |
| 5927 __ bind(&succeed1); |
| 5928 |
| 5929 Label succeed2; |
| 5930 __ testb(tmp2, Immediate(kIsInternalizedMask)); |
| 5931 __ j(not_zero, &succeed2, Label::kNear); |
| 5932 __ cmpb(tmp2, Immediate(static_cast<int8_t>(SYMBOL_TYPE))); |
| 5933 __ j(not_equal, &miss, Label::kNear); |
| 5934 __ bind(&succeed2); |
| 5935 |
| 5936 // Unique names are compared by identity. |
| 5937 Label done; |
| 5938 __ cmpq(left, right); |
| 5939 // Make sure rax is non-zero. At this point input operands are |
| 5940 // guaranteed to be non-zero. |
| 5941 ASSERT(right.is(rax)); |
| 5942 __ j(not_equal, &done, Label::kNear); |
| 5943 STATIC_ASSERT(EQUAL == 0); |
| 5944 STATIC_ASSERT(kSmiTag == 0); |
| 5945 __ Move(rax, Smi::FromInt(EQUAL)); |
| 5946 __ bind(&done); |
| 5947 __ ret(0); |
| 5948 |
| 5949 __ bind(&miss); |
| 5950 GenerateMiss(masm); |
| 5951 } |
| 5952 |
| 5953 |
5899 void ICCompareStub::GenerateStrings(MacroAssembler* masm) { | 5954 void ICCompareStub::GenerateStrings(MacroAssembler* masm) { |
5900 ASSERT(state_ == CompareIC::STRING); | 5955 ASSERT(state_ == CompareIC::STRING); |
5901 Label miss; | 5956 Label miss; |
5902 | 5957 |
5903 bool equality = Token::IsEqualityOp(op_); | 5958 bool equality = Token::IsEqualityOp(op_); |
5904 | 5959 |
5905 // Registers containing left and right operands respectively. | 5960 // Registers containing left and right operands respectively. |
5906 Register left = rdx; | 5961 Register left = rdx; |
5907 Register right = rax; | 5962 Register right = rax; |
5908 Register tmp1 = rcx; | 5963 Register tmp1 = rcx; |
(...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6714 #endif | 6769 #endif |
6715 | 6770 |
6716 __ Ret(); | 6771 __ Ret(); |
6717 } | 6772 } |
6718 | 6773 |
6719 #undef __ | 6774 #undef __ |
6720 | 6775 |
6721 } } // namespace v8::internal | 6776 } } // namespace v8::internal |
6722 | 6777 |
6723 #endif // V8_TARGET_ARCH_X64 | 6778 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |