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 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 | 472 |
473 // The link chain is terminated by a value in the instruction of -1, | 473 // The link chain is terminated by a value in the instruction of -1, |
474 // which is an otherwise illegal value (branch -1 is inf loop). | 474 // which is an otherwise illegal value (branch -1 is inf loop). |
475 // The instruction 16-bit offset field addresses 32-bit words, but in | 475 // The instruction 16-bit offset field addresses 32-bit words, but in |
476 // code is conv to an 18-bit value addressing bytes, hence the -4 value. | 476 // code is conv to an 18-bit value addressing bytes, hence the -4 value. |
477 | 477 |
478 const int kEndOfChain = -4; | 478 const int kEndOfChain = -4; |
479 // Determines the end of the Jump chain (a subset of the label link chain). | 479 // Determines the end of the Jump chain (a subset of the label link chain). |
480 const int kEndOfJumpChain = 0; | 480 const int kEndOfJumpChain = 0; |
481 | 481 |
| 482 bool Assembler::IsMsaBranch(Instr instr) { |
| 483 uint32_t opcode = GetOpcodeField(instr); |
| 484 uint32_t rs_field = GetRsField(instr); |
| 485 if (opcode == COP1) { |
| 486 switch (rs_field) { |
| 487 case BZ_V: |
| 488 case BZ_B: |
| 489 case BZ_H: |
| 490 case BZ_W: |
| 491 case BZ_D: |
| 492 case BNZ_V: |
| 493 case BNZ_B: |
| 494 case BNZ_H: |
| 495 case BNZ_W: |
| 496 case BNZ_D: |
| 497 return true; |
| 498 default: |
| 499 return false; |
| 500 } |
| 501 } else { |
| 502 return false; |
| 503 } |
| 504 } |
482 | 505 |
483 bool Assembler::IsBranch(Instr instr) { | 506 bool Assembler::IsBranch(Instr instr) { |
484 uint32_t opcode = GetOpcodeField(instr); | 507 uint32_t opcode = GetOpcodeField(instr); |
485 uint32_t rt_field = GetRtField(instr); | 508 uint32_t rt_field = GetRtField(instr); |
486 uint32_t rs_field = GetRsField(instr); | 509 uint32_t rs_field = GetRsField(instr); |
487 // Checks if the instruction is a branch. | 510 // Checks if the instruction is a branch. |
488 bool isBranch = | 511 bool isBranch = |
489 opcode == BEQ || opcode == BNE || opcode == BLEZ || opcode == BGTZ || | 512 opcode == BEQ || opcode == BNE || opcode == BLEZ || opcode == BGTZ || |
490 opcode == BEQL || opcode == BNEL || opcode == BLEZL || opcode == BGTZL || | 513 opcode == BEQL || opcode == BNEL || opcode == BLEZL || opcode == BGTZL || |
491 (opcode == REGIMM && (rt_field == BLTZ || rt_field == BGEZ || | 514 (opcode == REGIMM && (rt_field == BLTZ || rt_field == BGEZ || |
492 rt_field == BLTZAL || rt_field == BGEZAL)) || | 515 rt_field == BLTZAL || rt_field == BGEZAL)) || |
493 (opcode == COP1 && rs_field == BC1) || // Coprocessor branch. | 516 (opcode == COP1 && rs_field == BC1) || // Coprocessor branch. |
494 (opcode == COP1 && rs_field == BC1EQZ) || | 517 (opcode == COP1 && rs_field == BC1EQZ) || |
495 (opcode == COP1 && rs_field == BC1NEZ); | 518 (opcode == COP1 && rs_field == BC1NEZ) || IsMsaBranch(instr); |
496 if (!isBranch && IsMipsArchVariant(kMips32r6)) { | 519 if (!isBranch && IsMipsArchVariant(kMips32r6)) { |
497 // All the 3 variants of POP10 (BOVC, BEQC, BEQZALC) and | 520 // All the 3 variants of POP10 (BOVC, BEQC, BEQZALC) and |
498 // POP30 (BNVC, BNEC, BNEZALC) are branch ops. | 521 // POP30 (BNVC, BNEC, BNEZALC) are branch ops. |
499 isBranch |= opcode == POP10 || opcode == POP30 || opcode == BC || | 522 isBranch |= opcode == POP10 || opcode == POP30 || opcode == BC || |
500 opcode == BALC || | 523 opcode == BALC || |
501 (opcode == POP66 && rs_field != 0) || // BEQZC | 524 (opcode == POP66 && rs_field != 0) || // BEQZC |
502 (opcode == POP76 && rs_field != 0); // BNEZC | 525 (opcode == POP76 && rs_field != 0); // BNEZC |
503 } | 526 } |
504 return isBranch; | 527 return isBranch; |
505 } | 528 } |
(...skipping 3319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3825 | 3848 |
3826 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { | 3849 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { |
3827 Assembler::FlushICache(isolate, pc, 2 * sizeof(int32_t)); | 3850 Assembler::FlushICache(isolate, pc, 2 * sizeof(int32_t)); |
3828 } | 3851 } |
3829 } | 3852 } |
3830 | 3853 |
3831 } // namespace internal | 3854 } // namespace internal |
3832 } // namespace v8 | 3855 } // namespace v8 |
3833 | 3856 |
3834 #endif // V8_TARGET_ARCH_MIPS | 3857 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |