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 6643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6654 | 6654 |
6655 __ bind(&miss); | 6655 __ bind(&miss); |
6656 GenerateMiss(masm); | 6656 GenerateMiss(masm); |
6657 } | 6657 } |
6658 | 6658 |
6659 | 6659 |
6660 void ICCompareStub::GenerateStrings(MacroAssembler* masm) { | 6660 void ICCompareStub::GenerateStrings(MacroAssembler* masm) { |
6661 ASSERT(state_ == CompareIC::STRINGS); | 6661 ASSERT(state_ == CompareIC::STRINGS); |
6662 Label miss; | 6662 Label miss; |
6663 | 6663 |
| 6664 bool equality = Token::IsEqualityOp(op_); |
| 6665 |
6664 // Registers containing left and right operands respectively. | 6666 // Registers containing left and right operands respectively. |
6665 Register left = r1; | 6667 Register left = r1; |
6666 Register right = r0; | 6668 Register right = r0; |
6667 Register tmp1 = r2; | 6669 Register tmp1 = r2; |
6668 Register tmp2 = r3; | 6670 Register tmp2 = r3; |
6669 Register tmp3 = r4; | 6671 Register tmp3 = r4; |
6670 Register tmp4 = r5; | 6672 Register tmp4 = r5; |
6671 | 6673 |
6672 // Check that both operands are heap objects. | 6674 // Check that both operands are heap objects. |
6673 __ JumpIfEitherSmi(left, right, &miss); | 6675 __ JumpIfEitherSmi(left, right, &miss); |
(...skipping 13 matching lines...) Expand all Loading... |
6687 __ cmp(left, right); | 6689 __ cmp(left, right); |
6688 STATIC_ASSERT(EQUAL == 0); | 6690 STATIC_ASSERT(EQUAL == 0); |
6689 STATIC_ASSERT(kSmiTag == 0); | 6691 STATIC_ASSERT(kSmiTag == 0); |
6690 __ mov(r0, Operand(Smi::FromInt(EQUAL)), LeaveCC, eq); | 6692 __ mov(r0, Operand(Smi::FromInt(EQUAL)), LeaveCC, eq); |
6691 __ Ret(eq); | 6693 __ Ret(eq); |
6692 | 6694 |
6693 // Handle not identical strings. | 6695 // Handle not identical strings. |
6694 | 6696 |
6695 // Check that both strings are symbols. If they are, we're done | 6697 // Check that both strings are symbols. If they are, we're done |
6696 // because we already know they are not identical. | 6698 // because we already know they are not identical. |
6697 ASSERT(GetCondition() == eq); | 6699 if (equality) { |
6698 STATIC_ASSERT(kSymbolTag != 0); | 6700 ASSERT(GetCondition() == eq); |
6699 __ and_(tmp3, tmp1, Operand(tmp2)); | 6701 STATIC_ASSERT(kSymbolTag != 0); |
6700 __ tst(tmp3, Operand(kIsSymbolMask)); | 6702 __ and_(tmp3, tmp1, Operand(tmp2)); |
6701 // Make sure r0 is non-zero. At this point input operands are | 6703 __ tst(tmp3, Operand(kIsSymbolMask)); |
6702 // guaranteed to be non-zero. | 6704 // Make sure r0 is non-zero. At this point input operands are |
6703 ASSERT(right.is(r0)); | 6705 // guaranteed to be non-zero. |
6704 __ Ret(ne); | 6706 ASSERT(right.is(r0)); |
| 6707 __ Ret(ne); |
| 6708 } |
6705 | 6709 |
6706 // Check that both strings are sequential ASCII. | 6710 // Check that both strings are sequential ASCII. |
6707 Label runtime; | 6711 Label runtime; |
6708 __ JumpIfBothInstanceTypesAreNotSequentialAscii(tmp1, tmp2, tmp3, tmp4, | 6712 __ JumpIfBothInstanceTypesAreNotSequentialAscii( |
6709 &runtime); | 6713 tmp1, tmp2, tmp3, tmp4, &runtime); |
6710 | 6714 |
6711 // Compare flat ASCII strings. Returns when done. | 6715 // Compare flat ASCII strings. Returns when done. |
6712 StringCompareStub::GenerateFlatAsciiStringEquals( | 6716 if (equality) { |
6713 masm, left, right, tmp1, tmp2, tmp3); | 6717 StringCompareStub::GenerateFlatAsciiStringEquals( |
| 6718 masm, left, right, tmp1, tmp2, tmp3); |
| 6719 } else { |
| 6720 StringCompareStub::GenerateCompareFlatAsciiStrings( |
| 6721 masm, left, right, tmp1, tmp2, tmp3, tmp4); |
| 6722 } |
6714 | 6723 |
6715 // Handle more complex cases in runtime. | 6724 // Handle more complex cases in runtime. |
6716 __ bind(&runtime); | 6725 __ bind(&runtime); |
6717 __ Push(left, right); | 6726 __ Push(left, right); |
6718 __ TailCallRuntime(Runtime::kStringEquals, 2, 1); | 6727 if (equality) { |
| 6728 __ TailCallRuntime(Runtime::kStringEquals, 2, 1); |
| 6729 } else { |
| 6730 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); |
| 6731 } |
6719 | 6732 |
6720 __ bind(&miss); | 6733 __ bind(&miss); |
6721 GenerateMiss(masm); | 6734 GenerateMiss(masm); |
6722 } | 6735 } |
6723 | 6736 |
6724 | 6737 |
6725 void ICCompareStub::GenerateObjects(MacroAssembler* masm) { | 6738 void ICCompareStub::GenerateObjects(MacroAssembler* masm) { |
6726 ASSERT(state_ == CompareIC::OBJECTS); | 6739 ASSERT(state_ == CompareIC::OBJECTS); |
6727 Label miss; | 6740 Label miss; |
6728 __ and_(r2, r1, Operand(r0)); | 6741 __ and_(r2, r1, Operand(r0)); |
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7394 __ StoreNumberToDoubleElements(r0, r3, r1, r5, r6, r7, r9, r2, | 7407 __ StoreNumberToDoubleElements(r0, r3, r1, r5, r6, r7, r9, r2, |
7395 &slow_elements); | 7408 &slow_elements); |
7396 __ Ret(); | 7409 __ Ret(); |
7397 } | 7410 } |
7398 | 7411 |
7399 #undef __ | 7412 #undef __ |
7400 | 7413 |
7401 } } // namespace v8::internal | 7414 } } // namespace v8::internal |
7402 | 7415 |
7403 #endif // V8_TARGET_ARCH_ARM | 7416 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |