OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 } else { | 296 } else { |
297 // Spill on demand to use a temporary register for memory-to-memory | 297 // Spill on demand to use a temporary register for memory-to-memory |
298 // moves. | 298 // moves. |
299 Register tmp = EnsureTempRegister(); | 299 Register tmp = EnsureTempRegister(); |
300 Operand dst = cgen_->ToOperand(destination); | 300 Operand dst = cgen_->ToOperand(destination); |
301 __ mov(tmp, src); | 301 __ mov(tmp, src); |
302 __ mov(dst, tmp); | 302 __ mov(dst, tmp); |
303 } | 303 } |
304 | 304 |
305 } else if (source->IsConstantOperand()) { | 305 } else if (source->IsConstantOperand()) { |
306 ASSERT(destination->IsRegister() || destination->IsStackSlot()); | 306 LConstantOperand* constant_source = LConstantOperand::cast(source); |
307 Immediate src = cgen_->ToImmediate(source); | |
308 if (destination->IsRegister()) { | 307 if (destination->IsRegister()) { |
309 Register dst = cgen_->ToRegister(destination); | 308 Register dst = cgen_->ToRegister(destination); |
310 __ Set(dst, src); | 309 if (cgen_->IsInteger32(constant_source)) { |
| 310 __ Set(dst, cgen_->ToInteger32Immediate(constant_source)); |
| 311 } else { |
| 312 __ LoadObject(dst, cgen_->ToHandle(constant_source)); |
| 313 } |
311 } else { | 314 } else { |
| 315 ASSERT(destination->IsStackSlot()); |
312 Operand dst = cgen_->ToOperand(destination); | 316 Operand dst = cgen_->ToOperand(destination); |
313 __ Set(dst, src); | 317 if (cgen_->IsInteger32(constant_source)) { |
| 318 __ Set(dst, cgen_->ToInteger32Immediate(constant_source)); |
| 319 } else { |
| 320 Register tmp = EnsureTempRegister(); |
| 321 __ LoadObject(tmp, cgen_->ToHandle(constant_source)); |
| 322 __ mov(dst, tmp); |
| 323 } |
314 } | 324 } |
315 | 325 |
316 } else if (source->IsDoubleRegister()) { | 326 } else if (source->IsDoubleRegister()) { |
317 XMMRegister src = cgen_->ToDoubleRegister(source); | 327 XMMRegister src = cgen_->ToDoubleRegister(source); |
318 if (destination->IsDoubleRegister()) { | 328 if (destination->IsDoubleRegister()) { |
319 XMMRegister dst = cgen_->ToDoubleRegister(destination); | 329 XMMRegister dst = cgen_->ToDoubleRegister(destination); |
320 __ movaps(dst, src); | 330 __ movaps(dst, src); |
321 } else { | 331 } else { |
322 ASSERT(destination->IsDoubleStackSlot()); | 332 ASSERT(destination->IsDoubleStackSlot()); |
323 Operand dst = cgen_->ToOperand(destination); | 333 Operand dst = cgen_->ToOperand(destination); |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 } else if (destination->IsRegister()) { | 481 } else if (destination->IsRegister()) { |
472 source_uses_[destination->index()] = CountSourceUses(destination); | 482 source_uses_[destination->index()] = CountSourceUses(destination); |
473 } | 483 } |
474 } | 484 } |
475 | 485 |
476 #undef __ | 486 #undef __ |
477 | 487 |
478 } } // namespace v8::internal | 488 } } // namespace v8::internal |
479 | 489 |
480 #endif // V8_TARGET_ARCH_IA32 | 490 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |