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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 ASSERT(moves_[index].destination()->Equals(moves_[root_index_].source())); | 164 ASSERT(moves_[index].destination()->Equals(moves_[root_index_].source())); |
165 ASSERT(!in_cycle_); | 165 ASSERT(!in_cycle_); |
166 in_cycle_ = true; | 166 in_cycle_ = true; |
167 LOperand* source = moves_[index].source(); | 167 LOperand* source = moves_[index].source(); |
168 saved_destination_ = moves_[index].destination(); | 168 saved_destination_ = moves_[index].destination(); |
169 if (source->IsRegister()) { | 169 if (source->IsRegister()) { |
170 __ mov(kSavedValueRegister, cgen_->ToRegister(source)); | 170 __ mov(kSavedValueRegister, cgen_->ToRegister(source)); |
171 } else if (source->IsStackSlot()) { | 171 } else if (source->IsStackSlot()) { |
172 __ ldr(kSavedValueRegister, cgen_->ToMemOperand(source)); | 172 __ ldr(kSavedValueRegister, cgen_->ToMemOperand(source)); |
173 } else if (source->IsDoubleRegister()) { | 173 } else if (source->IsDoubleRegister()) { |
174 CpuFeatures::Scope scope(VFP2); | |
175 __ vmov(kScratchDoubleReg, cgen_->ToDoubleRegister(source)); | 174 __ vmov(kScratchDoubleReg, cgen_->ToDoubleRegister(source)); |
176 } else if (source->IsDoubleStackSlot()) { | 175 } else if (source->IsDoubleStackSlot()) { |
177 CpuFeatures::Scope scope(VFP2); | |
178 __ vldr(kScratchDoubleReg, cgen_->ToMemOperand(source)); | 176 __ vldr(kScratchDoubleReg, cgen_->ToMemOperand(source)); |
179 } else { | 177 } else { |
180 UNREACHABLE(); | 178 UNREACHABLE(); |
181 } | 179 } |
182 // This move will be done by restoring the saved value to the destination. | 180 // This move will be done by restoring the saved value to the destination. |
183 moves_[index].Eliminate(); | 181 moves_[index].Eliminate(); |
184 } | 182 } |
185 | 183 |
186 | 184 |
187 void LGapResolver::RestoreValue() { | 185 void LGapResolver::RestoreValue() { |
188 ASSERT(in_cycle_); | 186 ASSERT(in_cycle_); |
189 ASSERT(saved_destination_ != NULL); | 187 ASSERT(saved_destination_ != NULL); |
190 | 188 |
191 // Spilled value is in kSavedValueRegister or kSavedDoubleValueRegister. | 189 // Spilled value is in kSavedValueRegister or kSavedDoubleValueRegister. |
192 if (saved_destination_->IsRegister()) { | 190 if (saved_destination_->IsRegister()) { |
193 __ mov(cgen_->ToRegister(saved_destination_), kSavedValueRegister); | 191 __ mov(cgen_->ToRegister(saved_destination_), kSavedValueRegister); |
194 } else if (saved_destination_->IsStackSlot()) { | 192 } else if (saved_destination_->IsStackSlot()) { |
195 __ str(kSavedValueRegister, cgen_->ToMemOperand(saved_destination_)); | 193 __ str(kSavedValueRegister, cgen_->ToMemOperand(saved_destination_)); |
196 } else if (saved_destination_->IsDoubleRegister()) { | 194 } else if (saved_destination_->IsDoubleRegister()) { |
197 CpuFeatures::Scope scope(VFP2); | |
198 __ vmov(cgen_->ToDoubleRegister(saved_destination_), kScratchDoubleReg); | 195 __ vmov(cgen_->ToDoubleRegister(saved_destination_), kScratchDoubleReg); |
199 } else if (saved_destination_->IsDoubleStackSlot()) { | 196 } else if (saved_destination_->IsDoubleStackSlot()) { |
200 CpuFeatures::Scope scope(VFP2); | |
201 __ vstr(kScratchDoubleReg, cgen_->ToMemOperand(saved_destination_)); | 197 __ vstr(kScratchDoubleReg, cgen_->ToMemOperand(saved_destination_)); |
202 } else { | 198 } else { |
203 UNREACHABLE(); | 199 UNREACHABLE(); |
204 } | 200 } |
205 | 201 |
206 in_cycle_ = false; | 202 in_cycle_ = false; |
207 saved_destination_ = NULL; | 203 saved_destination_ = NULL; |
208 } | 204 } |
209 | 205 |
210 | 206 |
(...skipping 15 matching lines...) Expand all Loading... |
226 | 222 |
227 } else if (source->IsStackSlot()) { | 223 } else if (source->IsStackSlot()) { |
228 MemOperand source_operand = cgen_->ToMemOperand(source); | 224 MemOperand source_operand = cgen_->ToMemOperand(source); |
229 if (destination->IsRegister()) { | 225 if (destination->IsRegister()) { |
230 __ ldr(cgen_->ToRegister(destination), source_operand); | 226 __ ldr(cgen_->ToRegister(destination), source_operand); |
231 } else { | 227 } else { |
232 ASSERT(destination->IsStackSlot()); | 228 ASSERT(destination->IsStackSlot()); |
233 MemOperand destination_operand = cgen_->ToMemOperand(destination); | 229 MemOperand destination_operand = cgen_->ToMemOperand(destination); |
234 if (in_cycle_) { | 230 if (in_cycle_) { |
235 if (!destination_operand.OffsetIsUint12Encodable()) { | 231 if (!destination_operand.OffsetIsUint12Encodable()) { |
236 CpuFeatures::Scope scope(VFP2); | 232 // ip is overwritten while saving the value to the destination. |
237 // ip is overwritten while saving the value to the destination. | |
238 // Therefore we can't use ip. It is OK if the read from the source | 233 // Therefore we can't use ip. It is OK if the read from the source |
239 // destroys ip, since that happens before the value is read. | 234 // destroys ip, since that happens before the value is read. |
240 __ vldr(kScratchDoubleReg.low(), source_operand); | 235 __ vldr(kScratchDoubleReg.low(), source_operand); |
241 __ vstr(kScratchDoubleReg.low(), destination_operand); | 236 __ vstr(kScratchDoubleReg.low(), destination_operand); |
242 } else { | 237 } else { |
243 __ ldr(ip, source_operand); | 238 __ ldr(ip, source_operand); |
244 __ str(ip, destination_operand); | 239 __ str(ip, destination_operand); |
245 } | 240 } |
246 } else { | 241 } else { |
247 __ ldr(kSavedValueRegister, source_operand); | 242 __ ldr(kSavedValueRegister, source_operand); |
(...skipping 17 matching lines...) Expand all Loading... |
265 __ mov(kSavedValueRegister, | 260 __ mov(kSavedValueRegister, |
266 Operand(cgen_->ToInteger32(constant_source))); | 261 Operand(cgen_->ToInteger32(constant_source))); |
267 } else { | 262 } else { |
268 __ LoadObject(kSavedValueRegister, | 263 __ LoadObject(kSavedValueRegister, |
269 cgen_->ToHandle(constant_source)); | 264 cgen_->ToHandle(constant_source)); |
270 } | 265 } |
271 __ str(kSavedValueRegister, cgen_->ToMemOperand(destination)); | 266 __ str(kSavedValueRegister, cgen_->ToMemOperand(destination)); |
272 } | 267 } |
273 | 268 |
274 } else if (source->IsDoubleRegister()) { | 269 } else if (source->IsDoubleRegister()) { |
275 CpuFeatures::Scope scope(VFP2); | 270 DoubleRegister source_register = cgen_->ToDoubleRegister(source); |
276 DwVfpRegister source_register = cgen_->ToDoubleRegister(source); | |
277 if (destination->IsDoubleRegister()) { | 271 if (destination->IsDoubleRegister()) { |
278 __ vmov(cgen_->ToDoubleRegister(destination), source_register); | 272 __ vmov(cgen_->ToDoubleRegister(destination), source_register); |
279 } else { | 273 } else { |
280 ASSERT(destination->IsDoubleStackSlot()); | 274 ASSERT(destination->IsDoubleStackSlot()); |
281 __ vstr(source_register, cgen_->ToMemOperand(destination)); | 275 __ vstr(source_register, cgen_->ToMemOperand(destination)); |
282 } | 276 } |
283 | 277 |
284 } else if (source->IsDoubleStackSlot()) { | 278 } else if (source->IsDoubleStackSlot()) { |
285 CpuFeatures::Scope scope(VFP2); | 279 MemOperand source_operand = cgen_->ToMemOperand(source); |
286 MemOperand source_operand = cgen_->ToMemOperand(source); | |
287 if (destination->IsDoubleRegister()) { | 280 if (destination->IsDoubleRegister()) { |
288 __ vldr(cgen_->ToDoubleRegister(destination), source_operand); | 281 __ vldr(cgen_->ToDoubleRegister(destination), source_operand); |
289 } else { | 282 } else { |
290 ASSERT(destination->IsDoubleStackSlot()); | 283 ASSERT(destination->IsDoubleStackSlot()); |
291 MemOperand destination_operand = cgen_->ToMemOperand(destination); | 284 MemOperand destination_operand = cgen_->ToMemOperand(destination); |
292 if (in_cycle_) { | 285 if (in_cycle_) { |
293 // kSavedDoubleValueRegister was used to break the cycle, | 286 // kSavedDoubleValueRegister was used to break the cycle, |
294 // but kSavedValueRegister is free. | 287 // but kSavedValueRegister is free. |
295 MemOperand source_high_operand = | 288 MemOperand source_high_operand = |
296 cgen_->ToHighMemOperand(source); | 289 cgen_->ToHighMemOperand(source); |
(...skipping 12 matching lines...) Expand all Loading... |
309 UNREACHABLE(); | 302 UNREACHABLE(); |
310 } | 303 } |
311 | 304 |
312 moves_[index].Eliminate(); | 305 moves_[index].Eliminate(); |
313 } | 306 } |
314 | 307 |
315 | 308 |
316 #undef __ | 309 #undef __ |
317 | 310 |
318 } } // namespace v8::internal | 311 } } // namespace v8::internal |
OLD | NEW |