OLD | NEW |
1 // Copyright 2011 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 |
11 // with the distribution. | 11 // with the distribution. |
(...skipping 15 matching lines...) Expand all Loading... |
27 | 27 |
28 #include "v8.h" | 28 #include "v8.h" |
29 | 29 |
30 #include "mips/lithium-gap-resolver-mips.h" | 30 #include "mips/lithium-gap-resolver-mips.h" |
31 #include "mips/lithium-codegen-mips.h" | 31 #include "mips/lithium-codegen-mips.h" |
32 | 32 |
33 namespace v8 { | 33 namespace v8 { |
34 namespace internal { | 34 namespace internal { |
35 | 35 |
36 static const Register kSavedValueRegister = kLithiumScratchReg; | 36 static const Register kSavedValueRegister = kLithiumScratchReg; |
37 static const DoubleRegister kSavedDoubleValueRegister = kLithiumScratchDouble; | |
38 | 37 |
39 LGapResolver::LGapResolver(LCodeGen* owner) | 38 LGapResolver::LGapResolver(LCodeGen* owner) |
40 : cgen_(owner), | 39 : cgen_(owner), |
41 moves_(32), | 40 moves_(32), |
42 root_index_(0), | 41 root_index_(0), |
43 in_cycle_(false), | 42 in_cycle_(false), |
44 saved_destination_(NULL) {} | 43 saved_destination_(NULL) {} |
45 | 44 |
46 | 45 |
47 void LGapResolver::Resolve(LParallelMove* parallel_move) { | 46 void LGapResolver::Resolve(LParallelMove* parallel_move) { |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 ASSERT(moves_[index].destination()->Equals(moves_[root_index_].source())); | 167 ASSERT(moves_[index].destination()->Equals(moves_[root_index_].source())); |
169 ASSERT(!in_cycle_); | 168 ASSERT(!in_cycle_); |
170 in_cycle_ = true; | 169 in_cycle_ = true; |
171 LOperand* source = moves_[index].source(); | 170 LOperand* source = moves_[index].source(); |
172 saved_destination_ = moves_[index].destination(); | 171 saved_destination_ = moves_[index].destination(); |
173 if (source->IsRegister()) { | 172 if (source->IsRegister()) { |
174 __ mov(kSavedValueRegister, cgen_->ToRegister(source)); | 173 __ mov(kSavedValueRegister, cgen_->ToRegister(source)); |
175 } else if (source->IsStackSlot()) { | 174 } else if (source->IsStackSlot()) { |
176 __ lw(kSavedValueRegister, cgen_->ToMemOperand(source)); | 175 __ lw(kSavedValueRegister, cgen_->ToMemOperand(source)); |
177 } else if (source->IsDoubleRegister()) { | 176 } else if (source->IsDoubleRegister()) { |
178 __ mov_d(kSavedDoubleValueRegister, cgen_->ToDoubleRegister(source)); | 177 __ mov_d(kLithiumScratchDouble, cgen_->ToDoubleRegister(source)); |
179 } else if (source->IsDoubleStackSlot()) { | 178 } else if (source->IsDoubleStackSlot()) { |
180 __ ldc1(kSavedDoubleValueRegister, cgen_->ToMemOperand(source)); | 179 __ ldc1(kLithiumScratchDouble, cgen_->ToMemOperand(source)); |
181 } else { | 180 } else { |
182 UNREACHABLE(); | 181 UNREACHABLE(); |
183 } | 182 } |
184 // 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. |
185 moves_[index].Eliminate(); | 184 moves_[index].Eliminate(); |
186 } | 185 } |
187 | 186 |
188 | 187 |
189 void LGapResolver::RestoreValue() { | 188 void LGapResolver::RestoreValue() { |
190 ASSERT(in_cycle_); | 189 ASSERT(in_cycle_); |
191 ASSERT(saved_destination_ != NULL); | 190 ASSERT(saved_destination_ != NULL); |
192 | 191 |
193 // Spilled value is in kSavedValueRegister or kSavedDoubleValueRegister. | 192 // Spilled value is in kSavedValueRegister or kLithiumScratchDouble. |
194 if (saved_destination_->IsRegister()) { | 193 if (saved_destination_->IsRegister()) { |
195 __ mov(cgen_->ToRegister(saved_destination_), kSavedValueRegister); | 194 __ mov(cgen_->ToRegister(saved_destination_), kSavedValueRegister); |
196 } else if (saved_destination_->IsStackSlot()) { | 195 } else if (saved_destination_->IsStackSlot()) { |
197 __ sw(kSavedValueRegister, cgen_->ToMemOperand(saved_destination_)); | 196 __ sw(kSavedValueRegister, cgen_->ToMemOperand(saved_destination_)); |
198 } else if (saved_destination_->IsDoubleRegister()) { | 197 } else if (saved_destination_->IsDoubleRegister()) { |
199 __ mov_d(cgen_->ToDoubleRegister(saved_destination_), | 198 __ mov_d(cgen_->ToDoubleRegister(saved_destination_), |
200 kSavedDoubleValueRegister); | 199 kLithiumScratchDouble); |
201 } else if (saved_destination_->IsDoubleStackSlot()) { | 200 } else if (saved_destination_->IsDoubleStackSlot()) { |
202 __ sdc1(kSavedDoubleValueRegister, | 201 __ sdc1(kLithiumScratchDouble, |
203 cgen_->ToMemOperand(saved_destination_)); | 202 cgen_->ToMemOperand(saved_destination_)); |
204 } else { | 203 } else { |
205 UNREACHABLE(); | 204 UNREACHABLE(); |
206 } | 205 } |
207 | 206 |
208 in_cycle_ = false; | 207 in_cycle_ = false; |
209 saved_destination_ = NULL; | 208 saved_destination_ = NULL; |
210 } | 209 } |
211 | 210 |
212 | 211 |
(...skipping 19 matching lines...) Expand all Loading... |
232 __ lw(cgen_->ToRegister(destination), source_operand); | 231 __ lw(cgen_->ToRegister(destination), source_operand); |
233 } else { | 232 } else { |
234 ASSERT(destination->IsStackSlot()); | 233 ASSERT(destination->IsStackSlot()); |
235 MemOperand destination_operand = cgen_->ToMemOperand(destination); | 234 MemOperand destination_operand = cgen_->ToMemOperand(destination); |
236 if (in_cycle_) { | 235 if (in_cycle_) { |
237 if (!destination_operand.OffsetIsInt16Encodable()) { | 236 if (!destination_operand.OffsetIsInt16Encodable()) { |
238 // 'at' is overwritten while saving the value to the destination. | 237 // 'at' is overwritten while saving the value to the destination. |
239 // Therefore we can't use 'at'. It is OK if the read from the source | 238 // Therefore we can't use 'at'. It is OK if the read from the source |
240 // destroys 'at', since that happens before the value is read. | 239 // destroys 'at', since that happens before the value is read. |
241 // This uses only a single reg of the double reg-pair. | 240 // This uses only a single reg of the double reg-pair. |
242 __ lwc1(kSavedDoubleValueRegister, source_operand); | 241 __ lwc1(kLithiumScratchDouble, source_operand); |
243 __ swc1(kSavedDoubleValueRegister, destination_operand); | 242 __ swc1(kLithiumScratchDouble, destination_operand); |
244 } else { | 243 } else { |
245 __ lw(at, source_operand); | 244 __ lw(at, source_operand); |
246 __ sw(at, destination_operand); | 245 __ sw(at, destination_operand); |
247 } | 246 } |
248 } else { | 247 } else { |
249 __ lw(kSavedValueRegister, source_operand); | 248 __ lw(kSavedValueRegister, source_operand); |
250 __ sw(kSavedValueRegister, destination_operand); | 249 __ sw(kSavedValueRegister, destination_operand); |
251 } | 250 } |
252 } | 251 } |
253 | 252 |
(...skipping 30 matching lines...) Expand all Loading... |
284 } | 283 } |
285 | 284 |
286 } else if (source->IsDoubleStackSlot()) { | 285 } else if (source->IsDoubleStackSlot()) { |
287 MemOperand source_operand = cgen_->ToMemOperand(source); | 286 MemOperand source_operand = cgen_->ToMemOperand(source); |
288 if (destination->IsDoubleRegister()) { | 287 if (destination->IsDoubleRegister()) { |
289 __ ldc1(cgen_->ToDoubleRegister(destination), source_operand); | 288 __ ldc1(cgen_->ToDoubleRegister(destination), source_operand); |
290 } else { | 289 } else { |
291 ASSERT(destination->IsDoubleStackSlot()); | 290 ASSERT(destination->IsDoubleStackSlot()); |
292 MemOperand destination_operand = cgen_->ToMemOperand(destination); | 291 MemOperand destination_operand = cgen_->ToMemOperand(destination); |
293 if (in_cycle_) { | 292 if (in_cycle_) { |
294 // kSavedDoubleValueRegister was used to break the cycle, | 293 // kLithiumScratchDouble was used to break the cycle, |
295 // but kSavedValueRegister is free. | 294 // but kSavedValueRegister is free. |
296 MemOperand source_high_operand = | 295 MemOperand source_high_operand = |
297 cgen_->ToHighMemOperand(source); | 296 cgen_->ToHighMemOperand(source); |
298 MemOperand destination_high_operand = | 297 MemOperand destination_high_operand = |
299 cgen_->ToHighMemOperand(destination); | 298 cgen_->ToHighMemOperand(destination); |
300 __ lw(kSavedValueRegister, source_operand); | 299 __ lw(kSavedValueRegister, source_operand); |
301 __ sw(kSavedValueRegister, destination_operand); | 300 __ sw(kSavedValueRegister, destination_operand); |
302 __ lw(kSavedValueRegister, source_high_operand); | 301 __ lw(kSavedValueRegister, source_high_operand); |
303 __ sw(kSavedValueRegister, destination_high_operand); | 302 __ sw(kSavedValueRegister, destination_high_operand); |
304 } else { | 303 } else { |
305 __ ldc1(kSavedDoubleValueRegister, source_operand); | 304 __ ldc1(kLithiumScratchDouble, source_operand); |
306 __ sdc1(kSavedDoubleValueRegister, destination_operand); | 305 __ sdc1(kLithiumScratchDouble, destination_operand); |
307 } | 306 } |
308 } | 307 } |
309 } else { | 308 } else { |
310 UNREACHABLE(); | 309 UNREACHABLE(); |
311 } | 310 } |
312 | 311 |
313 moves_[index].Eliminate(); | 312 moves_[index].Eliminate(); |
314 } | 313 } |
315 | 314 |
316 | 315 |
317 #undef __ | 316 #undef __ |
318 | 317 |
319 } } // namespace v8::internal | 318 } } // namespace v8::internal |
OLD | NEW |