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 | 6 |
7 #include "src/arm/macro-assembler-arm.h" | 7 #include "src/arm/macro-assembler-arm.h" |
8 #include "src/compiler/code-generator-impl.h" | 8 #include "src/compiler/code-generator-impl.h" |
9 #include "src/compiler/gap-resolver.h" | 9 #include "src/compiler/gap-resolver.h" |
10 #include "src/compiler/node-matchers.h" | 10 #include "src/compiler/node-matchers.h" |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 // Fall through. | 494 // Fall through. |
495 case kUnsignedLessThanOrEqual: | 495 case kUnsignedLessThanOrEqual: |
496 __ b(ls, tlabel); | 496 __ b(ls, tlabel); |
497 break; | 497 break; |
498 case kUnorderedGreaterThan: | 498 case kUnorderedGreaterThan: |
499 __ b(vs, tlabel); | 499 __ b(vs, tlabel); |
500 // Fall through. | 500 // Fall through. |
501 case kUnsignedGreaterThan: | 501 case kUnsignedGreaterThan: |
502 __ b(hi, tlabel); | 502 __ b(hi, tlabel); |
503 break; | 503 break; |
| 504 case kOverflow: |
| 505 __ b(vs, tlabel); |
| 506 break; |
| 507 case kNotOverflow: |
| 508 __ b(vc, tlabel); |
| 509 break; |
504 } | 510 } |
505 if (!fallthru) __ b(flabel); // no fallthru to flabel. | 511 if (!fallthru) __ b(flabel); // no fallthru to flabel. |
506 __ bind(&done); | 512 __ bind(&done); |
507 } | 513 } |
508 | 514 |
509 | 515 |
510 // Assembles boolean materializations after an instruction. | 516 // Assembles boolean materializations after an instruction. |
511 void CodeGenerator::AssembleArchBoolean(Instruction* instr, | 517 void CodeGenerator::AssembleArchBoolean(Instruction* instr, |
512 FlagsCondition condition) { | 518 FlagsCondition condition) { |
513 ArmOperandConverter i(this, instr); | 519 ArmOperandConverter i(this, instr); |
514 Label done; | 520 Label done; |
515 | 521 |
516 // Materialize a full 32-bit 1 or 0 value. | 522 // Materialize a full 32-bit 1 or 0 value. The result register is always the |
| 523 // last output of the instruction. |
517 Label check; | 524 Label check; |
518 Register reg = i.OutputRegister(); | 525 ASSERT_NE(0, instr->OutputCount()); |
| 526 Register reg = i.OutputRegister(instr->OutputCount() - 1); |
519 Condition cc = kNoCondition; | 527 Condition cc = kNoCondition; |
520 switch (condition) { | 528 switch (condition) { |
521 case kUnorderedEqual: | 529 case kUnorderedEqual: |
522 __ b(vc, &check); | 530 __ b(vc, &check); |
523 __ mov(reg, Operand(0)); | 531 __ mov(reg, Operand(0)); |
524 __ b(&done); | 532 __ b(&done); |
525 // Fall through. | 533 // Fall through. |
526 case kEqual: | 534 case kEqual: |
527 cc = eq; | 535 cc = eq; |
528 break; | 536 break; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 cc = ls; | 579 cc = ls; |
572 break; | 580 break; |
573 case kUnorderedGreaterThan: | 581 case kUnorderedGreaterThan: |
574 __ b(vc, &check); | 582 __ b(vc, &check); |
575 __ mov(reg, Operand(1)); | 583 __ mov(reg, Operand(1)); |
576 __ b(&done); | 584 __ b(&done); |
577 // Fall through. | 585 // Fall through. |
578 case kUnsignedGreaterThan: | 586 case kUnsignedGreaterThan: |
579 cc = hi; | 587 cc = hi; |
580 break; | 588 break; |
| 589 case kOverflow: |
| 590 cc = vs; |
| 591 break; |
| 592 case kNotOverflow: |
| 593 cc = vc; |
| 594 break; |
581 } | 595 } |
582 __ bind(&check); | 596 __ bind(&check); |
583 __ mov(reg, Operand(0)); | 597 __ mov(reg, Operand(0)); |
584 __ mov(reg, Operand(1), LeaveCC, cc); | 598 __ mov(reg, Operand(1), LeaveCC, cc); |
585 __ bind(&done); | 599 __ bind(&done); |
586 } | 600 } |
587 | 601 |
588 | 602 |
589 void CodeGenerator::AssemblePrologue() { | 603 void CodeGenerator::AssemblePrologue() { |
590 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); | 604 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
825 int end_pc) { | 839 int end_pc) { |
826 return false; | 840 return false; |
827 } | 841 } |
828 | 842 |
829 #endif // DEBUG | 843 #endif // DEBUG |
830 | 844 |
831 #undef __ | 845 #undef __ |
832 } | 846 } |
833 } | 847 } |
834 } // namespace v8::internal::compiler | 848 } // namespace v8::internal::compiler |
OLD | NEW |