OLD | NEW |
1 | 1 |
2 // Copyright (c) 1994-2006 Sun Microsystems Inc. | 2 // Copyright (c) 1994-2006 Sun Microsystems Inc. |
3 // All Rights Reserved. | 3 // All Rights Reserved. |
4 // | 4 // |
5 // Redistribution and use in source and binary forms, with or without | 5 // Redistribution and use in source and binary forms, with or without |
6 // modification, are permitted provided that the following conditions are | 6 // modification, are permitted provided that the following conditions are |
7 // met: | 7 // met: |
8 // | 8 // |
9 // - Redistributions of source code must retain the above copyright notice, | 9 // - Redistributions of source code must retain the above copyright notice, |
10 // this list of conditions and the following disclaimer. | 10 // this list of conditions and the following disclaimer. |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 } | 431 } |
432 | 432 |
433 | 433 |
434 void Assembler::CheckTrampolinePoolQuick(int extra_instructions) { | 434 void Assembler::CheckTrampolinePoolQuick(int extra_instructions) { |
435 if (pc_offset() >= next_buffer_check_ - extra_instructions * kInstrSize) { | 435 if (pc_offset() >= next_buffer_check_ - extra_instructions * kInstrSize) { |
436 CheckTrampolinePool(); | 436 CheckTrampolinePool(); |
437 } | 437 } |
438 } | 438 } |
439 | 439 |
440 | 440 |
441 void Assembler::emit(Instr x) { | 441 void Assembler::emit(Instr x, CompactBranchType is_compact_branch) { |
442 if (!is_buffer_growth_blocked()) { | 442 if (!is_buffer_growth_blocked()) { |
443 CheckBuffer(); | 443 CheckBuffer(); |
444 } | 444 } |
| 445 if (IsPrevInstrCompactBranch()) { |
| 446 if (Instruction::IsForbiddenAfterBranchInstr(x)) { |
| 447 // Nop instruction to preceed a CTI in forbidden slot: |
| 448 Instr nop = SPECIAL | SLL; |
| 449 *reinterpret_cast<Instr*>(pc_) = nop; |
| 450 pc_ += kInstrSize; |
| 451 } |
| 452 ClearCompactBranchState(); |
| 453 } |
445 *reinterpret_cast<Instr*>(pc_) = x; | 454 *reinterpret_cast<Instr*>(pc_) = x; |
446 pc_ += kInstrSize; | 455 pc_ += kInstrSize; |
| 456 if (is_compact_branch == CompactBranchType::COMPACT_BRANCH) { |
| 457 EmittedCompactBranchInstruction(); |
| 458 } |
447 CheckTrampolinePoolQuick(); | 459 CheckTrampolinePoolQuick(); |
448 } | 460 } |
449 | 461 |
450 | 462 |
451 void Assembler::emit(uint64_t x) { | 463 void Assembler::emit(uint64_t x) { |
452 if (!is_buffer_growth_blocked()) { | 464 if (!is_buffer_growth_blocked()) { |
453 CheckBuffer(); | 465 CheckBuffer(); |
454 } | 466 } |
| 467 if (IsPrevInstrCompactBranch()) { |
| 468 // Nop instruction to preceed a CTI in forbidden slot: |
| 469 Instr nop = SPECIAL | SLL; |
| 470 *reinterpret_cast<Instr*>(pc_) = nop; |
| 471 pc_ += kInstrSize; |
| 472 |
| 473 ClearCompactBranchState(); |
| 474 } |
455 *reinterpret_cast<uint64_t*>(pc_) = x; | 475 *reinterpret_cast<uint64_t*>(pc_) = x; |
456 pc_ += kInstrSize * 2; | 476 pc_ += kInstrSize * 2; |
457 CheckTrampolinePoolQuick(); | 477 CheckTrampolinePoolQuick(); |
458 } | 478 } |
459 | 479 |
460 | 480 |
461 } // namespace internal | 481 } // namespace internal |
462 } // namespace v8 | 482 } // namespace v8 |
463 | 483 |
464 #endif // V8_MIPS_ASSEMBLER_MIPS_INL_H_ | 484 #endif // V8_MIPS_ASSEMBLER_MIPS_INL_H_ |
OLD | NEW |