OLD | NEW |
---|---|
1 // Copyright (c) 1994-2006 Sun Microsystems Inc. | 1 // Copyright (c) 1994-2006 Sun Microsystems Inc. |
2 // All Rights Reserved. | 2 // All Rights Reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
6 // met: | 6 // met: |
7 // | 7 // |
8 // - Redistributions of source code must retain the above copyright notice, | 8 // - Redistributions of source code must retain the above copyright notice, |
9 // this list of conditions and the following disclaimer. | 9 // this list of conditions and the following disclaimer. |
10 // | 10 // |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
408 // Note: The same Label can be used for forward and backward branches | 408 // Note: The same Label can be used for forward and backward branches |
409 // but it may be bound only once. | 409 // but it may be bound only once. |
410 void bind(Label* L); // Binds an unbound label L to current code position. | 410 void bind(Label* L); // Binds an unbound label L to current code position. |
411 // Determines if Label is bound and near enough so that branch instruction | 411 // Determines if Label is bound and near enough so that branch instruction |
412 // can be used to reach it, instead of jump instruction. | 412 // can be used to reach it, instead of jump instruction. |
413 bool is_near(Label* L); | 413 bool is_near(Label* L); |
414 | 414 |
415 // Returns the branch offset to the given label from the current code | 415 // Returns the branch offset to the given label from the current code |
416 // position. Links the label to the current position if it is still unbound. | 416 // position. Links the label to the current position if it is still unbound. |
417 // Manages the jump elimination optimization if the second parameter is true. | 417 // Manages the jump elimination optimization if the second parameter is true. |
418 int32_t branch_offset(Label* L, bool jump_elimination_allowed); | 418 int32_t branch_offset_helper(Label* L, bool jump_elimination_allowed, |
419 int32_t branch_offset_compact(Label* L, bool jump_elimination_allowed); | 419 int bits); |
420 int32_t branch_offset21(Label* L, bool jump_elimination_allowed); | 420 int32_t branch_offset(Label* L, bool jump_elimination_allowed) { |
421 int32_t branch_offset21_compact(Label* L, bool jump_elimination_allowed); | 421 return branch_offset_helper(L, jump_elimination_allowed, 16); |
ivica.bogosavljevic
2015/10/15 11:49:08
It would be nice to have these three functions inl
balazs.kilvady
2015/10/30 21:11:14
Done.
| |
422 } | |
423 int32_t branch_offset21(Label* L, bool jump_elimination_allowed) { | |
424 return branch_offset_helper(L, jump_elimination_allowed, 21); | |
425 } | |
426 int32_t branch_offset26(Label* L, bool jump_elimination_allowed) { | |
427 return branch_offset_helper(L, jump_elimination_allowed, 26); | |
428 } | |
422 int32_t shifted_branch_offset(Label* L, bool jump_elimination_allowed) { | 429 int32_t shifted_branch_offset(Label* L, bool jump_elimination_allowed) { |
423 int32_t o = branch_offset(L, jump_elimination_allowed); | 430 return branch_offset(L, jump_elimination_allowed) >> 2; |
424 DCHECK((o & 3) == 0); // Assert the offset is aligned. | |
425 return o >> 2; | |
426 } | 431 } |
427 int32_t shifted_branch_offset_compact(Label* L, | 432 int32_t shifted_branch_offset21(Label* L, bool jump_elimination_allowed) { |
428 bool jump_elimination_allowed) { | 433 return branch_offset21(L, jump_elimination_allowed) >> 2; |
429 int32_t o = branch_offset_compact(L, jump_elimination_allowed); | 434 } |
430 DCHECK((o & 3) == 0); // Assert the offset is aligned. | 435 int32_t shifted_branch_offset26(Label* L, bool jump_elimination_allowed) { |
431 return o >> 2; | 436 return branch_offset26(L, jump_elimination_allowed) >> 2; |
432 } | 437 } |
433 uint32_t jump_address(Label* L); | 438 uint32_t jump_address(Label* L); |
434 | 439 |
435 // Puts a labels target address at the given position. | 440 // Puts a labels target address at the given position. |
436 // The high 8 bits are set to zero. | 441 // The high 8 bits are set to zero. |
437 void label_at_put(Label* L, int at_offset); | 442 void label_at_put(Label* L, int at_offset); |
438 | 443 |
439 // Read/Modify the code target address in the branch/call instruction at pc. | 444 // Read/Modify the code target address in the branch/call instruction at pc. |
440 static Address target_address_at(Address pc); | 445 static Address target_address_at(Address pc); |
441 static void set_target_address_at(Address pc, | 446 static void set_target_address_at(Address pc, |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
564 void nop(unsigned int type = 0) { | 569 void nop(unsigned int type = 0) { |
565 DCHECK(type < 32); | 570 DCHECK(type < 32); |
566 Register nop_rt_reg = (type == 0) ? zero_reg : at; | 571 Register nop_rt_reg = (type == 0) ? zero_reg : at; |
567 sll(zero_reg, nop_rt_reg, type, true); | 572 sll(zero_reg, nop_rt_reg, type, true); |
568 } | 573 } |
569 | 574 |
570 | 575 |
571 // --------Branch-and-jump-instructions---------- | 576 // --------Branch-and-jump-instructions---------- |
572 // We don't use likely variant of instructions. | 577 // We don't use likely variant of instructions. |
573 void b(int16_t offset); | 578 void b(int16_t offset); |
574 void b(Label* L) { b(branch_offset(L, false)>>2); } | 579 void b(Label* L) { b(shifted_branch_offset(L, false)); } |
ivica.bogosavljevic
2015/10/15 11:49:08
Mark inline small functions
balazs.kilvady
2015/10/30 21:11:14
Done.
| |
575 void bal(int16_t offset); | 580 void bal(int16_t offset); |
576 void bal(Label* L) { bal(branch_offset(L, false)>>2); } | 581 void bal(Label* L) { bal(shifted_branch_offset(L, false)); } |
577 void bc(int32_t offset); | 582 void bc(int32_t offset); |
578 void bc(Label* L) { bc(branch_offset(L, false) >> 2); } | 583 void bc(Label* L) { bc(shifted_branch_offset26(L, false)); } |
579 void balc(int32_t offset); | 584 void balc(int32_t offset); |
580 void balc(Label* L) { balc(branch_offset(L, false) >> 2); } | 585 void balc(Label* L) { balc(shifted_branch_offset26(L, false)); } |
581 | 586 |
582 void beq(Register rs, Register rt, int16_t offset); | 587 void beq(Register rs, Register rt, int16_t offset); |
583 void beq(Register rs, Register rt, Label* L) { | 588 void beq(Register rs, Register rt, Label* L) { |
584 beq(rs, rt, branch_offset(L, false) >> 2); | 589 beq(rs, rt, shifted_branch_offset(L, false)); |
585 } | 590 } |
586 void bgez(Register rs, int16_t offset); | 591 void bgez(Register rs, int16_t offset); |
587 void bgezc(Register rt, int16_t offset); | 592 void bgezc(Register rt, int16_t offset); |
588 void bgezc(Register rt, Label* L) { | 593 void bgezc(Register rt, Label* L) { |
589 bgezc(rt, branch_offset_compact(L, false)>>2); | 594 bgezc(rt, shifted_branch_offset(L, false)); |
590 } | 595 } |
591 void bgeuc(Register rs, Register rt, int16_t offset); | 596 void bgeuc(Register rs, Register rt, int16_t offset); |
592 void bgeuc(Register rs, Register rt, Label* L) { | 597 void bgeuc(Register rs, Register rt, Label* L) { |
593 bgeuc(rs, rt, branch_offset_compact(L, false)>>2); | 598 bgeuc(rs, rt, shifted_branch_offset(L, false)); |
594 } | 599 } |
595 void bgec(Register rs, Register rt, int16_t offset); | 600 void bgec(Register rs, Register rt, int16_t offset); |
596 void bgec(Register rs, Register rt, Label* L) { | 601 void bgec(Register rs, Register rt, Label* L) { |
597 bgec(rs, rt, branch_offset_compact(L, false)>>2); | 602 bgec(rs, rt, shifted_branch_offset(L, false)); |
598 } | 603 } |
599 void bgezal(Register rs, int16_t offset); | 604 void bgezal(Register rs, int16_t offset); |
600 void bgezalc(Register rt, int16_t offset); | 605 void bgezalc(Register rt, int16_t offset); |
601 void bgezalc(Register rt, Label* L) { | 606 void bgezalc(Register rt, Label* L) { |
602 bgezalc(rt, branch_offset_compact(L, false)>>2); | 607 bgezalc(rt, shifted_branch_offset(L, false)); |
603 } | 608 } |
604 void bgezall(Register rs, int16_t offset); | 609 void bgezall(Register rs, int16_t offset); |
605 void bgezall(Register rs, Label* L) { | 610 void bgezall(Register rs, Label* L) { |
606 bgezall(rs, branch_offset(L, false)>>2); | 611 bgezall(rs, branch_offset(L, false)>>2); |
607 } | 612 } |
608 void bgtz(Register rs, int16_t offset); | 613 void bgtz(Register rs, int16_t offset); |
609 void bgtzc(Register rt, int16_t offset); | 614 void bgtzc(Register rt, int16_t offset); |
610 void bgtzc(Register rt, Label* L) { | 615 void bgtzc(Register rt, Label* L) { |
611 bgtzc(rt, branch_offset_compact(L, false)>>2); | 616 bgtzc(rt, shifted_branch_offset(L, false)); |
612 } | 617 } |
613 void blez(Register rs, int16_t offset); | 618 void blez(Register rs, int16_t offset); |
614 void blezc(Register rt, int16_t offset); | 619 void blezc(Register rt, int16_t offset); |
615 void blezc(Register rt, Label* L) { | 620 void blezc(Register rt, Label* L) { |
616 blezc(rt, branch_offset_compact(L, false)>>2); | 621 blezc(rt, shifted_branch_offset(L, false)); |
617 } | 622 } |
618 void bltz(Register rs, int16_t offset); | 623 void bltz(Register rs, int16_t offset); |
619 void bltzc(Register rt, int16_t offset); | 624 void bltzc(Register rt, int16_t offset); |
620 void bltzc(Register rt, Label* L) { | 625 void bltzc(Register rt, Label* L) { |
621 bltzc(rt, branch_offset_compact(L, false)>>2); | 626 bltzc(rt, shifted_branch_offset(L, false)); |
622 } | 627 } |
623 void bltuc(Register rs, Register rt, int16_t offset); | 628 void bltuc(Register rs, Register rt, int16_t offset); |
624 void bltuc(Register rs, Register rt, Label* L) { | 629 void bltuc(Register rs, Register rt, Label* L) { |
625 bltuc(rs, rt, branch_offset_compact(L, false)>>2); | 630 bltuc(rs, rt, shifted_branch_offset(L, false)); |
626 } | 631 } |
627 void bltc(Register rs, Register rt, int16_t offset); | 632 void bltc(Register rs, Register rt, int16_t offset); |
628 void bltc(Register rs, Register rt, Label* L) { | 633 void bltc(Register rs, Register rt, Label* L) { |
629 bltc(rs, rt, branch_offset_compact(L, false)>>2); | 634 bltc(rs, rt, shifted_branch_offset(L, false)); |
630 } | 635 } |
631 void bltzal(Register rs, int16_t offset); | 636 void bltzal(Register rs, int16_t offset); |
632 void blezalc(Register rt, int16_t offset); | 637 void blezalc(Register rt, int16_t offset); |
633 void blezalc(Register rt, Label* L) { | 638 void blezalc(Register rt, Label* L) { |
634 blezalc(rt, branch_offset_compact(L, false)>>2); | 639 blezalc(rt, shifted_branch_offset(L, false)); |
635 } | 640 } |
636 void bltzalc(Register rt, int16_t offset); | 641 void bltzalc(Register rt, int16_t offset); |
637 void bltzalc(Register rt, Label* L) { | 642 void bltzalc(Register rt, Label* L) { |
638 bltzalc(rt, branch_offset_compact(L, false)>>2); | 643 bltzalc(rt, shifted_branch_offset(L, false)); |
639 } | 644 } |
640 void bgtzalc(Register rt, int16_t offset); | 645 void bgtzalc(Register rt, int16_t offset); |
641 void bgtzalc(Register rt, Label* L) { | 646 void bgtzalc(Register rt, Label* L) { |
642 bgtzalc(rt, branch_offset_compact(L, false)>>2); | 647 bgtzalc(rt, shifted_branch_offset(L, false)); |
643 } | 648 } |
644 void beqzalc(Register rt, int16_t offset); | 649 void beqzalc(Register rt, int16_t offset); |
645 void beqzalc(Register rt, Label* L) { | 650 void beqzalc(Register rt, Label* L) { |
646 beqzalc(rt, branch_offset_compact(L, false)>>2); | 651 beqzalc(rt, shifted_branch_offset(L, false)); |
647 } | 652 } |
648 void beqc(Register rs, Register rt, int16_t offset); | 653 void beqc(Register rs, Register rt, int16_t offset); |
649 void beqc(Register rs, Register rt, Label* L) { | 654 void beqc(Register rs, Register rt, Label* L) { |
650 beqc(rs, rt, branch_offset_compact(L, false)>>2); | 655 beqc(rs, rt, shifted_branch_offset(L, false)); |
651 } | 656 } |
652 void beqzc(Register rs, int32_t offset); | 657 void beqzc(Register rs, int32_t offset); |
653 void beqzc(Register rs, Label* L) { | 658 void beqzc(Register rs, Label* L) { |
654 beqzc(rs, branch_offset21_compact(L, false)>>2); | 659 beqzc(rs, shifted_branch_offset21(L, false)); |
655 } | 660 } |
656 void bnezalc(Register rt, int16_t offset); | 661 void bnezalc(Register rt, int16_t offset); |
657 void bnezalc(Register rt, Label* L) { | 662 void bnezalc(Register rt, Label* L) { |
658 bnezalc(rt, branch_offset_compact(L, false)>>2); | 663 bnezalc(rt, shifted_branch_offset(L, false)); |
659 } | 664 } |
660 void bnec(Register rs, Register rt, int16_t offset); | 665 void bnec(Register rs, Register rt, int16_t offset); |
661 void bnec(Register rs, Register rt, Label* L) { | 666 void bnec(Register rs, Register rt, Label* L) { |
662 bnec(rs, rt, branch_offset_compact(L, false)>>2); | 667 bnec(rs, rt, shifted_branch_offset(L, false)); |
663 } | 668 } |
664 void bnezc(Register rt, int32_t offset); | 669 void bnezc(Register rt, int32_t offset); |
665 void bnezc(Register rt, Label* L) { | 670 void bnezc(Register rt, Label* L) { |
666 bnezc(rt, branch_offset21_compact(L, false)>>2); | 671 bnezc(rt, shifted_branch_offset21(L, false)); |
667 } | 672 } |
668 void bne(Register rs, Register rt, int16_t offset); | 673 void bne(Register rs, Register rt, int16_t offset); |
669 void bne(Register rs, Register rt, Label* L) { | 674 void bne(Register rs, Register rt, Label* L) { |
670 bne(rs, rt, branch_offset(L, false)>>2); | 675 bne(rs, rt, shifted_branch_offset(L, false)); |
671 } | 676 } |
672 void bovc(Register rs, Register rt, int16_t offset); | 677 void bovc(Register rs, Register rt, int16_t offset); |
673 void bovc(Register rs, Register rt, Label* L) { | 678 void bovc(Register rs, Register rt, Label* L) { |
674 bovc(rs, rt, branch_offset_compact(L, false)>>2); | 679 bovc(rs, rt, shifted_branch_offset(L, false)); |
675 } | 680 } |
676 void bnvc(Register rs, Register rt, int16_t offset); | 681 void bnvc(Register rs, Register rt, int16_t offset); |
677 void bnvc(Register rs, Register rt, Label* L) { | 682 void bnvc(Register rs, Register rt, Label* L) { |
678 bnvc(rs, rt, branch_offset_compact(L, false)>>2); | 683 bnvc(rs, rt, shifted_branch_offset(L, false)); |
679 } | 684 } |
680 | 685 |
681 // Never use the int16_t b(l)cond version with a branch offset | 686 // Never use the int16_t b(l)cond version with a branch offset |
682 // instead of using the Label* version. | 687 // instead of using the Label* version. |
683 | 688 |
684 // Jump targets must be in the current 256 MB-aligned region. i.e. 28 bits. | 689 // Jump targets must be in the current 256 MB-aligned region. i.e. 28 bits. |
685 void j(int32_t target); | 690 void j(int32_t target); |
686 void jal(int32_t target); | 691 void jal(int32_t target); |
687 void jalr(Register rs, Register rd = ra); | 692 void jalr(Register rs, Register rd = ra); |
688 void jr(Register target); | 693 void jr(Register target); |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
914 void cvt_d_s(FPURegister fd, FPURegister fs); | 919 void cvt_d_s(FPURegister fd, FPURegister fs); |
915 | 920 |
916 // Conditions and branches for MIPSr6. | 921 // Conditions and branches for MIPSr6. |
917 void cmp(FPUCondition cond, SecondaryField fmt, | 922 void cmp(FPUCondition cond, SecondaryField fmt, |
918 FPURegister fd, FPURegister ft, FPURegister fs); | 923 FPURegister fd, FPURegister ft, FPURegister fs); |
919 void cmp_s(FPUCondition cond, FPURegister fd, FPURegister fs, FPURegister ft); | 924 void cmp_s(FPUCondition cond, FPURegister fd, FPURegister fs, FPURegister ft); |
920 void cmp_d(FPUCondition cond, FPURegister fd, FPURegister fs, FPURegister ft); | 925 void cmp_d(FPUCondition cond, FPURegister fd, FPURegister fs, FPURegister ft); |
921 | 926 |
922 void bc1eqz(int16_t offset, FPURegister ft); | 927 void bc1eqz(int16_t offset, FPURegister ft); |
923 void bc1eqz(Label* L, FPURegister ft) { | 928 void bc1eqz(Label* L, FPURegister ft) { |
924 bc1eqz(branch_offset(L, false)>>2, ft); | 929 bc1eqz(shifted_branch_offset(L, false), ft); |
925 } | 930 } |
926 void bc1nez(int16_t offset, FPURegister ft); | 931 void bc1nez(int16_t offset, FPURegister ft); |
927 void bc1nez(Label* L, FPURegister ft) { | 932 void bc1nez(Label* L, FPURegister ft) { |
928 bc1nez(branch_offset(L, false)>>2, ft); | 933 bc1nez(shifted_branch_offset(L, false), ft); |
929 } | 934 } |
930 | 935 |
931 // Conditions and branches for non MIPSr6. | 936 // Conditions and branches for non MIPSr6. |
932 void c(FPUCondition cond, SecondaryField fmt, | 937 void c(FPUCondition cond, SecondaryField fmt, |
933 FPURegister ft, FPURegister fs, uint16_t cc = 0); | 938 FPURegister ft, FPURegister fs, uint16_t cc = 0); |
934 void c_s(FPUCondition cond, FPURegister ft, FPURegister fs, uint16_t cc = 0); | 939 void c_s(FPUCondition cond, FPURegister ft, FPURegister fs, uint16_t cc = 0); |
935 void c_d(FPUCondition cond, FPURegister ft, FPURegister fs, uint16_t cc = 0); | 940 void c_d(FPUCondition cond, FPURegister ft, FPURegister fs, uint16_t cc = 0); |
936 | 941 |
937 void bc1f(int16_t offset, uint16_t cc = 0); | 942 void bc1f(int16_t offset, uint16_t cc = 0); |
938 void bc1f(Label* L, uint16_t cc = 0) { bc1f(branch_offset(L, false)>>2, cc); } | 943 void bc1f(Label* L, uint16_t cc = 0) { |
944 bc1f(shifted_branch_offset(L, false), cc); | |
945 } | |
939 void bc1t(int16_t offset, uint16_t cc = 0); | 946 void bc1t(int16_t offset, uint16_t cc = 0); |
940 void bc1t(Label* L, uint16_t cc = 0) { bc1t(branch_offset(L, false)>>2, cc); } | 947 void bc1t(Label* L, uint16_t cc = 0) { |
948 bc1t(shifted_branch_offset(L, false), cc); | |
949 } | |
941 void fcmp(FPURegister src1, const double src2, FPUCondition cond); | 950 void fcmp(FPURegister src1, const double src2, FPUCondition cond); |
942 | 951 |
943 // Check the code size generated from label to here. | 952 // Check the code size generated from label to here. |
944 int SizeOfCodeGeneratedSince(Label* label) { | 953 int SizeOfCodeGeneratedSince(Label* label) { |
945 return pc_offset() - label->pos(); | 954 return pc_offset() - label->pos(); |
946 } | 955 } |
947 | 956 |
948 // Check the number of instructions generated from label to here. | 957 // Check the number of instructions generated from label to here. |
949 int InstructionsGeneratedSince(Label* label) { | 958 int InstructionsGeneratedSince(Label* label) { |
950 return SizeOfCodeGeneratedSince(label) / kInstrSize; | 959 return SizeOfCodeGeneratedSince(label) / kInstrSize; |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1049 static void instr_at_put(byte* pc, Instr instr) { | 1058 static void instr_at_put(byte* pc, Instr instr) { |
1050 *reinterpret_cast<Instr*>(pc) = instr; | 1059 *reinterpret_cast<Instr*>(pc) = instr; |
1051 } | 1060 } |
1052 Instr instr_at(int pos) { return *reinterpret_cast<Instr*>(buffer_ + pos); } | 1061 Instr instr_at(int pos) { return *reinterpret_cast<Instr*>(buffer_ + pos); } |
1053 void instr_at_put(int pos, Instr instr) { | 1062 void instr_at_put(int pos, Instr instr) { |
1054 *reinterpret_cast<Instr*>(buffer_ + pos) = instr; | 1063 *reinterpret_cast<Instr*>(buffer_ + pos) = instr; |
1055 } | 1064 } |
1056 | 1065 |
1057 // Check if an instruction is a branch of some kind. | 1066 // Check if an instruction is a branch of some kind. |
1058 static bool IsBranch(Instr instr); | 1067 static bool IsBranch(Instr instr); |
1068 static bool IsBc(Instr instr); | |
1069 static bool IsBzc(Instr instr); | |
1059 static bool IsBeq(Instr instr); | 1070 static bool IsBeq(Instr instr); |
1060 static bool IsBne(Instr instr); | 1071 static bool IsBne(Instr instr); |
1072 static bool IsBeqzc(Instr instr); | |
1073 static bool IsBnezc(Instr instr); | |
1074 static bool IsBeqc(Instr instr); | |
1075 static bool IsBnec(Instr instr); | |
1061 | 1076 |
1062 static bool IsJump(Instr instr); | 1077 static bool IsJump(Instr instr); |
1063 static bool IsJ(Instr instr); | 1078 static bool IsJ(Instr instr); |
1064 static bool IsLui(Instr instr); | 1079 static bool IsLui(Instr instr); |
1065 static bool IsOri(Instr instr); | 1080 static bool IsOri(Instr instr); |
1066 | 1081 |
1067 static bool IsJal(Instr instr); | 1082 static bool IsJal(Instr instr); |
1068 static bool IsJr(Instr instr); | 1083 static bool IsJr(Instr instr); |
1069 static bool IsJalr(Instr instr); | 1084 static bool IsJalr(Instr instr); |
1070 | 1085 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1172 | 1187 |
1173 void EndBlockGrowBuffer() { | 1188 void EndBlockGrowBuffer() { |
1174 DCHECK(block_buffer_growth_); | 1189 DCHECK(block_buffer_growth_); |
1175 block_buffer_growth_ = false; | 1190 block_buffer_growth_ = false; |
1176 } | 1191 } |
1177 | 1192 |
1178 bool is_buffer_growth_blocked() const { | 1193 bool is_buffer_growth_blocked() const { |
1179 return block_buffer_growth_; | 1194 return block_buffer_growth_; |
1180 } | 1195 } |
1181 | 1196 |
1197 bool IsPrevInstrCompactBranch() { return prev_instr_compact_branch_; } | |
1198 | |
1182 private: | 1199 private: |
1183 inline static void set_target_internal_reference_encoded_at(Address pc, | 1200 inline static void set_target_internal_reference_encoded_at(Address pc, |
1184 Address target); | 1201 Address target); |
1185 | 1202 |
1186 // Buffer size and constant pool distance are checked together at regular | 1203 // Buffer size and constant pool distance are checked together at regular |
1187 // intervals of kBufferCheckInterval emitted bytes. | 1204 // intervals of kBufferCheckInterval emitted bytes. |
1188 static const int kBufferCheckInterval = 1*KB/2; | 1205 static const int kBufferCheckInterval = 1*KB/2; |
1189 | 1206 |
1190 // Code generation. | 1207 // Code generation. |
1191 // The relocation writer's position is at least kGap bytes below the end of | 1208 // The relocation writer's position is at least kGap bytes below the end of |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1358 int32_t get_trampoline_entry(int32_t pos); | 1375 int32_t get_trampoline_entry(int32_t pos); |
1359 int unbound_labels_count_; | 1376 int unbound_labels_count_; |
1360 // If trampoline is emitted, generated code is becoming large. As this is | 1377 // If trampoline is emitted, generated code is becoming large. As this is |
1361 // already a slow case which can possibly break our code generation for the | 1378 // already a slow case which can possibly break our code generation for the |
1362 // extreme case, we use this information to trigger different mode of | 1379 // extreme case, we use this information to trigger different mode of |
1363 // branch instruction generation, where we use jump instructions rather | 1380 // branch instruction generation, where we use jump instructions rather |
1364 // than regular branch instructions. | 1381 // than regular branch instructions. |
1365 bool trampoline_emitted_; | 1382 bool trampoline_emitted_; |
1366 static const int kTrampolineSlotsSize = 4 * kInstrSize; | 1383 static const int kTrampolineSlotsSize = 4 * kInstrSize; |
1367 static const int kMaxBranchOffset = (1 << (18 - 1)) - 1; | 1384 static const int kMaxBranchOffset = (1 << (18 - 1)) - 1; |
1385 static const int kMaxCompactBranchOffset = (1 << (28 - 1)) - 1; | |
1368 static const int kInvalidSlotPos = -1; | 1386 static const int kInvalidSlotPos = -1; |
1369 | 1387 |
1370 // Internal reference positions, required for unbounded internal reference | 1388 // Internal reference positions, required for unbounded internal reference |
1371 // labels. | 1389 // labels. |
1372 std::set<int> internal_reference_positions_; | 1390 std::set<int> internal_reference_positions_; |
1373 | 1391 |
1392 void EmittedCompactBranchInstruction() { prev_instr_compact_branch_ = true; } | |
ivica.bogosavljevic
2015/10/15 11:49:08
The names of the functions EmittedCompactBranchIns
balazs.kilvady
2015/10/30 21:11:14
I don't agree, please discuss it with Paul.
| |
1393 void ClearCompactBranchState() { prev_instr_compact_branch_ = false; } | |
1394 bool prev_instr_compact_branch_ = false; | |
1395 | |
1374 Trampoline trampoline_; | 1396 Trampoline trampoline_; |
1375 bool internal_trampoline_exception_; | 1397 bool internal_trampoline_exception_; |
1376 | 1398 |
1377 friend class RegExpMacroAssemblerMIPS; | 1399 friend class RegExpMacroAssemblerMIPS; |
1378 friend class RelocInfo; | 1400 friend class RelocInfo; |
1379 friend class CodePatcher; | 1401 friend class CodePatcher; |
1380 friend class BlockTrampolinePoolScope; | 1402 friend class BlockTrampolinePoolScope; |
1381 | 1403 |
1382 PositionsRecorder positions_recorder_; | 1404 PositionsRecorder positions_recorder_; |
1383 friend class PositionsRecorder; | 1405 friend class PositionsRecorder; |
1384 friend class EnsureSpace; | 1406 friend class EnsureSpace; |
1385 }; | 1407 }; |
1386 | 1408 |
1387 | 1409 |
1388 class EnsureSpace BASE_EMBEDDED { | 1410 class EnsureSpace BASE_EMBEDDED { |
1389 public: | 1411 public: |
1390 explicit EnsureSpace(Assembler* assembler) { | 1412 explicit EnsureSpace(Assembler* assembler) { |
1391 assembler->CheckBuffer(); | 1413 assembler->CheckBuffer(); |
1392 } | 1414 } |
1393 }; | 1415 }; |
1394 | 1416 |
1395 } // namespace internal | 1417 } // namespace internal |
1396 } // namespace v8 | 1418 } // namespace v8 |
1397 | 1419 |
1398 #endif // V8_ARM_ASSEMBLER_MIPS_H_ | 1420 #endif // V8_ARM_ASSEMBLER_MIPS_H_ |
OLD | NEW |