Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(531)

Unified Diff: src/mips64/assembler-mips64-inl.h

Issue 1534183002: MIPS64: r6 compact branch optimization. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/mips64/assembler-mips64-inl.h
diff --git a/src/mips64/assembler-mips64-inl.h b/src/mips64/assembler-mips64-inl.h
index a824ee7fc13c7d38a63a40dd079319c960498e9b..71078352871a1284f3b6e637ab685fe750205078 100644
--- a/src/mips64/assembler-mips64-inl.h
+++ b/src/mips64/assembler-mips64-inl.h
@@ -438,20 +438,40 @@ void Assembler::CheckTrampolinePoolQuick(int extra_instructions) {
}
-void Assembler::emit(Instr x) {
+void Assembler::emit(Instr x, CompactBranchType is_compact_branch) {
if (!is_buffer_growth_blocked()) {
CheckBuffer();
}
+ if (IsPrevInstrCompactBranch()) {
+ if (Instruction::IsForbiddenAfterBranchInstr(x)) {
+ // Nop instruction to preceed a CTI in forbidden slot:
+ Instr nop = SPECIAL | SLL;
+ *reinterpret_cast<Instr*>(pc_) = nop;
+ pc_ += kInstrSize;
+ }
+ ClearCompactBranchState();
+ }
*reinterpret_cast<Instr*>(pc_) = x;
pc_ += kInstrSize;
+ if (is_compact_branch == CompactBranchType::COMPACT_BRANCH) {
+ EmittedCompactBranchInstruction();
+ }
CheckTrampolinePoolQuick();
}
-void Assembler::emit(uint64_t x) {
+void Assembler::emit(uint64_t x, CompactBranchType is_compact_branch) {
if (!is_buffer_growth_blocked()) {
CheckBuffer();
}
+ if (IsPrevInstrCompactBranch()) {
+ // Nop instruction to preceed a CTI in forbidden slot:
Ilija.Pavlovic1 2015/12/18 11:38:22 Missing check IsForbiddenAfterBranchInstr(x)?
balazs.kilvady 2015/12/18 19:18:05 Also when we emitting a 64-bit value that is not a
ivica.bogosavljevic 2015/12/22 10:22:39 There is no need for IsForbiddenAfterBranchInstr(x
balazs.kilvady 2015/12/22 11:01:55 I guess in this case the CPU could not know if the
balazs.kilvady 2016/01/04 13:38:39 I still miss Instruction::IsForbiddenAfterBranchI
+ Instr nop = SPECIAL | SLL;
+ *reinterpret_cast<Instr*>(pc_) = nop;
+ pc_ += kInstrSize;
+
+ ClearCompactBranchState();
+ }
*reinterpret_cast<uint64_t*>(pc_) = x;
pc_ += kInstrSize * 2;
Ilija.Pavlovic1 2015/12/18 11:38:22 Missing check is_compact_branch == COMPACT_BRANCH
balazs.kilvady 2015/12/18 19:18:05 A 64-bit value cannot be a real instruction so it
ivica.bogosavljevic 2015/12/22 10:22:39 Acknowledged.
ivica.bogosavljevic 2015/12/22 10:22:39 Done.
CheckTrampolinePoolQuick();

Powered by Google App Engine
This is Rietveld 408576698