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 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 | 455 |
456 // The link chain is terminated by a value in the instruction of -1, | 456 // The link chain is terminated by a value in the instruction of -1, |
457 // which is an otherwise illegal value (branch -1 is inf loop). | 457 // which is an otherwise illegal value (branch -1 is inf loop). |
458 // The instruction 16-bit offset field addresses 32-bit words, but in | 458 // The instruction 16-bit offset field addresses 32-bit words, but in |
459 // code is conv to an 18-bit value addressing bytes, hence the -4 value. | 459 // code is conv to an 18-bit value addressing bytes, hence the -4 value. |
460 | 460 |
461 const int kEndOfChain = -4; | 461 const int kEndOfChain = -4; |
462 // Determines the end of the Jump chain (a subset of the label link chain). | 462 // Determines the end of the Jump chain (a subset of the label link chain). |
463 const int kEndOfJumpChain = 0; | 463 const int kEndOfJumpChain = 0; |
464 | 464 |
| 465 bool Assembler::IsMsaBranch(Instr instr) { |
| 466 uint32_t opcode = GetOpcodeField(instr); |
| 467 uint32_t rs_field = GetRsField(instr); |
| 468 if (opcode == COP1) { |
| 469 switch (rs_field) { |
| 470 case BZ_V: |
| 471 case BZ_B: |
| 472 case BZ_H: |
| 473 case BZ_W: |
| 474 case BZ_D: |
| 475 case BNZ_V: |
| 476 case BNZ_B: |
| 477 case BNZ_H: |
| 478 case BNZ_W: |
| 479 case BNZ_D: |
| 480 return true; |
| 481 default: |
| 482 return false; |
| 483 } |
| 484 } else { |
| 485 return false; |
| 486 } |
| 487 } |
465 | 488 |
466 bool Assembler::IsBranch(Instr instr) { | 489 bool Assembler::IsBranch(Instr instr) { |
467 uint32_t opcode = GetOpcodeField(instr); | 490 uint32_t opcode = GetOpcodeField(instr); |
468 uint32_t rt_field = GetRtField(instr); | 491 uint32_t rt_field = GetRtField(instr); |
469 uint32_t rs_field = GetRsField(instr); | 492 uint32_t rs_field = GetRsField(instr); |
470 // Checks if the instruction is a branch. | 493 // Checks if the instruction is a branch. |
471 bool isBranch = | 494 bool isBranch = |
472 opcode == BEQ || opcode == BNE || opcode == BLEZ || opcode == BGTZ || | 495 opcode == BEQ || opcode == BNE || opcode == BLEZ || opcode == BGTZ || |
473 opcode == BEQL || opcode == BNEL || opcode == BLEZL || opcode == BGTZL || | 496 opcode == BEQL || opcode == BNEL || opcode == BLEZL || opcode == BGTZL || |
474 (opcode == REGIMM && (rt_field == BLTZ || rt_field == BGEZ || | 497 (opcode == REGIMM && (rt_field == BLTZ || rt_field == BGEZ || |
475 rt_field == BLTZAL || rt_field == BGEZAL)) || | 498 rt_field == BLTZAL || rt_field == BGEZAL)) || |
476 (opcode == COP1 && rs_field == BC1) || // Coprocessor branch. | 499 (opcode == COP1 && rs_field == BC1) || // Coprocessor branch. |
477 (opcode == COP1 && rs_field == BC1EQZ) || | 500 (opcode == COP1 && rs_field == BC1EQZ) || |
478 (opcode == COP1 && rs_field == BC1NEZ); | 501 (opcode == COP1 && rs_field == BC1NEZ) || IsMsaBranch(instr); |
479 if (!isBranch && kArchVariant == kMips64r6) { | 502 if (!isBranch && kArchVariant == kMips64r6) { |
480 // All the 3 variants of POP10 (BOVC, BEQC, BEQZALC) and | 503 // All the 3 variants of POP10 (BOVC, BEQC, BEQZALC) and |
481 // POP30 (BNVC, BNEC, BNEZALC) are branch ops. | 504 // POP30 (BNVC, BNEC, BNEZALC) are branch ops. |
482 isBranch |= opcode == POP10 || opcode == POP30 || opcode == BC || | 505 isBranch |= opcode == POP10 || opcode == POP30 || opcode == BC || |
483 opcode == BALC || | 506 opcode == BALC || |
484 (opcode == POP66 && rs_field != 0) || // BEQZC | 507 (opcode == POP66 && rs_field != 0) || // BEQZC |
485 (opcode == POP76 && rs_field != 0); // BNEZC | 508 (opcode == POP76 && rs_field != 0); // BNEZC |
486 } | 509 } |
487 return isBranch; | 510 return isBranch; |
488 } | 511 } |
(...skipping 3665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4154 | 4177 |
4155 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { | 4178 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { |
4156 Assembler::FlushICache(isolate, pc, 4 * Assembler::kInstrSize); | 4179 Assembler::FlushICache(isolate, pc, 4 * Assembler::kInstrSize); |
4157 } | 4180 } |
4158 } | 4181 } |
4159 | 4182 |
4160 } // namespace internal | 4183 } // namespace internal |
4161 } // namespace v8 | 4184 } // namespace v8 |
4162 | 4185 |
4163 #endif // V8_TARGET_ARCH_MIPS64 | 4186 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |