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 __ vmov(kScratchDoubleReg, cgen_->ToDoubleRegister(source)); | 174 __ vmov(DwVfpRegister::ScratchReg(), cgen_->ToDoubleRegister(source)); |
175 } else if (source->IsDoubleStackSlot()) { | 175 } else if (source->IsDoubleStackSlot()) { |
176 __ vldr(kScratchDoubleReg, cgen_->ToMemOperand(source)); | 176 __ vldr(DwVfpRegister::ScratchReg(), cgen_->ToMemOperand(source)); |
177 } else { | 177 } else { |
178 UNREACHABLE(); | 178 UNREACHABLE(); |
179 } | 179 } |
180 // 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. |
181 moves_[index].Eliminate(); | 181 moves_[index].Eliminate(); |
182 } | 182 } |
183 | 183 |
184 | 184 |
185 void LGapResolver::RestoreValue() { | 185 void LGapResolver::RestoreValue() { |
186 ASSERT(in_cycle_); | 186 ASSERT(in_cycle_); |
187 ASSERT(saved_destination_ != NULL); | 187 ASSERT(saved_destination_ != NULL); |
188 | 188 |
189 // Spilled value is in kSavedValueRegister or kSavedDoubleValueRegister. | 189 // Spilled value is in kSavedValueRegister or kSavedDoubleValueRegister. |
190 if (saved_destination_->IsRegister()) { | 190 if (saved_destination_->IsRegister()) { |
191 __ mov(cgen_->ToRegister(saved_destination_), kSavedValueRegister); | 191 __ mov(cgen_->ToRegister(saved_destination_), kSavedValueRegister); |
192 } else if (saved_destination_->IsStackSlot()) { | 192 } else if (saved_destination_->IsStackSlot()) { |
193 __ str(kSavedValueRegister, cgen_->ToMemOperand(saved_destination_)); | 193 __ str(kSavedValueRegister, cgen_->ToMemOperand(saved_destination_)); |
194 } else if (saved_destination_->IsDoubleRegister()) { | 194 } else if (saved_destination_->IsDoubleRegister()) { |
195 __ vmov(cgen_->ToDoubleRegister(saved_destination_), kScratchDoubleReg); | 195 __ vmov(cgen_->ToDoubleRegister(saved_destination_), |
| 196 DwVfpRegister::ScratchReg()); |
196 } else if (saved_destination_->IsDoubleStackSlot()) { | 197 } else if (saved_destination_->IsDoubleStackSlot()) { |
197 __ vstr(kScratchDoubleReg, cgen_->ToMemOperand(saved_destination_)); | 198 __ vstr(DwVfpRegister::ScratchReg(), |
| 199 cgen_->ToMemOperand(saved_destination_)); |
198 } else { | 200 } else { |
199 UNREACHABLE(); | 201 UNREACHABLE(); |
200 } | 202 } |
201 | 203 |
202 in_cycle_ = false; | 204 in_cycle_ = false; |
203 saved_destination_ = NULL; | 205 saved_destination_ = NULL; |
204 } | 206 } |
205 | 207 |
206 | 208 |
207 void LGapResolver::EmitMove(int index) { | 209 void LGapResolver::EmitMove(int index) { |
(...skipping 17 matching lines...) Expand all Loading... |
225 if (destination->IsRegister()) { | 227 if (destination->IsRegister()) { |
226 __ ldr(cgen_->ToRegister(destination), source_operand); | 228 __ ldr(cgen_->ToRegister(destination), source_operand); |
227 } else { | 229 } else { |
228 ASSERT(destination->IsStackSlot()); | 230 ASSERT(destination->IsStackSlot()); |
229 MemOperand destination_operand = cgen_->ToMemOperand(destination); | 231 MemOperand destination_operand = cgen_->ToMemOperand(destination); |
230 if (in_cycle_) { | 232 if (in_cycle_) { |
231 if (!destination_operand.OffsetIsUint12Encodable()) { | 233 if (!destination_operand.OffsetIsUint12Encodable()) { |
232 // ip is overwritten while saving the value to the destination. | 234 // ip is overwritten while saving the value to the destination. |
233 // Therefore we can't use ip. It is OK if the read from the source | 235 // Therefore we can't use ip. It is OK if the read from the source |
234 // destroys ip, since that happens before the value is read. | 236 // destroys ip, since that happens before the value is read. |
235 __ vldr(kScratchDoubleReg.low(), source_operand); | 237 __ vldr(DwVfpRegister::ScratchReg().low(), source_operand); |
236 __ vstr(kScratchDoubleReg.low(), destination_operand); | 238 __ vstr(DwVfpRegister::ScratchReg().low(), destination_operand); |
237 } else { | 239 } else { |
238 __ ldr(ip, source_operand); | 240 __ ldr(ip, source_operand); |
239 __ str(ip, destination_operand); | 241 __ str(ip, destination_operand); |
240 } | 242 } |
241 } else { | 243 } else { |
242 __ ldr(kSavedValueRegister, source_operand); | 244 __ ldr(kSavedValueRegister, source_operand); |
243 __ str(kSavedValueRegister, destination_operand); | 245 __ str(kSavedValueRegister, destination_operand); |
244 } | 246 } |
245 } | 247 } |
246 | 248 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 // but kSavedValueRegister is free. | 289 // but kSavedValueRegister is free. |
288 MemOperand source_high_operand = | 290 MemOperand source_high_operand = |
289 cgen_->ToHighMemOperand(source); | 291 cgen_->ToHighMemOperand(source); |
290 MemOperand destination_high_operand = | 292 MemOperand destination_high_operand = |
291 cgen_->ToHighMemOperand(destination); | 293 cgen_->ToHighMemOperand(destination); |
292 __ ldr(kSavedValueRegister, source_operand); | 294 __ ldr(kSavedValueRegister, source_operand); |
293 __ str(kSavedValueRegister, destination_operand); | 295 __ str(kSavedValueRegister, destination_operand); |
294 __ ldr(kSavedValueRegister, source_high_operand); | 296 __ ldr(kSavedValueRegister, source_high_operand); |
295 __ str(kSavedValueRegister, destination_high_operand); | 297 __ str(kSavedValueRegister, destination_high_operand); |
296 } else { | 298 } else { |
297 __ vldr(kScratchDoubleReg, source_operand); | 299 __ vldr(DwVfpRegister::ScratchReg(), source_operand); |
298 __ vstr(kScratchDoubleReg, destination_operand); | 300 __ vstr(DwVfpRegister::ScratchReg(), destination_operand); |
299 } | 301 } |
300 } | 302 } |
301 } else { | 303 } else { |
302 UNREACHABLE(); | 304 UNREACHABLE(); |
303 } | 305 } |
304 | 306 |
305 moves_[index].Eliminate(); | 307 moves_[index].Eliminate(); |
306 } | 308 } |
307 | 309 |
308 | 310 |
309 #undef __ | 311 #undef __ |
310 | 312 |
311 } } // namespace v8::internal | 313 } } // namespace v8::internal |
OLD | NEW |