Index: src/x64/code-stubs-x64.cc |
diff --git a/src/x64/code-stubs-x64.cc b/src/x64/code-stubs-x64.cc |
index c1d26cb462c6f51990294b021bbfedde310dd08b..30ca6c694a92a8fe9b0917986a8ca4c1d440b760 100644 |
--- a/src/x64/code-stubs-x64.cc |
+++ b/src/x64/code-stubs-x64.cc |
@@ -5896,6 +5896,61 @@ void ICCompareStub::GenerateInternalizedStrings(MacroAssembler* masm) { |
} |
+void ICCompareStub::GenerateUniqueNames(MacroAssembler* masm) { |
+ ASSERT(state_ == CompareIC::UNIQUE_NAME); |
+ ASSERT(GetCondition() == equal); |
+ |
+ // Registers containing left and right operands respectively. |
+ Register left = rdx; |
+ Register right = rax; |
+ Register tmp1 = rcx; |
+ Register tmp2 = rbx; |
+ |
+ // Check that both operands are heap objects. |
+ Label miss; |
+ Condition cond = masm->CheckEitherSmi(left, right, tmp1); |
+ __ j(cond, &miss, Label::kNear); |
+ |
+ // Check that both operands are unique names. This leaves the instance |
+ // types loaded in tmp1 and tmp2. |
+ STATIC_ASSERT(kInternalizedTag != 0); |
+ __ movq(tmp1, FieldOperand(left, HeapObject::kMapOffset)); |
+ __ movq(tmp2, FieldOperand(right, HeapObject::kMapOffset)); |
+ __ movzxbq(tmp1, FieldOperand(tmp1, Map::kInstanceTypeOffset)); |
+ __ movzxbq(tmp2, FieldOperand(tmp2, Map::kInstanceTypeOffset)); |
+ |
+ Label succeed1; |
+ __ testb(tmp1, Immediate(kIsInternalizedMask)); |
+ __ j(not_zero, &succeed1, Label::kNear); |
+ __ cmpb(tmp1, Immediate(static_cast<int8_t>(SYMBOL_TYPE))); |
+ __ j(not_equal, &miss, Label::kNear); |
+ __ bind(&succeed1); |
+ |
+ Label succeed2; |
+ __ testb(tmp2, Immediate(kIsInternalizedMask)); |
+ __ j(not_zero, &succeed2, Label::kNear); |
+ __ cmpb(tmp2, Immediate(static_cast<int8_t>(SYMBOL_TYPE))); |
+ __ j(not_equal, &miss, Label::kNear); |
+ __ bind(&succeed2); |
+ |
+ // Unique names are compared by identity. |
+ Label done; |
+ __ cmpq(left, right); |
+ // Make sure rax is non-zero. At this point input operands are |
+ // guaranteed to be non-zero. |
+ ASSERT(right.is(rax)); |
+ __ j(not_equal, &done, Label::kNear); |
+ STATIC_ASSERT(EQUAL == 0); |
+ STATIC_ASSERT(kSmiTag == 0); |
+ __ Move(rax, Smi::FromInt(EQUAL)); |
+ __ bind(&done); |
+ __ ret(0); |
+ |
+ __ bind(&miss); |
+ GenerateMiss(masm); |
+} |
+ |
+ |
void ICCompareStub::GenerateStrings(MacroAssembler* masm) { |
ASSERT(state_ == CompareIC::STRING); |
Label miss; |