OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/crankshaft/mips/lithium-gap-resolver-mips.h" | 5 #include "src/crankshaft/mips/lithium-gap-resolver-mips.h" |
6 | 6 |
7 #include "src/crankshaft/mips/lithium-codegen-mips.h" | 7 #include "src/crankshaft/mips/lithium-codegen-mips.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 in_cycle_ = true; | 143 in_cycle_ = true; |
144 LOperand* source = moves_[index].source(); | 144 LOperand* source = moves_[index].source(); |
145 saved_destination_ = moves_[index].destination(); | 145 saved_destination_ = moves_[index].destination(); |
146 if (source->IsRegister()) { | 146 if (source->IsRegister()) { |
147 __ mov(kLithiumScratchReg, cgen_->ToRegister(source)); | 147 __ mov(kLithiumScratchReg, cgen_->ToRegister(source)); |
148 } else if (source->IsStackSlot()) { | 148 } else if (source->IsStackSlot()) { |
149 __ lw(kLithiumScratchReg, cgen_->ToMemOperand(source)); | 149 __ lw(kLithiumScratchReg, cgen_->ToMemOperand(source)); |
150 } else if (source->IsDoubleRegister()) { | 150 } else if (source->IsDoubleRegister()) { |
151 __ mov_d(kLithiumScratchDouble, cgen_->ToDoubleRegister(source)); | 151 __ mov_d(kLithiumScratchDouble, cgen_->ToDoubleRegister(source)); |
152 } else if (source->IsDoubleStackSlot()) { | 152 } else if (source->IsDoubleStackSlot()) { |
153 __ ldc1(kLithiumScratchDouble, cgen_->ToMemOperand(source)); | 153 __ Ldc1(kLithiumScratchDouble, cgen_->ToMemOperand(source)); |
154 } else { | 154 } else { |
155 UNREACHABLE(); | 155 UNREACHABLE(); |
156 } | 156 } |
157 // This move will be done by restoring the saved value to the destination. | 157 // This move will be done by restoring the saved value to the destination. |
158 moves_[index].Eliminate(); | 158 moves_[index].Eliminate(); |
159 } | 159 } |
160 | 160 |
161 | 161 |
162 void LGapResolver::RestoreValue() { | 162 void LGapResolver::RestoreValue() { |
163 DCHECK(in_cycle_); | 163 DCHECK(in_cycle_); |
164 DCHECK(saved_destination_ != NULL); | 164 DCHECK(saved_destination_ != NULL); |
165 | 165 |
166 // Spilled value is in kLithiumScratchReg or kLithiumScratchDouble. | 166 // Spilled value is in kLithiumScratchReg or kLithiumScratchDouble. |
167 if (saved_destination_->IsRegister()) { | 167 if (saved_destination_->IsRegister()) { |
168 __ mov(cgen_->ToRegister(saved_destination_), kLithiumScratchReg); | 168 __ mov(cgen_->ToRegister(saved_destination_), kLithiumScratchReg); |
169 } else if (saved_destination_->IsStackSlot()) { | 169 } else if (saved_destination_->IsStackSlot()) { |
170 __ sw(kLithiumScratchReg, cgen_->ToMemOperand(saved_destination_)); | 170 __ sw(kLithiumScratchReg, cgen_->ToMemOperand(saved_destination_)); |
171 } else if (saved_destination_->IsDoubleRegister()) { | 171 } else if (saved_destination_->IsDoubleRegister()) { |
172 __ mov_d(cgen_->ToDoubleRegister(saved_destination_), | 172 __ mov_d(cgen_->ToDoubleRegister(saved_destination_), |
173 kLithiumScratchDouble); | 173 kLithiumScratchDouble); |
174 } else if (saved_destination_->IsDoubleStackSlot()) { | 174 } else if (saved_destination_->IsDoubleStackSlot()) { |
175 __ sdc1(kLithiumScratchDouble, | 175 __ Sdc1(kLithiumScratchDouble, cgen_->ToMemOperand(saved_destination_)); |
176 cgen_->ToMemOperand(saved_destination_)); | |
177 } else { | 176 } else { |
178 UNREACHABLE(); | 177 UNREACHABLE(); |
179 } | 178 } |
180 | 179 |
181 in_cycle_ = false; | 180 in_cycle_ = false; |
182 saved_destination_ = NULL; | 181 saved_destination_ = NULL; |
183 } | 182 } |
184 | 183 |
185 | 184 |
186 void LGapResolver::EmitMove(int index) { | 185 void LGapResolver::EmitMove(int index) { |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 __ sw(kLithiumScratchReg, cgen_->ToMemOperand(destination)); | 251 __ sw(kLithiumScratchReg, cgen_->ToMemOperand(destination)); |
253 } | 252 } |
254 | 253 |
255 } else if (source->IsDoubleRegister()) { | 254 } else if (source->IsDoubleRegister()) { |
256 DoubleRegister source_register = cgen_->ToDoubleRegister(source); | 255 DoubleRegister source_register = cgen_->ToDoubleRegister(source); |
257 if (destination->IsDoubleRegister()) { | 256 if (destination->IsDoubleRegister()) { |
258 __ mov_d(cgen_->ToDoubleRegister(destination), source_register); | 257 __ mov_d(cgen_->ToDoubleRegister(destination), source_register); |
259 } else { | 258 } else { |
260 DCHECK(destination->IsDoubleStackSlot()); | 259 DCHECK(destination->IsDoubleStackSlot()); |
261 MemOperand destination_operand = cgen_->ToMemOperand(destination); | 260 MemOperand destination_operand = cgen_->ToMemOperand(destination); |
262 __ sdc1(source_register, destination_operand); | 261 __ Sdc1(source_register, destination_operand); |
263 } | 262 } |
264 | 263 |
265 } else if (source->IsDoubleStackSlot()) { | 264 } else if (source->IsDoubleStackSlot()) { |
266 MemOperand source_operand = cgen_->ToMemOperand(source); | 265 MemOperand source_operand = cgen_->ToMemOperand(source); |
267 if (destination->IsDoubleRegister()) { | 266 if (destination->IsDoubleRegister()) { |
268 __ ldc1(cgen_->ToDoubleRegister(destination), source_operand); | 267 __ Ldc1(cgen_->ToDoubleRegister(destination), source_operand); |
269 } else { | 268 } else { |
270 DCHECK(destination->IsDoubleStackSlot()); | 269 DCHECK(destination->IsDoubleStackSlot()); |
271 MemOperand destination_operand = cgen_->ToMemOperand(destination); | 270 MemOperand destination_operand = cgen_->ToMemOperand(destination); |
272 if (in_cycle_) { | 271 if (in_cycle_) { |
273 // kLithiumScratchDouble was used to break the cycle, | 272 // kLithiumScratchDouble was used to break the cycle, |
274 // but kLithiumScratchReg is free. | 273 // but kLithiumScratchReg is free. |
275 MemOperand source_high_operand = | 274 MemOperand source_high_operand = |
276 cgen_->ToHighMemOperand(source); | 275 cgen_->ToHighMemOperand(source); |
277 MemOperand destination_high_operand = | 276 MemOperand destination_high_operand = |
278 cgen_->ToHighMemOperand(destination); | 277 cgen_->ToHighMemOperand(destination); |
279 __ lw(kLithiumScratchReg, source_operand); | 278 __ lw(kLithiumScratchReg, source_operand); |
280 __ sw(kLithiumScratchReg, destination_operand); | 279 __ sw(kLithiumScratchReg, destination_operand); |
281 __ lw(kLithiumScratchReg, source_high_operand); | 280 __ lw(kLithiumScratchReg, source_high_operand); |
282 __ sw(kLithiumScratchReg, destination_high_operand); | 281 __ sw(kLithiumScratchReg, destination_high_operand); |
283 } else { | 282 } else { |
284 __ ldc1(kLithiumScratchDouble, source_operand); | 283 __ Ldc1(kLithiumScratchDouble, source_operand); |
285 __ sdc1(kLithiumScratchDouble, destination_operand); | 284 __ Sdc1(kLithiumScratchDouble, destination_operand); |
286 } | 285 } |
287 } | 286 } |
288 } else { | 287 } else { |
289 UNREACHABLE(); | 288 UNREACHABLE(); |
290 } | 289 } |
291 | 290 |
292 moves_[index].Eliminate(); | 291 moves_[index].Eliminate(); |
293 } | 292 } |
294 | 293 |
295 | 294 |
296 #undef __ | 295 #undef __ |
297 | 296 |
298 } // namespace internal | 297 } // namespace internal |
299 } // namespace v8 | 298 } // namespace v8 |
OLD | NEW |