Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 177 // We save in a register the source of that move and we remember its | 177 // We save in a register the source of that move and we remember its |
| 178 // destination. Then we mark this move as resolved so the cycle is | 178 // destination. Then we mark this move as resolved so the cycle is |
| 179 // broken and we can perform the other moves. | 179 // broken and we can perform the other moves. |
| 180 in_cycle_ = true; | 180 in_cycle_ = true; |
| 181 LOperand* source = moves_[index].source(); | 181 LOperand* source = moves_[index].source(); |
| 182 saved_destination_ = moves_[index].destination(); | 182 saved_destination_ = moves_[index].destination(); |
| 183 | 183 |
| 184 if (source->IsRegister()) { | 184 if (source->IsRegister()) { |
| 185 __ Mov(kSavedValue, cgen_->ToRegister(source)); | 185 __ Mov(kSavedValue, cgen_->ToRegister(source)); |
| 186 } else if (source->IsStackSlot()) { | 186 } else if (source->IsStackSlot()) { |
| 187 UNIMPLEMENTED(); | 187 __ Ldr(kSavedValue, cgen_->ToMemOperand(source)); |
| 188 } else if (source->IsDoubleRegister()) { | 188 } else if (source->IsDoubleRegister()) { |
| 189 // TODO(all): We should use a double register to store the value to avoid | 189 // TODO(all): We should use a double register to store the value to avoid |
| 190 // the penalty of the mov across register banks. We are going to reserve | 190 // the penalty of the mov across register banks. We are going to reserve |
| 191 // d31 to hold 0.0 value. We could clobber this register while breaking the | 191 // d31 to hold 0.0 value. We could clobber this register while breaking the |
| 192 // cycle and restore it after like we do with the root register. | 192 // cycle and restore it after like we do with the root register. |
| 193 // LGapResolver::RestoreValue() will need to be updated as well when we'll | 193 // LGapResolver::RestoreValue() will need to be updated as well when we'll |
| 194 // do that. | 194 // do that. |
| 195 __ Fmov(kSavedValue, cgen_->ToDoubleRegister(source)); | 195 __ Fmov(kSavedValue, cgen_->ToDoubleRegister(source)); |
| 196 } else if (source->IsDoubleStackSlot()) { | 196 } else if (source->IsDoubleStackSlot()) { |
| 197 UNIMPLEMENTED(); | 197 __ Ldr(kSavedValue, cgen_->ToMemOperand(source)); |
| 198 } else { | 198 } else { |
| 199 UNREACHABLE(); | 199 UNREACHABLE(); |
| 200 } | 200 } |
| 201 | 201 |
| 202 // Mark this move as resolved. | 202 // Mark this move as resolved. |
| 203 // This move will be actually performed by moving the saved value to this | 203 // This move will be actually performed by moving the saved value to this |
| 204 // move's destination in LGapResolver::RestoreValue(). | 204 // move's destination in LGapResolver::RestoreValue(). |
| 205 moves_[index].Eliminate(); | 205 moves_[index].Eliminate(); |
| 206 } | 206 } |
| 207 | 207 |
| 208 | 208 |
| 209 void LGapResolver::RestoreValue() { | 209 void LGapResolver::RestoreValue() { |
| 210 ASSERT(in_cycle_); | 210 ASSERT(in_cycle_); |
| 211 ASSERT(saved_destination_ != NULL); | 211 ASSERT(saved_destination_ != NULL); |
| 212 | 212 |
| 213 if (saved_destination_->IsRegister()) { | 213 if (saved_destination_->IsRegister()) { |
| 214 __ Mov(cgen_->ToRegister(saved_destination_), kSavedValue); | 214 __ Mov(cgen_->ToRegister(saved_destination_), kSavedValue); |
| 215 } else if (saved_destination_->IsStackSlot()) { | 215 } else if (saved_destination_->IsStackSlot()) { |
| 216 UNIMPLEMENTED(); | 216 __ Str(kSavedValue, cgen_->ToMemOperand(saved_destination_)); |
| 217 } else if (saved_destination_->IsDoubleRegister()) { | 217 } else if (saved_destination_->IsDoubleRegister()) { |
| 218 __ Fmov(cgen_->ToDoubleRegister(saved_destination_), kSavedValue); | 218 __ Fmov(cgen_->ToDoubleRegister(saved_destination_), kSavedValue); |
| 219 } else if (saved_destination_->IsDoubleStackSlot()) { | 219 } else if (saved_destination_->IsDoubleStackSlot()) { |
| 220 UNIMPLEMENTED(); | 220 __ Str(kSavedValue, cgen_->ToMemOperand(saved_destination_)); |
| 221 } else { | 221 } else { |
| 222 UNREACHABLE(); | 222 UNREACHABLE(); |
| 223 } | 223 } |
| 224 | 224 |
| 225 in_cycle_ = false; | 225 in_cycle_ = false; |
| 226 saved_destination_ = NULL; | 226 saved_destination_ = NULL; |
| 227 } | 227 } |
| 228 | 228 |
| 229 | 229 |
| 230 void LGapResolver::EmitMove(int index) { | 230 void LGapResolver::EmitMove(int index) { |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 287 } else { | 287 } else { |
| 288 ASSERT(destination->IsDoubleStackSlot()); | 288 ASSERT(destination->IsDoubleStackSlot()); |
| 289 __ Str(src, cgen_->ToMemOperand(destination)); | 289 __ Str(src, cgen_->ToMemOperand(destination)); |
| 290 } | 290 } |
| 291 | 291 |
| 292 } else if (source->IsDoubleStackSlot()) { | 292 } else if (source->IsDoubleStackSlot()) { |
| 293 MemOperand src = cgen_->ToMemOperand(source); | 293 MemOperand src = cgen_->ToMemOperand(source); |
| 294 if (destination->IsDoubleRegister()) { | 294 if (destination->IsDoubleRegister()) { |
| 295 __ Ldr(cgen_->ToDoubleRegister(destination), src); | 295 __ Ldr(cgen_->ToDoubleRegister(destination), src); |
| 296 } else { | 296 } else { |
| 297 // TODO(all): double stack slot to double stack slot move. | 297 ASSERT(destination->IsDoubleStackSlot()); |
|
Rodolph Perfetta (ARM)
2014/02/04 16:32:10
How about reusing EmitStackSlotMove define below
| |
| 298 UNIMPLEMENTED(); | 298 DoubleRegister temp = crankshaft_fp_scratch; |
| 299 __ Ldr(temp, src); | |
| 300 __ Str(temp, cgen_->ToMemOperand(destination)); | |
| 299 } | 301 } |
| 300 | 302 |
| 301 } else { | 303 } else { |
| 302 UNREACHABLE(); | 304 UNREACHABLE(); |
| 303 } | 305 } |
| 304 | 306 |
| 305 // The move has been emitted, we can eliminate it. | 307 // The move has been emitted, we can eliminate it. |
| 306 moves_[index].Eliminate(); | 308 moves_[index].Eliminate(); |
| 307 } | 309 } |
| 308 | 310 |
| 309 | 311 |
| 310 void LGapResolver::EmitStackSlotMove(int index) { | 312 void LGapResolver::EmitStackSlotMove(int index) { |
| 311 // We need a temp register to perform a stack slot to stack slot move, and | 313 // We need a temp register to perform a stack slot to stack slot move, and |
| 312 // the register must not be involved in breaking cycles. | 314 // the register must not be involved in breaking cycles. |
| 313 | 315 |
| 314 // Use the Crankshaft double scratch register as the temporary. | 316 // Use the Crankshaft double scratch register as the temporary. |
| 315 DoubleRegister temp = crankshaft_fp_scratch; | 317 DoubleRegister temp = crankshaft_fp_scratch; |
| 316 | 318 |
| 317 LOperand* src = moves_[index].source(); | 319 LOperand* src = moves_[index].source(); |
| 318 LOperand* dst = moves_[index].destination(); | 320 LOperand* dst = moves_[index].destination(); |
| 319 | 321 |
| 320 ASSERT(src->IsStackSlot()); | 322 ASSERT(src->IsStackSlot()); |
| 321 ASSERT(dst->IsStackSlot()); | 323 ASSERT(dst->IsStackSlot()); |
| 322 __ Ldr(temp, cgen_->ToMemOperand(src)); | 324 __ Ldr(temp, cgen_->ToMemOperand(src)); |
| 323 __ Str(temp, cgen_->ToMemOperand(dst)); | 325 __ Str(temp, cgen_->ToMemOperand(dst)); |
| 324 } | 326 } |
| 325 | 327 |
| 326 } } // namespace v8::internal | 328 } } // namespace v8::internal |
| OLD | NEW |