Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(153)

Side by Side Diff: src/arm/assembler-arm.cc

Issue 358363002: Move platform abstraction to base library (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: updates Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 1994-2006 Sun Microsystems Inc. 1 // Copyright (c) 1994-2006 Sun Microsystems Inc.
2 // All Rights Reserved. 2 // All Rights Reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions 5 // modification, are permitted provided that the following conditions
6 // are met: 6 // are met:
7 // 7 //
8 // - Redistributions of source code must retain the above copyright notice, 8 // - Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer. 9 // this list of conditions and the following disclaimer.
10 // 10 //
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 if (FLAG_enable_neon) supported_ |= 1u << NEON | 1u << VFP32DREGS; 86 if (FLAG_enable_neon) supported_ |= 1u << NEON | 1u << VFP32DREGS;
87 if (FLAG_enable_sudiv) supported_ |= 1u << SUDIV; 87 if (FLAG_enable_sudiv) supported_ |= 1u << SUDIV;
88 if (FLAG_enable_movw_movt) supported_ |= 1u << MOVW_MOVT_IMMEDIATE_LOADS; 88 if (FLAG_enable_movw_movt) supported_ |= 1u << MOVW_MOVT_IMMEDIATE_LOADS;
89 if (FLAG_enable_32dregs) supported_ |= 1u << VFP32DREGS; 89 if (FLAG_enable_32dregs) supported_ |= 1u << VFP32DREGS;
90 } 90 }
91 if (FLAG_enable_mls) supported_ |= 1u << MLS; 91 if (FLAG_enable_mls) supported_ |= 1u << MLS;
92 if (FLAG_enable_unaligned_accesses) supported_ |= 1u << UNALIGNED_ACCESSES; 92 if (FLAG_enable_unaligned_accesses) supported_ |= 1u << UNALIGNED_ACCESSES;
93 93
94 #else // __arm__ 94 #else // __arm__
95 // Probe for additional features at runtime. 95 // Probe for additional features at runtime.
96 CPU cpu; 96 base::CPU cpu;
97 if (FLAG_enable_vfp3 && cpu.has_vfp3()) { 97 if (FLAG_enable_vfp3 && cpu.has_vfp3()) {
98 // This implementation also sets the VFP flags if runtime 98 // This implementation also sets the VFP flags if runtime
99 // detection of VFP returns true. VFPv3 implies ARMv7, see ARM DDI 99 // detection of VFP returns true. VFPv3 implies ARMv7, see ARM DDI
100 // 0406B, page A1-6. 100 // 0406B, page A1-6.
101 supported_ |= 1u << VFP3 | 1u << ARMv7; 101 supported_ |= 1u << VFP3 | 1u << ARMv7;
102 } 102 }
103 103
104 if (FLAG_enable_neon && cpu.has_neon()) supported_ |= 1u << NEON; 104 if (FLAG_enable_neon && cpu.has_neon()) supported_ |= 1u << NEON;
105 if (FLAG_enable_sudiv && cpu.has_idiva()) supported_ |= 1u << SUDIV; 105 if (FLAG_enable_sudiv && cpu.has_idiva()) supported_ |= 1u << SUDIV;
106 if (FLAG_enable_mls && cpu.has_thumb2()) supported_ |= 1u << MLS; 106 if (FLAG_enable_mls && cpu.has_thumb2()) supported_ |= 1u << MLS;
107 107
108 if (cpu.architecture() >= 7) { 108 if (cpu.architecture() >= 7) {
109 if (FLAG_enable_armv7) supported_ |= 1u << ARMv7; 109 if (FLAG_enable_armv7) supported_ |= 1u << ARMv7;
110 if (FLAG_enable_unaligned_accesses) supported_ |= 1u << UNALIGNED_ACCESSES; 110 if (FLAG_enable_unaligned_accesses) supported_ |= 1u << UNALIGNED_ACCESSES;
111 // Use movw/movt for QUALCOMM ARMv7 cores. 111 // Use movw/movt for QUALCOMM ARMv7 cores.
112 if (FLAG_enable_movw_movt && cpu.implementer() == CPU::QUALCOMM) { 112 if (FLAG_enable_movw_movt && cpu.implementer() == base::CPU::QUALCOMM) {
113 supported_ |= 1u << MOVW_MOVT_IMMEDIATE_LOADS; 113 supported_ |= 1u << MOVW_MOVT_IMMEDIATE_LOADS;
114 } 114 }
115 } 115 }
116 116
117 // ARM Cortex-A9 and Cortex-A5 have 32 byte cachelines. 117 // ARM Cortex-A9 and Cortex-A5 have 32 byte cachelines.
118 if (cpu.implementer() == CPU::ARM && (cpu.part() == CPU::ARM_CORTEX_A5 || 118 if (cpu.implementer() == base::CPU::ARM &&
119 cpu.part() == CPU::ARM_CORTEX_A9)) { 119 (cpu.part() == base::CPU::ARM_CORTEX_A5 ||
120 cpu.part() == base::CPU::ARM_CORTEX_A9)) {
120 cache_line_size_ = 32; 121 cache_line_size_ = 32;
121 } 122 }
122 123
123 if (FLAG_enable_32dregs && cpu.has_vfp3_d32()) supported_ |= 1u << VFP32DREGS; 124 if (FLAG_enable_32dregs && cpu.has_vfp3_d32()) supported_ |= 1u << VFP32DREGS;
124 #endif 125 #endif
125 126
126 ASSERT(!IsSupported(VFP3) || IsSupported(ARMv7)); 127 ASSERT(!IsSupported(VFP3) || IsSupported(ARMv7));
127 } 128 }
128 129
129 130
(...skipping 25 matching lines...) Expand all
155 # if defined CAN_USE_VFP32DREGS 156 # if defined CAN_USE_VFP32DREGS
156 arm_fpu = " vfp3"; 157 arm_fpu = " vfp3";
157 # else 158 # else
158 arm_fpu = " vfp3-d16"; 159 arm_fpu = " vfp3-d16";
159 # endif 160 # endif
160 #else 161 #else
161 arm_fpu = " vfp2"; 162 arm_fpu = " vfp2";
162 #endif 163 #endif
163 164
164 #ifdef __arm__ 165 #ifdef __arm__
165 arm_float_abi = OS::ArmUsingHardFloat() ? "hard" : "softfp"; 166 arm_float_abi = base::OS::ArmUsingHardFloat() ? "hard" : "softfp";
166 #elif USE_EABI_HARDFLOAT 167 #elif USE_EABI_HARDFLOAT
167 arm_float_abi = "hard"; 168 arm_float_abi = "hard";
168 #else 169 #else
169 arm_float_abi = "softfp"; 170 arm_float_abi = "softfp";
170 #endif 171 #endif
171 172
172 #if defined __arm__ && (defined __thumb__) || (defined __thumb2__) 173 #if defined __arm__ && (defined __thumb__) || (defined __thumb2__)
173 arm_thumb = " thumb"; 174 arm_thumb = " thumb";
174 #endif 175 #endif
175 176
176 printf("target%s%s %s%s%s %s\n", 177 printf("target%s%s %s%s%s %s\n",
177 arm_target_type, arm_no_probe, arm_arch, arm_fpu, arm_thumb, 178 arm_target_type, arm_no_probe, arm_arch, arm_fpu, arm_thumb,
178 arm_float_abi); 179 arm_float_abi);
179 } 180 }
180 181
181 182
182 void CpuFeatures::PrintFeatures() { 183 void CpuFeatures::PrintFeatures() {
183 printf( 184 printf(
184 "ARMv7=%d VFP3=%d VFP32DREGS=%d NEON=%d SUDIV=%d UNALIGNED_ACCESSES=%d " 185 "ARMv7=%d VFP3=%d VFP32DREGS=%d NEON=%d SUDIV=%d UNALIGNED_ACCESSES=%d "
185 "MOVW_MOVT_IMMEDIATE_LOADS=%d", 186 "MOVW_MOVT_IMMEDIATE_LOADS=%d",
186 CpuFeatures::IsSupported(ARMv7), 187 CpuFeatures::IsSupported(ARMv7),
187 CpuFeatures::IsSupported(VFP3), 188 CpuFeatures::IsSupported(VFP3),
188 CpuFeatures::IsSupported(VFP32DREGS), 189 CpuFeatures::IsSupported(VFP32DREGS),
189 CpuFeatures::IsSupported(NEON), 190 CpuFeatures::IsSupported(NEON),
190 CpuFeatures::IsSupported(SUDIV), 191 CpuFeatures::IsSupported(SUDIV),
191 CpuFeatures::IsSupported(UNALIGNED_ACCESSES), 192 CpuFeatures::IsSupported(UNALIGNED_ACCESSES),
192 CpuFeatures::IsSupported(MOVW_MOVT_IMMEDIATE_LOADS)); 193 CpuFeatures::IsSupported(MOVW_MOVT_IMMEDIATE_LOADS));
193 #ifdef __arm__ 194 #ifdef __arm__
194 bool eabi_hardfloat = OS::ArmUsingHardFloat(); 195 bool eabi_hardfloat = base::OS::ArmUsingHardFloat();
195 #elif USE_EABI_HARDFLOAT 196 #elif USE_EABI_HARDFLOAT
196 bool eabi_hardfloat = true; 197 bool eabi_hardfloat = true;
197 #else 198 #else
198 bool eabi_hardfloat = false; 199 bool eabi_hardfloat = false;
199 #endif 200 #endif
200 printf(" USE_EABI_HARDFLOAT=%d\n", eabi_hardfloat); 201 printf(" USE_EABI_HARDFLOAT=%d\n", eabi_hardfloat);
201 } 202 }
202 203
203 204
204 // ----------------------------------------------------------------------------- 205 // -----------------------------------------------------------------------------
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 240
240 void RelocInfo::PatchCode(byte* instructions, int instruction_count) { 241 void RelocInfo::PatchCode(byte* instructions, int instruction_count) {
241 // Patch the code at the current address with the supplied instructions. 242 // Patch the code at the current address with the supplied instructions.
242 Instr* pc = reinterpret_cast<Instr*>(pc_); 243 Instr* pc = reinterpret_cast<Instr*>(pc_);
243 Instr* instr = reinterpret_cast<Instr*>(instructions); 244 Instr* instr = reinterpret_cast<Instr*>(instructions);
244 for (int i = 0; i < instruction_count; i++) { 245 for (int i = 0; i < instruction_count; i++) {
245 *(pc + i) = *(instr + i); 246 *(pc + i) = *(instr + i);
246 } 247 }
247 248
248 // Indicate that code has changed. 249 // Indicate that code has changed.
249 CPU::FlushICache(pc_, instruction_count * Assembler::kInstrSize); 250 CpuFeatures::FlushICache(pc_, instruction_count * Assembler::kInstrSize);
250 } 251 }
251 252
252 253
253 // Patch the code at the current PC with a call to the target address. 254 // Patch the code at the current PC with a call to the target address.
254 // Additional guard instructions can be added if required. 255 // Additional guard instructions can be added if required.
255 void RelocInfo::PatchCodeWithCall(Address target, int guard_bytes) { 256 void RelocInfo::PatchCodeWithCall(Address target, int guard_bytes) {
256 // Patch the code at the current address with a call to the target. 257 // Patch the code at the current address with a call to the target.
257 UNIMPLEMENTED(); 258 UNIMPLEMENTED();
258 } 259 }
259 260
(...skipping 3414 matching lines...) Expand 10 before | Expand all | Expand 10 after
3674 ASSERT((index_64bit == count_of_64bit_) && 3675 ASSERT((index_64bit == count_of_64bit_) &&
3675 (index_code_ptr == (index_64bit + count_of_code_ptr_)) && 3676 (index_code_ptr == (index_64bit + count_of_code_ptr_)) &&
3676 (index_heap_ptr == (index_code_ptr + count_of_heap_ptr_)) && 3677 (index_heap_ptr == (index_code_ptr + count_of_heap_ptr_)) &&
3677 (index_32bit == (index_heap_ptr + count_of_32bit_))); 3678 (index_32bit == (index_heap_ptr + count_of_32bit_)));
3678 } 3679 }
3679 3680
3680 3681
3681 } } // namespace v8::internal 3682 } } // namespace v8::internal
3682 3683
3683 #endif // V8_TARGET_ARCH_ARM 3684 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/arm/assembler-arm-inl.h » ('j') | src/base/cpu.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698