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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 ASSERT(moves_[index].destination()->Equals(moves_[root_index_].source())); | 165 ASSERT(moves_[index].destination()->Equals(moves_[root_index_].source())); |
166 ASSERT(!in_cycle_); | 166 ASSERT(!in_cycle_); |
167 in_cycle_ = true; | 167 in_cycle_ = true; |
168 LOperand* source = moves_[index].source(); | 168 LOperand* source = moves_[index].source(); |
169 saved_destination_ = moves_[index].destination(); | 169 saved_destination_ = moves_[index].destination(); |
170 if (source->IsRegister()) { | 170 if (source->IsRegister()) { |
171 __ mov(kLithiumScratchReg, cgen_->ToRegister(source)); | 171 __ mov(kLithiumScratchReg, cgen_->ToRegister(source)); |
172 } else if (source->IsStackSlot()) { | 172 } else if (source->IsStackSlot()) { |
173 __ lw(kLithiumScratchReg, cgen_->ToMemOperand(source)); | 173 __ lw(kLithiumScratchReg, cgen_->ToMemOperand(source)); |
174 } else if (source->IsDoubleRegister()) { | 174 } else if (source->IsDoubleRegister()) { |
| 175 CpuFeatures::Scope scope(FPU); |
175 __ mov_d(kLithiumScratchDouble, cgen_->ToDoubleRegister(source)); | 176 __ mov_d(kLithiumScratchDouble, cgen_->ToDoubleRegister(source)); |
176 } else if (source->IsDoubleStackSlot()) { | 177 } else if (source->IsDoubleStackSlot()) { |
| 178 CpuFeatures::Scope scope(FPU); |
177 __ ldc1(kLithiumScratchDouble, cgen_->ToMemOperand(source)); | 179 __ ldc1(kLithiumScratchDouble, cgen_->ToMemOperand(source)); |
178 } else { | 180 } else { |
179 UNREACHABLE(); | 181 UNREACHABLE(); |
180 } | 182 } |
181 // This move will be done by restoring the saved value to the destination. | 183 // This move will be done by restoring the saved value to the destination. |
182 moves_[index].Eliminate(); | 184 moves_[index].Eliminate(); |
183 } | 185 } |
184 | 186 |
185 | 187 |
186 void LGapResolver::RestoreValue() { | 188 void LGapResolver::RestoreValue() { |
187 ASSERT(in_cycle_); | 189 ASSERT(in_cycle_); |
188 ASSERT(saved_destination_ != NULL); | 190 ASSERT(saved_destination_ != NULL); |
189 | 191 |
190 // Spilled value is in kLithiumScratchReg or kLithiumScratchDouble. | 192 // Spilled value is in kLithiumScratchReg or kLithiumScratchDouble. |
191 if (saved_destination_->IsRegister()) { | 193 if (saved_destination_->IsRegister()) { |
192 __ mov(cgen_->ToRegister(saved_destination_), kLithiumScratchReg); | 194 __ mov(cgen_->ToRegister(saved_destination_), kLithiumScratchReg); |
193 } else if (saved_destination_->IsStackSlot()) { | 195 } else if (saved_destination_->IsStackSlot()) { |
194 __ sw(kLithiumScratchReg, cgen_->ToMemOperand(saved_destination_)); | 196 __ sw(kLithiumScratchReg, cgen_->ToMemOperand(saved_destination_)); |
195 } else if (saved_destination_->IsDoubleRegister()) { | 197 } else if (saved_destination_->IsDoubleRegister()) { |
| 198 CpuFeatures::Scope scope(FPU); |
196 __ mov_d(cgen_->ToDoubleRegister(saved_destination_), | 199 __ mov_d(cgen_->ToDoubleRegister(saved_destination_), |
197 kLithiumScratchDouble); | 200 kLithiumScratchDouble); |
198 } else if (saved_destination_->IsDoubleStackSlot()) { | 201 } else if (saved_destination_->IsDoubleStackSlot()) { |
| 202 CpuFeatures::Scope scope(FPU); |
199 __ sdc1(kLithiumScratchDouble, | 203 __ sdc1(kLithiumScratchDouble, |
200 cgen_->ToMemOperand(saved_destination_)); | 204 cgen_->ToMemOperand(saved_destination_)); |
201 } else { | 205 } else { |
202 UNREACHABLE(); | 206 UNREACHABLE(); |
203 } | 207 } |
204 | 208 |
205 in_cycle_ = false; | 209 in_cycle_ = false; |
206 saved_destination_ = NULL; | 210 saved_destination_ = NULL; |
207 } | 211 } |
208 | 212 |
(...skipping 16 matching lines...) Expand all Loading... |
225 | 229 |
226 } else if (source->IsStackSlot()) { | 230 } else if (source->IsStackSlot()) { |
227 MemOperand source_operand = cgen_->ToMemOperand(source); | 231 MemOperand source_operand = cgen_->ToMemOperand(source); |
228 if (destination->IsRegister()) { | 232 if (destination->IsRegister()) { |
229 __ lw(cgen_->ToRegister(destination), source_operand); | 233 __ lw(cgen_->ToRegister(destination), source_operand); |
230 } else { | 234 } else { |
231 ASSERT(destination->IsStackSlot()); | 235 ASSERT(destination->IsStackSlot()); |
232 MemOperand destination_operand = cgen_->ToMemOperand(destination); | 236 MemOperand destination_operand = cgen_->ToMemOperand(destination); |
233 if (in_cycle_) { | 237 if (in_cycle_) { |
234 if (!destination_operand.OffsetIsInt16Encodable()) { | 238 if (!destination_operand.OffsetIsInt16Encodable()) { |
| 239 CpuFeatures::Scope scope(FPU); |
235 // 'at' is overwritten while saving the value to the destination. | 240 // 'at' is overwritten while saving the value to the destination. |
236 // Therefore we can't use 'at'. It is OK if the read from the source | 241 // Therefore we can't use 'at'. It is OK if the read from the source |
237 // destroys 'at', since that happens before the value is read. | 242 // destroys 'at', since that happens before the value is read. |
238 // This uses only a single reg of the double reg-pair. | 243 // This uses only a single reg of the double reg-pair. |
239 __ lwc1(kLithiumScratchDouble, source_operand); | 244 __ lwc1(kLithiumScratchDouble, source_operand); |
240 __ swc1(kLithiumScratchDouble, destination_operand); | 245 __ swc1(kLithiumScratchDouble, destination_operand); |
241 } else { | 246 } else { |
242 __ lw(at, source_operand); | 247 __ lw(at, source_operand); |
243 __ sw(at, destination_operand); | 248 __ sw(at, destination_operand); |
244 } | 249 } |
(...skipping 19 matching lines...) Expand all Loading... |
264 __ li(kLithiumScratchReg, | 269 __ li(kLithiumScratchReg, |
265 Operand(cgen_->ToInteger32(constant_source))); | 270 Operand(cgen_->ToInteger32(constant_source))); |
266 } else { | 271 } else { |
267 __ LoadObject(kLithiumScratchReg, | 272 __ LoadObject(kLithiumScratchReg, |
268 cgen_->ToHandle(constant_source)); | 273 cgen_->ToHandle(constant_source)); |
269 } | 274 } |
270 __ sw(kLithiumScratchReg, cgen_->ToMemOperand(destination)); | 275 __ sw(kLithiumScratchReg, cgen_->ToMemOperand(destination)); |
271 } | 276 } |
272 | 277 |
273 } else if (source->IsDoubleRegister()) { | 278 } else if (source->IsDoubleRegister()) { |
| 279 CpuFeatures::Scope scope(FPU); |
274 DoubleRegister source_register = cgen_->ToDoubleRegister(source); | 280 DoubleRegister source_register = cgen_->ToDoubleRegister(source); |
275 if (destination->IsDoubleRegister()) { | 281 if (destination->IsDoubleRegister()) { |
276 __ mov_d(cgen_->ToDoubleRegister(destination), source_register); | 282 __ mov_d(cgen_->ToDoubleRegister(destination), source_register); |
277 } else { | 283 } else { |
278 ASSERT(destination->IsDoubleStackSlot()); | 284 ASSERT(destination->IsDoubleStackSlot()); |
279 MemOperand destination_operand = cgen_->ToMemOperand(destination); | 285 MemOperand destination_operand = cgen_->ToMemOperand(destination); |
280 __ sdc1(source_register, destination_operand); | 286 __ sdc1(source_register, destination_operand); |
281 } | 287 } |
282 | 288 |
283 } else if (source->IsDoubleStackSlot()) { | 289 } else if (source->IsDoubleStackSlot()) { |
| 290 CpuFeatures::Scope scope(FPU); |
284 MemOperand source_operand = cgen_->ToMemOperand(source); | 291 MemOperand source_operand = cgen_->ToMemOperand(source); |
285 if (destination->IsDoubleRegister()) { | 292 if (destination->IsDoubleRegister()) { |
286 __ ldc1(cgen_->ToDoubleRegister(destination), source_operand); | 293 __ ldc1(cgen_->ToDoubleRegister(destination), source_operand); |
287 } else { | 294 } else { |
288 ASSERT(destination->IsDoubleStackSlot()); | 295 ASSERT(destination->IsDoubleStackSlot()); |
289 MemOperand destination_operand = cgen_->ToMemOperand(destination); | 296 MemOperand destination_operand = cgen_->ToMemOperand(destination); |
290 if (in_cycle_) { | 297 if (in_cycle_) { |
291 // kLithiumScratchDouble was used to break the cycle, | 298 // kLithiumScratchDouble was used to break the cycle, |
292 // but kLithiumScratchReg is free. | 299 // but kLithiumScratchReg is free. |
293 MemOperand source_high_operand = | 300 MemOperand source_high_operand = |
(...skipping 13 matching lines...) Expand all Loading... |
307 UNREACHABLE(); | 314 UNREACHABLE(); |
308 } | 315 } |
309 | 316 |
310 moves_[index].Eliminate(); | 317 moves_[index].Eliminate(); |
311 } | 318 } |
312 | 319 |
313 | 320 |
314 #undef __ | 321 #undef __ |
315 | 322 |
316 } } // namespace v8::internal | 323 } } // namespace v8::internal |
OLD | NEW |