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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 blx(target, cond); | 93 blx(target, cond); |
94 ASSERT_EQ(CallSize(target, cond), SizeOfCodeGeneratedSince(&start)); | 94 ASSERT_EQ(CallSize(target, cond), SizeOfCodeGeneratedSince(&start)); |
95 } | 95 } |
96 | 96 |
97 | 97 |
98 int MacroAssembler::CallSize( | 98 int MacroAssembler::CallSize( |
99 Address target, RelocInfo::Mode rmode, Condition cond) { | 99 Address target, RelocInfo::Mode rmode, Condition cond) { |
100 int size = 2 * kInstrSize; | 100 int size = 2 * kInstrSize; |
101 Instr mov_instr = cond | MOV | LeaveCC; | 101 Instr mov_instr = cond | MOV | LeaveCC; |
102 intptr_t immediate = reinterpret_cast<intptr_t>(target); | 102 intptr_t immediate = reinterpret_cast<intptr_t>(target); |
103 if (!Operand(immediate, rmode).is_single_instruction(this, mov_instr)) { | 103 if (!Operand(immediate, rmode).is_single_instruction(isolate(), |
| 104 this, |
| 105 mov_instr)) { |
104 size += kInstrSize; | 106 size += kInstrSize; |
105 } | 107 } |
106 return size; | 108 return size; |
107 } | 109 } |
108 | 110 |
109 | 111 |
110 int MacroAssembler::CallStubSize( | 112 int MacroAssembler::CallStubSize( |
111 CodeStub* stub, TypeFeedbackId ast_id, Condition cond) { | 113 CodeStub* stub, TypeFeedbackId ast_id, Condition cond) { |
112 return CallSize(stub->GetCode(), RelocInfo::CODE_TARGET, ast_id, cond); | 114 return CallSize(stub->GetCode(), RelocInfo::CODE_TARGET, ast_id, cond); |
113 } | 115 } |
114 | 116 |
115 | 117 |
116 int MacroAssembler::CallSizeNotPredictableCodeSize( | 118 int MacroAssembler::CallSizeNotPredictableCodeSize(Isolate* isolate, |
117 Address target, RelocInfo::Mode rmode, Condition cond) { | 119 Address target, |
| 120 RelocInfo::Mode rmode, |
| 121 Condition cond) { |
118 int size = 2 * kInstrSize; | 122 int size = 2 * kInstrSize; |
119 Instr mov_instr = cond | MOV | LeaveCC; | 123 Instr mov_instr = cond | MOV | LeaveCC; |
120 intptr_t immediate = reinterpret_cast<intptr_t>(target); | 124 intptr_t immediate = reinterpret_cast<intptr_t>(target); |
121 if (!Operand(immediate, rmode).is_single_instruction(NULL, mov_instr)) { | 125 if (!Operand(immediate, rmode).is_single_instruction(isolate, |
| 126 NULL, |
| 127 mov_instr)) { |
122 size += kInstrSize; | 128 size += kInstrSize; |
123 } | 129 } |
124 return size; | 130 return size; |
125 } | 131 } |
126 | 132 |
127 | 133 |
128 void MacroAssembler::Call(Address target, | 134 void MacroAssembler::Call(Address target, |
129 RelocInfo::Mode rmode, | 135 RelocInfo::Mode rmode, |
130 Condition cond, | 136 Condition cond, |
131 TargetAddressStorageMode mode) { | 137 TargetAddressStorageMode mode) { |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 void MacroAssembler::Move(DwVfpRegister dst, DwVfpRegister src) { | 277 void MacroAssembler::Move(DwVfpRegister dst, DwVfpRegister src) { |
272 if (!dst.is(src)) { | 278 if (!dst.is(src)) { |
273 vmov(dst, src); | 279 vmov(dst, src); |
274 } | 280 } |
275 } | 281 } |
276 | 282 |
277 | 283 |
278 void MacroAssembler::And(Register dst, Register src1, const Operand& src2, | 284 void MacroAssembler::And(Register dst, Register src1, const Operand& src2, |
279 Condition cond) { | 285 Condition cond) { |
280 if (!src2.is_reg() && | 286 if (!src2.is_reg() && |
281 !src2.must_output_reloc_info(this) && | 287 !src2.must_output_reloc_info(isolate(), this) && |
282 src2.immediate() == 0) { | 288 src2.immediate() == 0) { |
283 mov(dst, Operand::Zero(), LeaveCC, cond); | 289 mov(dst, Operand::Zero(), LeaveCC, cond); |
284 } else if (!src2.is_single_instruction(this) && | 290 } else if (!src2.is_single_instruction(isolate(), this) && |
285 !src2.must_output_reloc_info(this) && | 291 !src2.must_output_reloc_info(isolate(), this) && |
286 CpuFeatures::IsSupported(ARMv7) && | 292 CpuFeatures::IsSupported(ARMv7) && |
287 IsPowerOf2(src2.immediate() + 1)) { | 293 IsPowerOf2(src2.immediate() + 1)) { |
288 ubfx(dst, src1, 0, | 294 ubfx(dst, src1, 0, |
289 WhichPowerOf2(static_cast<uint32_t>(src2.immediate()) + 1), cond); | 295 WhichPowerOf2(static_cast<uint32_t>(src2.immediate()) + 1), cond); |
290 } else { | 296 } else { |
291 and_(dst, src1, src2, LeaveCC, cond); | 297 and_(dst, src1, src2, LeaveCC, cond); |
292 } | 298 } |
293 } | 299 } |
294 | 300 |
295 | 301 |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
650 | 656 |
651 void MacroAssembler::PopSafepointRegisters() { | 657 void MacroAssembler::PopSafepointRegisters() { |
652 const int num_unsaved = kNumSafepointRegisters - kNumSafepointSavedRegisters; | 658 const int num_unsaved = kNumSafepointRegisters - kNumSafepointSavedRegisters; |
653 ldm(ia_w, sp, kSafepointSavedRegisters); | 659 ldm(ia_w, sp, kSafepointSavedRegisters); |
654 add(sp, sp, Operand(num_unsaved * kPointerSize)); | 660 add(sp, sp, Operand(num_unsaved * kPointerSize)); |
655 } | 661 } |
656 | 662 |
657 | 663 |
658 void MacroAssembler::PushSafepointRegistersAndDoubles() { | 664 void MacroAssembler::PushSafepointRegistersAndDoubles() { |
659 // Number of d-regs not known at snapshot time. | 665 // Number of d-regs not known at snapshot time. |
660 ASSERT(!Serializer::enabled()); | 666 ASSERT(!Serializer::enabled(isolate())); |
661 PushSafepointRegisters(); | 667 PushSafepointRegisters(); |
662 // Only save allocatable registers. | 668 // Only save allocatable registers. |
663 ASSERT(kScratchDoubleReg.is(d15) && kDoubleRegZero.is(d14)); | 669 ASSERT(kScratchDoubleReg.is(d15) && kDoubleRegZero.is(d14)); |
664 ASSERT(DwVfpRegister::NumReservedRegisters() == 2); | 670 ASSERT(DwVfpRegister::NumReservedRegisters() == 2); |
665 if (CpuFeatures::IsSupported(VFP32DREGS)) { | 671 if (CpuFeatures::IsSupported(VFP32DREGS)) { |
666 vstm(db_w, sp, d16, d31); | 672 vstm(db_w, sp, d16, d31); |
667 } | 673 } |
668 vstm(db_w, sp, d0, d13); | 674 vstm(db_w, sp, d0, d13); |
669 } | 675 } |
670 | 676 |
671 | 677 |
672 void MacroAssembler::PopSafepointRegistersAndDoubles() { | 678 void MacroAssembler::PopSafepointRegistersAndDoubles() { |
673 // Number of d-regs not known at snapshot time. | 679 // Number of d-regs not known at snapshot time. |
674 ASSERT(!Serializer::enabled()); | 680 ASSERT(!Serializer::enabled(isolate())); |
675 // Only save allocatable registers. | 681 // Only save allocatable registers. |
676 ASSERT(kScratchDoubleReg.is(d15) && kDoubleRegZero.is(d14)); | 682 ASSERT(kScratchDoubleReg.is(d15) && kDoubleRegZero.is(d14)); |
677 ASSERT(DwVfpRegister::NumReservedRegisters() == 2); | 683 ASSERT(DwVfpRegister::NumReservedRegisters() == 2); |
678 vldm(ia_w, sp, d0, d13); | 684 vldm(ia_w, sp, d0, d13); |
679 if (CpuFeatures::IsSupported(VFP32DREGS)) { | 685 if (CpuFeatures::IsSupported(VFP32DREGS)) { |
680 vldm(ia_w, sp, d16, d31); | 686 vldm(ia_w, sp, d16, d31); |
681 } | 687 } |
682 PopSafepointRegisters(); | 688 PopSafepointRegisters(); |
683 } | 689 } |
684 | 690 |
(...skipping 21 matching lines...) Expand all Loading... |
706 } | 712 } |
707 | 713 |
708 | 714 |
709 MemOperand MacroAssembler::SafepointRegisterSlot(Register reg) { | 715 MemOperand MacroAssembler::SafepointRegisterSlot(Register reg) { |
710 return MemOperand(sp, SafepointRegisterStackIndex(reg.code()) * kPointerSize); | 716 return MemOperand(sp, SafepointRegisterStackIndex(reg.code()) * kPointerSize); |
711 } | 717 } |
712 | 718 |
713 | 719 |
714 MemOperand MacroAssembler::SafepointRegistersAndDoublesSlot(Register reg) { | 720 MemOperand MacroAssembler::SafepointRegistersAndDoublesSlot(Register reg) { |
715 // Number of d-regs not known at snapshot time. | 721 // Number of d-regs not known at snapshot time. |
716 ASSERT(!Serializer::enabled()); | 722 ASSERT(!Serializer::enabled(isolate())); |
717 // General purpose registers are pushed last on the stack. | 723 // General purpose registers are pushed last on the stack. |
718 int doubles_size = DwVfpRegister::NumAllocatableRegisters() * kDoubleSize; | 724 int doubles_size = DwVfpRegister::NumAllocatableRegisters() * kDoubleSize; |
719 int register_offset = SafepointRegisterStackIndex(reg.code()) * kPointerSize; | 725 int register_offset = SafepointRegisterStackIndex(reg.code()) * kPointerSize; |
720 return MemOperand(sp, doubles_size + register_offset); | 726 return MemOperand(sp, doubles_size + register_offset); |
721 } | 727 } |
722 | 728 |
723 | 729 |
724 void MacroAssembler::Ldrd(Register dst1, Register dst2, | 730 void MacroAssembler::Ldrd(Register dst1, Register dst2, |
725 const MemOperand& src, Condition cond) { | 731 const MemOperand& src, Condition cond) { |
726 ASSERT(src.rm().is(no_reg)); | 732 ASSERT(src.rm().is(no_reg)); |
(...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1760 Condition cond = al; | 1766 Condition cond = al; |
1761 int shift = 0; | 1767 int shift = 0; |
1762 while (object_size != 0) { | 1768 while (object_size != 0) { |
1763 if (((object_size >> shift) & 0x03) == 0) { | 1769 if (((object_size >> shift) & 0x03) == 0) { |
1764 shift += 2; | 1770 shift += 2; |
1765 } else { | 1771 } else { |
1766 int bits = object_size & (0xff << shift); | 1772 int bits = object_size & (0xff << shift); |
1767 object_size -= bits; | 1773 object_size -= bits; |
1768 shift += 8; | 1774 shift += 8; |
1769 Operand bits_operand(bits); | 1775 Operand bits_operand(bits); |
1770 ASSERT(bits_operand.is_single_instruction(this)); | 1776 ASSERT(bits_operand.is_single_instruction(isolate(), this)); |
1771 add(scratch2, source, bits_operand, SetCC, cond); | 1777 add(scratch2, source, bits_operand, SetCC, cond); |
1772 source = scratch2; | 1778 source = scratch2; |
1773 cond = cc; | 1779 cond = cc; |
1774 } | 1780 } |
1775 } | 1781 } |
1776 b(cs, gc_required); | 1782 b(cs, gc_required); |
1777 cmp(scratch2, Operand(ip)); | 1783 cmp(scratch2, Operand(ip)); |
1778 b(hi, gc_required); | 1784 b(hi, gc_required); |
1779 str(scratch2, MemOperand(topaddr)); | 1785 str(scratch2, MemOperand(topaddr)); |
1780 | 1786 |
(...skipping 2304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4085 sub(result, result, Operand(dividend)); | 4091 sub(result, result, Operand(dividend)); |
4086 } | 4092 } |
4087 if (ms.shift() > 0) mov(result, Operand(result, ASR, ms.shift())); | 4093 if (ms.shift() > 0) mov(result, Operand(result, ASR, ms.shift())); |
4088 add(result, result, Operand(dividend, LSR, 31)); | 4094 add(result, result, Operand(dividend, LSR, 31)); |
4089 } | 4095 } |
4090 | 4096 |
4091 | 4097 |
4092 } } // namespace v8::internal | 4098 } } // namespace v8::internal |
4093 | 4099 |
4094 #endif // V8_TARGET_ARCH_ARM | 4100 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |