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