OLD | NEW |
1 // Copyright 2011 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 |
11 // with the distribution. | 11 // with the distribution. |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 }; | 142 }; |
143 | 143 |
144 | 144 |
145 class BinaryOpStub: public CodeStub { | 145 class BinaryOpStub: public CodeStub { |
146 public: | 146 public: |
147 BinaryOpStub(Token::Value op, OverwriteMode mode) | 147 BinaryOpStub(Token::Value op, OverwriteMode mode) |
148 : op_(op), | 148 : op_(op), |
149 mode_(mode), | 149 mode_(mode), |
150 operands_type_(BinaryOpIC::UNINITIALIZED), | 150 operands_type_(BinaryOpIC::UNINITIALIZED), |
151 result_type_(BinaryOpIC::UNINITIALIZED) { | 151 result_type_(BinaryOpIC::UNINITIALIZED) { |
152 use_vfp3_ = CpuFeatures::IsSupported(VFP3); | 152 use_vfp2_ = CpuFeatures::IsSupported(VFP2); |
153 ASSERT(OpBits::is_valid(Token::NUM_TOKENS)); | 153 ASSERT(OpBits::is_valid(Token::NUM_TOKENS)); |
154 } | 154 } |
155 | 155 |
156 BinaryOpStub( | 156 BinaryOpStub( |
157 int key, | 157 int key, |
158 BinaryOpIC::TypeInfo operands_type, | 158 BinaryOpIC::TypeInfo operands_type, |
159 BinaryOpIC::TypeInfo result_type = BinaryOpIC::UNINITIALIZED) | 159 BinaryOpIC::TypeInfo result_type = BinaryOpIC::UNINITIALIZED) |
160 : op_(OpBits::decode(key)), | 160 : op_(OpBits::decode(key)), |
161 mode_(ModeBits::decode(key)), | 161 mode_(ModeBits::decode(key)), |
162 use_vfp3_(VFP3Bits::decode(key)), | 162 use_vfp2_(VFP2Bits::decode(key)), |
163 operands_type_(operands_type), | 163 operands_type_(operands_type), |
164 result_type_(result_type) { } | 164 result_type_(result_type) { } |
165 | 165 |
166 private: | 166 private: |
167 enum SmiCodeGenerateHeapNumberResults { | 167 enum SmiCodeGenerateHeapNumberResults { |
168 ALLOW_HEAPNUMBER_RESULTS, | 168 ALLOW_HEAPNUMBER_RESULTS, |
169 NO_HEAPNUMBER_RESULTS | 169 NO_HEAPNUMBER_RESULTS |
170 }; | 170 }; |
171 | 171 |
172 Token::Value op_; | 172 Token::Value op_; |
173 OverwriteMode mode_; | 173 OverwriteMode mode_; |
174 bool use_vfp3_; | 174 bool use_vfp2_; |
175 | 175 |
176 // Operand type information determined at runtime. | 176 // Operand type information determined at runtime. |
177 BinaryOpIC::TypeInfo operands_type_; | 177 BinaryOpIC::TypeInfo operands_type_; |
178 BinaryOpIC::TypeInfo result_type_; | 178 BinaryOpIC::TypeInfo result_type_; |
179 | 179 |
180 virtual void PrintName(StringStream* stream); | 180 virtual void PrintName(StringStream* stream); |
181 | 181 |
182 // Minor key encoding in 16 bits RRRTTTVOOOOOOOMM. | 182 // Minor key encoding in 16 bits RRRTTTVOOOOOOOMM. |
183 class ModeBits: public BitField<OverwriteMode, 0, 2> {}; | 183 class ModeBits: public BitField<OverwriteMode, 0, 2> {}; |
184 class OpBits: public BitField<Token::Value, 2, 7> {}; | 184 class OpBits: public BitField<Token::Value, 2, 7> {}; |
185 class VFP3Bits: public BitField<bool, 9, 1> {}; | 185 class VFP2Bits: public BitField<bool, 9, 1> {}; |
186 class OperandTypeInfoBits: public BitField<BinaryOpIC::TypeInfo, 10, 3> {}; | 186 class OperandTypeInfoBits: public BitField<BinaryOpIC::TypeInfo, 10, 3> {}; |
187 class ResultTypeInfoBits: public BitField<BinaryOpIC::TypeInfo, 13, 3> {}; | 187 class ResultTypeInfoBits: public BitField<BinaryOpIC::TypeInfo, 13, 3> {}; |
188 | 188 |
189 Major MajorKey() { return BinaryOp; } | 189 Major MajorKey() { return BinaryOp; } |
190 int MinorKey() { | 190 int MinorKey() { |
191 return OpBits::encode(op_) | 191 return OpBits::encode(op_) |
192 | ModeBits::encode(mode_) | 192 | ModeBits::encode(mode_) |
193 | VFP3Bits::encode(use_vfp3_) | 193 | VFP2Bits::encode(use_vfp2_) |
194 | OperandTypeInfoBits::encode(operands_type_) | 194 | OperandTypeInfoBits::encode(operands_type_) |
195 | ResultTypeInfoBits::encode(result_type_); | 195 | ResultTypeInfoBits::encode(result_type_); |
196 } | 196 } |
197 | 197 |
198 void Generate(MacroAssembler* masm); | 198 void Generate(MacroAssembler* masm); |
199 void GenerateGeneric(MacroAssembler* masm); | 199 void GenerateGeneric(MacroAssembler* masm); |
200 void GenerateSmiSmiOperation(MacroAssembler* masm); | 200 void GenerateSmiSmiOperation(MacroAssembler* masm); |
201 void GenerateFPOperation(MacroAssembler* masm, | 201 void GenerateFPOperation(MacroAssembler* masm, |
202 bool smi_operands, | 202 bool smi_operands, |
203 Label* not_numbers, | 203 Label* not_numbers, |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
564 void Restore(MacroAssembler* masm) { | 564 void Restore(MacroAssembler* masm) { |
565 masm->pop(scratch1_); | 565 masm->pop(scratch1_); |
566 } | 566 } |
567 | 567 |
568 // If we have to call into C then we need to save and restore all caller- | 568 // If we have to call into C then we need to save and restore all caller- |
569 // saved registers that were not already preserved. The scratch registers | 569 // saved registers that were not already preserved. The scratch registers |
570 // will be restored by other means so we don't bother pushing them here. | 570 // will be restored by other means so we don't bother pushing them here. |
571 void SaveCallerSaveRegisters(MacroAssembler* masm, SaveFPRegsMode mode) { | 571 void SaveCallerSaveRegisters(MacroAssembler* masm, SaveFPRegsMode mode) { |
572 masm->stm(db_w, sp, (kCallerSaved | lr.bit()) & ~scratch1_.bit()); | 572 masm->stm(db_w, sp, (kCallerSaved | lr.bit()) & ~scratch1_.bit()); |
573 if (mode == kSaveFPRegs) { | 573 if (mode == kSaveFPRegs) { |
574 CpuFeatures::Scope scope(VFP3); | 574 CpuFeatures::Scope scope(VFP2); |
575 masm->sub(sp, | 575 masm->sub(sp, |
576 sp, | 576 sp, |
577 Operand(kDoubleSize * (DwVfpRegister::kNumRegisters - 1))); | 577 Operand(kDoubleSize * (DwVfpRegister::kNumRegisters - 1))); |
578 // Save all VFP registers except d0. | 578 // Save all VFP registers except d0. |
579 for (int i = DwVfpRegister::kNumRegisters - 1; i > 0; i--) { | 579 for (int i = DwVfpRegister::kNumRegisters - 1; i > 0; i--) { |
580 DwVfpRegister reg = DwVfpRegister::from_code(i); | 580 DwVfpRegister reg = DwVfpRegister::from_code(i); |
581 masm->vstr(reg, MemOperand(sp, (i - 1) * kDoubleSize)); | 581 masm->vstr(reg, MemOperand(sp, (i - 1) * kDoubleSize)); |
582 } | 582 } |
583 } | 583 } |
584 } | 584 } |
585 | 585 |
586 inline void RestoreCallerSaveRegisters(MacroAssembler*masm, | 586 inline void RestoreCallerSaveRegisters(MacroAssembler*masm, |
587 SaveFPRegsMode mode) { | 587 SaveFPRegsMode mode) { |
588 if (mode == kSaveFPRegs) { | 588 if (mode == kSaveFPRegs) { |
589 CpuFeatures::Scope scope(VFP3); | 589 CpuFeatures::Scope scope(VFP2); |
590 // Restore all VFP registers except d0. | 590 // Restore all VFP registers except d0. |
591 for (int i = DwVfpRegister::kNumRegisters - 1; i > 0; i--) { | 591 for (int i = DwVfpRegister::kNumRegisters - 1; i > 0; i--) { |
592 DwVfpRegister reg = DwVfpRegister::from_code(i); | 592 DwVfpRegister reg = DwVfpRegister::from_code(i); |
593 masm->vldr(reg, MemOperand(sp, (i - 1) * kDoubleSize)); | 593 masm->vldr(reg, MemOperand(sp, (i - 1) * kDoubleSize)); |
594 } | 594 } |
595 masm->add(sp, | 595 masm->add(sp, |
596 sp, | 596 sp, |
597 Operand(kDoubleSize * (DwVfpRegister::kNumRegisters - 1))); | 597 Operand(kDoubleSize * (DwVfpRegister::kNumRegisters - 1))); |
598 } | 598 } |
599 masm->ldm(ia_w, sp, (kCallerSaved | lr.bit()) & ~scratch1_.bit()); | 599 masm->ldm(ia_w, sp, (kCallerSaved | lr.bit()) & ~scratch1_.bit()); |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
894 | 894 |
895 class LookupModeBits: public BitField<LookupMode, 0, 1> {}; | 895 class LookupModeBits: public BitField<LookupMode, 0, 1> {}; |
896 | 896 |
897 LookupMode mode_; | 897 LookupMode mode_; |
898 }; | 898 }; |
899 | 899 |
900 | 900 |
901 } } // namespace v8::internal | 901 } } // namespace v8::internal |
902 | 902 |
903 #endif // V8_ARM_CODE_STUBS_ARM_H_ | 903 #endif // V8_ARM_CODE_STUBS_ARM_H_ |
OLD | NEW |