Index: src/arm/code-stubs-arm.cc |
diff --git a/src/arm/code-stubs-arm.cc b/src/arm/code-stubs-arm.cc |
index 10340b0db013c8ac7e99cdb6a856b2d3e825f8c5..0c4675eb46503ddf1a4e3f703f3fd52cca42a983 100644 |
--- a/src/arm/code-stubs-arm.cc |
+++ b/src/arm/code-stubs-arm.cc |
@@ -5961,6 +5961,44 @@ void ICCompareStub::GenerateHeapNumbers(MacroAssembler* masm) { |
} |
+void ICCompareStub::GenerateSymbols(MacroAssembler* masm) { |
+ ASSERT(state_ == CompareIC::SYMBOLS); |
+ Label miss; |
+ |
+ // Registers containing left and right operands respectively. |
+ Register left = r1; |
+ Register right = r0; |
+ Register tmp1 = r2; |
+ Register tmp2 = r3; |
+ |
+ // Check that both operands are heap objects. |
+ __ JumpIfEitherSmi(left, right, &miss); |
+ |
+ // Check that both operands are symbols. |
+ __ ldr(tmp1, FieldMemOperand(left, HeapObject::kMapOffset)); |
+ __ ldr(tmp2, FieldMemOperand(right, HeapObject::kMapOffset)); |
+ __ ldrb(tmp1, FieldMemOperand(tmp1, Map::kInstanceTypeOffset)); |
+ __ ldrb(tmp2, FieldMemOperand(tmp2, Map::kInstanceTypeOffset)); |
+ STATIC_ASSERT(kSymbolTag != 0); |
+ __ and_(tmp1, tmp1, Operand(tmp2)); |
+ __ tst(tmp1, Operand(kIsSymbolMask)); |
+ __ b(eq, &miss); |
+ |
+ // Symbols are compared by identity. |
+ __ cmp(left, right); |
+ // Make sure r0 is non-zero. At this point input operands are |
+ // guaranteed to be non-zero. |
+ ASSERT(right.is(r0)); |
+ STATIC_ASSERT(EQUAL == 0); |
+ STATIC_ASSERT(kSmiTag == 0); |
+ __ mov(r0, Operand(Smi::FromInt(EQUAL)), LeaveCC, eq); |
+ __ Ret(); |
+ |
+ __ bind(&miss); |
+ GenerateMiss(masm); |
+} |
+ |
+ |
void ICCompareStub::GenerateStrings(MacroAssembler* masm) { |
ASSERT(state_ == CompareIC::STRINGS); |
Label miss; |