OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/compiler/code-generator.h" | 5 #include "src/compiler/code-generator.h" |
6 | 6 |
7 #include "src/compiler/code-generator-impl.h" | 7 #include "src/compiler/code-generator-impl.h" |
8 #include "src/compiler/gap-resolver.h" | 8 #include "src/compiler/gap-resolver.h" |
9 #include "src/compiler/node-matchers.h" | 9 #include "src/compiler/node-matchers.h" |
10 #include "src/compiler/node-properties-inl.h" | 10 #include "src/compiler/node-properties-inl.h" |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 if (input.type == kRegister) { | 384 if (input.type == kRegister) { |
385 __ pushq(input.reg); | 385 __ pushq(input.reg); |
386 } else { | 386 } else { |
387 __ pushq(input.operand); | 387 __ pushq(input.operand); |
388 } | 388 } |
389 break; | 389 break; |
390 } | 390 } |
391 case kX64PushI: | 391 case kX64PushI: |
392 __ pushq(i.InputImmediate(0)); | 392 __ pushq(i.InputImmediate(0)); |
393 break; | 393 break; |
394 case kX64Movl: { | |
395 RegisterOrOperand input = i.InputRegisterOrOperand(0); | |
396 if (input.type == kRegister) { | |
397 __ movl(i.OutputRegister(), input.reg); | |
398 } else { | |
399 __ movl(i.OutputRegister(), input.operand); | |
400 } | |
401 break; | |
402 } | |
403 case kX64Movsxlq: { | |
404 RegisterOrOperand input = i.InputRegisterOrOperand(0); | |
405 if (input.type == kRegister) { | |
406 __ movsxlq(i.OutputRegister(), input.reg); | |
407 } else { | |
408 __ movsxlq(i.OutputRegister(), input.operand); | |
409 } | |
410 break; | |
411 } | |
412 case kX64CallCodeObject: { | 394 case kX64CallCodeObject: { |
413 if (HasImmediateInput(instr, 0)) { | 395 if (HasImmediateInput(instr, 0)) { |
414 Handle<Code> code = Handle<Code>::cast(i.InputHeapObject(0)); | 396 Handle<Code> code = Handle<Code>::cast(i.InputHeapObject(0)); |
415 __ Call(code, RelocInfo::CODE_TARGET); | 397 __ Call(code, RelocInfo::CODE_TARGET); |
416 } else { | 398 } else { |
417 Register reg = i.InputRegister(0); | 399 Register reg = i.InputRegister(0); |
418 int entry = Code::kHeaderSize - kHeapObjectTag; | 400 int entry = Code::kHeaderSize - kHeapObjectTag; |
419 __ Call(Operand(reg, entry)); | 401 __ Call(Operand(reg, entry)); |
420 } | 402 } |
421 | 403 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 __ cvtlsi2sd(i.OutputDoubleRegister(), input.operand); | 507 __ cvtlsi2sd(i.OutputDoubleRegister(), input.operand); |
526 } | 508 } |
527 break; | 509 break; |
528 } | 510 } |
529 case kSSEUint32ToFloat64: { | 511 case kSSEUint32ToFloat64: { |
530 // TODO(turbofan): X64 SSE cvtqsi2sd should support operands. | 512 // TODO(turbofan): X64 SSE cvtqsi2sd should support operands. |
531 __ cvtqsi2sd(i.OutputDoubleRegister(), i.InputRegister(0)); | 513 __ cvtqsi2sd(i.OutputDoubleRegister(), i.InputRegister(0)); |
532 break; | 514 break; |
533 } | 515 } |
534 | 516 |
535 case kSSELoad: | 517 case kX64Movsd: |
536 __ movsd(i.OutputDoubleRegister(), i.MemoryOperand()); | 518 if (instr->HasOutput()) { |
| 519 __ movsd(i.OutputDoubleRegister(), i.MemoryOperand()); |
| 520 } else { |
| 521 int index = 0; |
| 522 Operand operand = i.MemoryOperand(&index); |
| 523 __ movsd(operand, i.InputDoubleRegister(index)); |
| 524 } |
537 break; | 525 break; |
538 case kSSEStore: { | 526 case kX64Movsxbl: |
| 527 __ movsxbl(i.OutputRegister(), i.MemoryOperand()); |
| 528 break; |
| 529 case kX64Movzxbl: |
| 530 __ movzxbl(i.OutputRegister(), i.MemoryOperand()); |
| 531 break; |
| 532 case kX64Movb: { |
539 int index = 0; | 533 int index = 0; |
540 Operand operand = i.MemoryOperand(&index); | 534 Operand operand = i.MemoryOperand(&index); |
541 __ movsd(operand, i.InputDoubleRegister(index)); | 535 if (HasImmediateInput(instr, index)) { |
| 536 __ movb(operand, Immediate(i.InputInt8(index))); |
| 537 } else { |
| 538 __ movb(operand, i.InputRegister(index)); |
| 539 } |
542 break; | 540 break; |
543 } | 541 } |
544 case kX64LoadWord8: | 542 case kX64Movsxwl: |
545 __ movzxbl(i.OutputRegister(), i.MemoryOperand()); | 543 __ movsxwl(i.OutputRegister(), i.MemoryOperand()); |
546 break; | 544 break; |
547 case kX64StoreWord8: { | 545 case kX64Movzxwl: |
| 546 __ movzxwl(i.OutputRegister(), i.MemoryOperand()); |
| 547 break; |
| 548 case kX64Movw: { |
548 int index = 0; | 549 int index = 0; |
549 Operand operand = i.MemoryOperand(&index); | 550 Operand operand = i.MemoryOperand(&index); |
550 __ movb(operand, i.InputRegister(index)); | 551 if (HasImmediateInput(instr, index)) { |
| 552 __ movw(operand, Immediate(i.InputInt16(index))); |
| 553 } else { |
| 554 __ movw(operand, i.InputRegister(index)); |
| 555 } |
551 break; | 556 break; |
552 } | 557 } |
553 case kX64StoreWord8I: { | 558 case kX64Movl: |
554 int index = 0; | 559 if (instr->HasOutput()) { |
555 Operand operand = i.MemoryOperand(&index); | 560 if (instr->addressing_mode() == kMode_None) { |
556 __ movb(operand, Immediate(i.InputInt8(index))); | 561 RegisterOrOperand input = i.InputRegisterOrOperand(0); |
| 562 if (input.type == kRegister) { |
| 563 __ movl(i.OutputRegister(), input.reg); |
| 564 } else { |
| 565 __ movl(i.OutputRegister(), input.operand); |
| 566 } |
| 567 } else { |
| 568 __ movl(i.OutputRegister(), i.MemoryOperand()); |
| 569 } |
| 570 } else { |
| 571 int index = 0; |
| 572 Operand operand = i.MemoryOperand(&index); |
| 573 if (HasImmediateInput(instr, index)) { |
| 574 __ movl(operand, i.InputImmediate(index)); |
| 575 } else { |
| 576 __ movl(operand, i.InputRegister(index)); |
| 577 } |
| 578 } |
| 579 break; |
| 580 case kX64Movsxlq: { |
| 581 RegisterOrOperand input = i.InputRegisterOrOperand(0); |
| 582 if (input.type == kRegister) { |
| 583 __ movsxlq(i.OutputRegister(), input.reg); |
| 584 } else { |
| 585 __ movsxlq(i.OutputRegister(), input.operand); |
| 586 } |
557 break; | 587 break; |
558 } | 588 } |
559 case kX64LoadWord16: | 589 case kX64Movq: |
560 __ movzxwl(i.OutputRegister(), i.MemoryOperand()); | 590 if (instr->HasOutput()) { |
| 591 __ movq(i.OutputRegister(), i.MemoryOperand()); |
| 592 } else { |
| 593 int index = 0; |
| 594 Operand operand = i.MemoryOperand(&index); |
| 595 if (HasImmediateInput(instr, index)) { |
| 596 __ movq(operand, i.InputImmediate(index)); |
| 597 } else { |
| 598 __ movq(operand, i.InputRegister(index)); |
| 599 } |
| 600 } |
561 break; | 601 break; |
562 case kX64StoreWord16: { | |
563 int index = 0; | |
564 Operand operand = i.MemoryOperand(&index); | |
565 __ movw(operand, i.InputRegister(index)); | |
566 break; | |
567 } | |
568 case kX64StoreWord16I: { | |
569 int index = 0; | |
570 Operand operand = i.MemoryOperand(&index); | |
571 __ movw(operand, Immediate(i.InputInt16(index))); | |
572 break; | |
573 } | |
574 case kX64LoadWord32: | |
575 __ movl(i.OutputRegister(), i.MemoryOperand()); | |
576 break; | |
577 case kX64StoreWord32: { | |
578 int index = 0; | |
579 Operand operand = i.MemoryOperand(&index); | |
580 __ movl(operand, i.InputRegister(index)); | |
581 break; | |
582 } | |
583 case kX64StoreWord32I: { | |
584 int index = 0; | |
585 Operand operand = i.MemoryOperand(&index); | |
586 __ movl(operand, i.InputImmediate(index)); | |
587 break; | |
588 } | |
589 case kX64LoadWord64: | |
590 __ movq(i.OutputRegister(), i.MemoryOperand()); | |
591 break; | |
592 case kX64StoreWord64: { | |
593 int index = 0; | |
594 Operand operand = i.MemoryOperand(&index); | |
595 __ movq(operand, i.InputRegister(index)); | |
596 break; | |
597 } | |
598 case kX64StoreWord64I: { | |
599 int index = 0; | |
600 Operand operand = i.MemoryOperand(&index); | |
601 __ movq(operand, i.InputImmediate(index)); | |
602 break; | |
603 } | |
604 case kX64StoreWriteBarrier: { | 602 case kX64StoreWriteBarrier: { |
605 Register object = i.InputRegister(0); | 603 Register object = i.InputRegister(0); |
606 Register index = i.InputRegister(1); | 604 Register index = i.InputRegister(1); |
607 Register value = i.InputRegister(2); | 605 Register value = i.InputRegister(2); |
608 __ movsxlq(index, index); | 606 __ movsxlq(index, index); |
609 __ movq(Operand(object, index, times_1, 0), value); | 607 __ movq(Operand(object, index, times_1, 0), value); |
610 __ leaq(index, Operand(object, index, times_1, 0)); | 608 __ leaq(index, Operand(object, index, times_1, 0)); |
611 SaveFPRegsMode mode = code_->frame()->DidAllocateDoubleRegisters() | 609 SaveFPRegsMode mode = code_->frame()->DidAllocateDoubleRegisters() |
612 ? kSaveFPRegs | 610 ? kSaveFPRegs |
613 : kDontSaveFPRegs; | 611 : kDontSaveFPRegs; |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
994 } | 992 } |
995 | 993 |
996 | 994 |
997 void CodeGenerator::AddNopForSmiCodeInlining() { __ nop(); } | 995 void CodeGenerator::AddNopForSmiCodeInlining() { __ nop(); } |
998 | 996 |
999 #undef __ | 997 #undef __ |
1000 | 998 |
1001 } // namespace internal | 999 } // namespace internal |
1002 } // namespace compiler | 1000 } // namespace compiler |
1003 } // namespace v8 | 1001 } // namespace v8 |
OLD | NEW |