OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 6691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6702 __ cmp(scratch2, | 6702 __ cmp(scratch2, |
6703 Operand(1 << Map::kStringWrapperSafeForDefaultValueOf)); | 6703 Operand(1 << Map::kStringWrapperSafeForDefaultValueOf)); |
6704 __ b(ne, slow); | 6704 __ b(ne, slow); |
6705 __ ldr(arg, FieldMemOperand(arg, JSValue::kValueOffset)); | 6705 __ ldr(arg, FieldMemOperand(arg, JSValue::kValueOffset)); |
6706 __ str(arg, MemOperand(sp, stack_offset)); | 6706 __ str(arg, MemOperand(sp, stack_offset)); |
6707 | 6707 |
6708 __ bind(&done); | 6708 __ bind(&done); |
6709 } | 6709 } |
6710 | 6710 |
6711 | 6711 |
6712 void StringCharAtStub::Generate(MacroAssembler* masm) { | |
6713 // Expects two arguments (object, index) on the stack: | |
6714 // lr: return address | |
6715 // sp[0]: index | |
6716 // sp[4]: object | |
6717 Register object = r1; | |
6718 Register index = r0; | |
6719 Register scratch1 = r2; | |
6720 Register scratch2 = r3; | |
6721 Register result = r0; | |
6722 | |
6723 // Get object and index from the stack. | |
6724 __ pop(index); | |
6725 __ pop(object); | |
6726 | |
6727 Label need_conversion; | |
6728 Label index_out_of_range; | |
6729 Label done; | |
6730 StringCharAtGenerator generator(object, | |
6731 index, | |
6732 scratch1, | |
6733 scratch2, | |
6734 result, | |
6735 &need_conversion, | |
6736 &need_conversion, | |
6737 &index_out_of_range, | |
6738 STRING_INDEX_IS_NUMBER); | |
6739 generator.GenerateFast(masm); | |
6740 __ b(&done); | |
6741 | |
6742 __ bind(&index_out_of_range); | |
6743 // When the index is out of range, the spec requires us to return | |
6744 // the empty string. | |
6745 __ LoadRoot(result, Heap::kEmptyStringRootIndex); | |
6746 __ jmp(&done); | |
6747 | |
6748 __ bind(&need_conversion); | |
6749 // Move smi zero into the result register, which will trigger | |
6750 // conversion. | |
6751 __ mov(result, Operand(Smi::FromInt(0))); | |
6752 __ b(&done); | |
6753 | |
6754 StubRuntimeCallHelper call_helper; | |
6755 generator.GenerateSlow(masm, call_helper); | |
6756 | |
6757 __ bind(&done); | |
6758 __ Ret(); | |
6759 } | |
6760 | |
6761 | |
6762 void ICCompareStub::GenerateSmis(MacroAssembler* masm) { | 6712 void ICCompareStub::GenerateSmis(MacroAssembler* masm) { |
6763 ASSERT(state_ == CompareIC::SMIS); | 6713 ASSERT(state_ == CompareIC::SMIS); |
6764 Label miss; | 6714 Label miss; |
6765 __ orr(r2, r1, r0); | 6715 __ orr(r2, r1, r0); |
6766 __ tst(r2, Operand(kSmiTagMask)); | 6716 __ tst(r2, Operand(kSmiTagMask)); |
6767 __ b(ne, &miss); | 6717 __ b(ne, &miss); |
6768 | 6718 |
6769 if (GetCondition() == eq) { | 6719 if (GetCondition() == eq) { |
6770 // For equality we do not care about the sign of the result. | 6720 // For equality we do not care about the sign of the result. |
6771 __ sub(r0, r0, r1, SetCC); | 6721 __ sub(r0, r0, r1, SetCC); |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6898 __ str(pc, MemOperand(sp, 0)); | 6848 __ str(pc, MemOperand(sp, 0)); |
6899 __ Jump(target); // Call the C++ function. | 6849 __ Jump(target); // Call the C++ function. |
6900 } | 6850 } |
6901 | 6851 |
6902 | 6852 |
6903 #undef __ | 6853 #undef __ |
6904 | 6854 |
6905 } } // namespace v8::internal | 6855 } } // namespace v8::internal |
6906 | 6856 |
6907 #endif // V8_TARGET_ARCH_ARM | 6857 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |