| 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 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 } | 430 } |
| 431 | 431 |
| 432 | 432 |
| 433 void Assembler::CheckTrampolinePoolQuick(int extra_instructions) { | 433 void Assembler::CheckTrampolinePoolQuick(int extra_instructions) { |
| 434 if (pc_offset() >= next_buffer_check_ - extra_instructions * kInstrSize) { | 434 if (pc_offset() >= next_buffer_check_ - extra_instructions * kInstrSize) { |
| 435 CheckTrampolinePool(); | 435 CheckTrampolinePool(); |
| 436 } | 436 } |
| 437 } | 437 } |
| 438 | 438 |
| 439 | 439 |
| 440 void Assembler::emit(Instr x, CompactBranchType is_compact_branch) { | 440 void Assembler::CheckForEmitInForbiddenSlot() { |
| 441 if (!is_buffer_growth_blocked()) { | 441 if (!is_buffer_growth_blocked()) { |
| 442 CheckBuffer(); | 442 CheckBuffer(); |
| 443 } | 443 } |
| 444 if (IsPrevInstrCompactBranch()) { | 444 if (IsPrevInstrCompactBranch()) { |
| 445 // Nop instruction to preceed a CTI in forbidden slot: |
| 446 Instr nop = SPECIAL | SLL; |
| 447 *reinterpret_cast<Instr*>(pc_) = nop; |
| 448 pc_ += kInstrSize; |
| 449 |
| 450 ClearCompactBranchState(); |
| 451 } |
| 452 } |
| 453 |
| 454 |
| 455 void Assembler::EmitHelper(Instr x, CompactBranchType is_compact_branch) { |
| 456 if (IsPrevInstrCompactBranch()) { |
| 445 if (Instruction::IsForbiddenAfterBranchInstr(x)) { | 457 if (Instruction::IsForbiddenAfterBranchInstr(x)) { |
| 446 // Nop instruction to preceed a CTI in forbidden slot: | 458 // Nop instruction to preceed a CTI in forbidden slot: |
| 447 Instr nop = SPECIAL | SLL; | 459 Instr nop = SPECIAL | SLL; |
| 448 *reinterpret_cast<Instr*>(pc_) = nop; | 460 *reinterpret_cast<Instr*>(pc_) = nop; |
| 449 pc_ += kInstrSize; | 461 pc_ += kInstrSize; |
| 450 } | 462 } |
| 451 ClearCompactBranchState(); | 463 ClearCompactBranchState(); |
| 452 } | 464 } |
| 453 *reinterpret_cast<Instr*>(pc_) = x; | 465 *reinterpret_cast<Instr*>(pc_) = x; |
| 454 pc_ += kInstrSize; | 466 pc_ += kInstrSize; |
| 455 if (is_compact_branch == CompactBranchType::COMPACT_BRANCH) { | 467 if (is_compact_branch == CompactBranchType::COMPACT_BRANCH) { |
| 456 EmittedCompactBranchInstruction(); | 468 EmittedCompactBranchInstruction(); |
| 457 } | 469 } |
| 458 CheckTrampolinePoolQuick(); | 470 CheckTrampolinePoolQuick(); |
| 459 } | 471 } |
| 460 | 472 |
| 461 | 473 |
| 474 template <typename T> |
| 475 void Assembler::EmitHelper(T x) { |
| 476 *reinterpret_cast<T*>(pc_) = x; |
| 477 pc_ += sizeof(x); |
| 478 CheckTrampolinePoolQuick(); |
| 479 } |
| 480 |
| 481 |
| 482 void Assembler::emit(Instr x, CompactBranchType is_compact_branch) { |
| 483 if (!is_buffer_growth_blocked()) { |
| 484 CheckBuffer(); |
| 485 } |
| 486 EmitHelper(x, is_compact_branch); |
| 487 } |
| 488 |
| 489 |
| 462 } // namespace internal | 490 } // namespace internal |
| 463 } // namespace v8 | 491 } // namespace v8 |
| 464 | 492 |
| 465 #endif // V8_MIPS_ASSEMBLER_MIPS_INL_H_ | 493 #endif // V8_MIPS_ASSEMBLER_MIPS_INL_H_ |
| OLD | NEW |