| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 #include "src/compiler/code-generator-impl.h" | 6 #include "src/compiler/code-generator-impl.h" |
| 7 #include "src/compiler/gap-resolver.h" | 7 #include "src/compiler/gap-resolver.h" |
| 8 #include "src/compiler/node-matchers.h" | 8 #include "src/compiler/node-matchers.h" |
| 9 #include "src/compiler/node-properties-inl.h" | 9 #include "src/compiler/node-properties-inl.h" |
| 10 #include "src/mips/macro-assembler-mips.h" | 10 #include "src/mips/macro-assembler-mips.h" |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 } | 470 } |
| 471 } | 471 } |
| 472 | 472 |
| 473 | 473 |
| 474 #define UNSUPPORTED_COND(opcode, condition) \ | 474 #define UNSUPPORTED_COND(opcode, condition) \ |
| 475 OFStream out(stdout); \ | 475 OFStream out(stdout); \ |
| 476 out << "Unsupported " << #opcode << " condition: \"" << condition << "\""; \ | 476 out << "Unsupported " << #opcode << " condition: \"" << condition << "\""; \ |
| 477 UNIMPLEMENTED(); | 477 UNIMPLEMENTED(); |
| 478 | 478 |
| 479 // Assembles branches after an instruction. | 479 // Assembles branches after an instruction. |
| 480 void CodeGenerator::AssembleArchBranch(Instruction* instr, | 480 void CodeGenerator::AssembleArchBranch(Instruction* instr, BranchInfo* branch) { |
| 481 FlagsCondition condition) { | |
| 482 MipsOperandConverter i(this, instr); | 481 MipsOperandConverter i(this, instr); |
| 483 Label* tlabel = branch->true_label; | 482 Label* tlabel = branch->true_label; |
| 484 Label* flabel = branch->false_label; | 483 Label* flabel = branch->false_label; |
| 485 Condition cc = kNoCondition; | 484 Condition cc = kNoCondition; |
| 486 | 485 |
| 487 // MIPS does not have condition code flags, so compare and branch are | 486 // MIPS does not have condition code flags, so compare and branch are |
| 488 // implemented differently than on the other arch's. The compare operations | 487 // implemented differently than on the other arch's. The compare operations |
| 489 // emit mips psuedo-instructions, which are handled here by branch | 488 // emit mips psuedo-instructions, which are handled here by branch |
| 490 // instructions that do the actual comparison. Essential that the input | 489 // instructions that do the actual comparison. Essential that the input |
| 491 // registers to compare psuedo-op are not modified before this branch op, as | 490 // registers to compare psuedo-op are not modified before this branch op, as |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 576 case kUnsignedGreaterThan: | 575 case kUnsignedGreaterThan: |
| 577 cc = hi; | 576 cc = hi; |
| 578 break; | 577 break; |
| 579 default: | 578 default: |
| 580 UNSUPPORTED_COND(kMips64Cmp, branch->condition); | 579 UNSUPPORTED_COND(kMips64Cmp, branch->condition); |
| 581 break; | 580 break; |
| 582 } | 581 } |
| 583 __ Branch(tlabel, cc, i.InputRegister(0), i.InputOperand(1)); | 582 __ Branch(tlabel, cc, i.InputRegister(0), i.InputOperand(1)); |
| 584 | 583 |
| 585 if (!branch->fallthru) __ Branch(flabel); // no fallthru to flabel. | 584 if (!branch->fallthru) __ Branch(flabel); // no fallthru to flabel. |
| 586 __ bind(&done); | |
| 587 | 585 |
| 588 } else if (instr->arch_opcode() == kMips64Cmp32) { | 586 } else if (instr->arch_opcode() == kMips64Cmp32) { |
| 589 switch (branch->condition) { | 587 switch (branch->condition) { |
| 590 case kEqual: | 588 case kEqual: |
| 591 cc = eq; | 589 cc = eq; |
| 592 break; | 590 break; |
| 593 case kNotEqual: | 591 case kNotEqual: |
| 594 cc = ne; | 592 cc = ne; |
| 595 break; | 593 break; |
| 596 case kSignedLessThan: | 594 case kSignedLessThan: |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 647 __ Dext(i.InputRegister(1), i.InputRegister(1), 0, 32); | 645 __ Dext(i.InputRegister(1), i.InputRegister(1), 0, 32); |
| 648 } | 646 } |
| 649 break; | 647 break; |
| 650 default: | 648 default: |
| 651 UNSUPPORTED_COND(kMips64Cmp, branch->condition); | 649 UNSUPPORTED_COND(kMips64Cmp, branch->condition); |
| 652 break; | 650 break; |
| 653 } | 651 } |
| 654 __ Branch(tlabel, cc, i.InputRegister(0), i.InputOperand(1)); | 652 __ Branch(tlabel, cc, i.InputRegister(0), i.InputOperand(1)); |
| 655 | 653 |
| 656 if (!branch->fallthru) __ Branch(flabel); // no fallthru to flabel. | 654 if (!branch->fallthru) __ Branch(flabel); // no fallthru to flabel. |
| 657 __ bind(&done); | |
| 658 } else if (instr->arch_opcode() == kMips64CmpD) { | 655 } else if (instr->arch_opcode() == kMips64CmpD) { |
| 659 // TODO(dusmil) optimize unordered checks to use less instructions | 656 // TODO(dusmil) optimize unordered checks to use less instructions |
| 660 // even if we have to unfold BranchF macro. | 657 // even if we have to unfold BranchF macro. |
| 661 Label* nan = flabel; | 658 Label* nan = flabel; |
| 662 switch (branch->condition) { | 659 switch (branch->condition) { |
| 663 case kUnorderedEqual: | 660 case kUnorderedEqual: |
| 664 cc = eq; | 661 cc = eq; |
| 665 break; | 662 break; |
| 666 case kUnorderedNotEqual: | 663 case kUnorderedNotEqual: |
| 667 cc = ne; | 664 cc = ne; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 682 nan = tlabel; | 679 nan = tlabel; |
| 683 break; | 680 break; |
| 684 default: | 681 default: |
| 685 UNSUPPORTED_COND(kMips64CmpD, branch->condition); | 682 UNSUPPORTED_COND(kMips64CmpD, branch->condition); |
| 686 break; | 683 break; |
| 687 } | 684 } |
| 688 __ BranchF(tlabel, nan, cc, i.InputDoubleRegister(0), | 685 __ BranchF(tlabel, nan, cc, i.InputDoubleRegister(0), |
| 689 i.InputDoubleRegister(1)); | 686 i.InputDoubleRegister(1)); |
| 690 | 687 |
| 691 if (!branch->fallthru) __ Branch(flabel); // no fallthru to flabel. | 688 if (!branch->fallthru) __ Branch(flabel); // no fallthru to flabel. |
| 692 __ bind(&done); | |
| 693 | |
| 694 } else { | 689 } else { |
| 695 PrintF("AssembleArchBranch Unimplemented arch_opcode: %d\n", | 690 PrintF("AssembleArchBranch Unimplemented arch_opcode: %d\n", |
| 696 instr->arch_opcode()); | 691 instr->arch_opcode()); |
| 697 UNIMPLEMENTED(); | 692 UNIMPLEMENTED(); |
| 698 } | 693 } |
| 699 } | 694 } |
| 700 | 695 |
| 701 | 696 |
| 702 void CodeGenerator::AssembleArchJump(BasicBlock::RpoNumber target) { | 697 void CodeGenerator::AssembleArchJump(BasicBlock::RpoNumber target) { |
| 703 if (!IsNextInAssemblyOrder(target)) __ Branch(GetLabel(target)); | 698 if (!IsNextInAssemblyOrder(target)) __ Branch(GetLabel(target)); |
| (...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1216 } | 1211 } |
| 1217 } | 1212 } |
| 1218 MarkLazyDeoptSite(); | 1213 MarkLazyDeoptSite(); |
| 1219 } | 1214 } |
| 1220 | 1215 |
| 1221 #undef __ | 1216 #undef __ |
| 1222 | 1217 |
| 1223 } // namespace compiler | 1218 } // namespace compiler |
| 1224 } // namespace internal | 1219 } // namespace internal |
| 1225 } // namespace v8 | 1220 } // namespace v8 |
| OLD | NEW |