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

Unified Diff: src/compiler/mips64/code-generator-mips64.cc

Issue 1628453002: MIPS: Use PC realitive instructions on r6. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 11 months 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
« no previous file with comments | « no previous file | src/mips/macro-assembler-mips.h » ('j') | test/cctest/test-macro-assembler-mips64.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/mips64/code-generator-mips64.cc
diff --git a/src/compiler/mips64/code-generator-mips64.cc b/src/compiler/mips64/code-generator-mips64.cc
index 1b81aa569808a05aed90d94ee8305f38c81c3c12..c0dc5f5ada2d2eedf5ab2e72b8f2b3558e2c1838 100644
--- a/src/compiler/mips64/code-generator-mips64.cc
+++ b/src/compiler/mips64/code-generator-mips64.cc
@@ -1653,17 +1653,28 @@ void CodeGenerator::AssembleArchTableSwitch(Instruction* instr) {
MipsOperandConverter i(this, instr);
Register input = i.InputRegister(0);
size_t const case_count = instr->InputCount() - 2;
- Label here;
__ Branch(GetLabel(i.InputRpo(1)), hs, input, Operand(case_count));
__ BlockTrampolinePoolFor(static_cast<int>(case_count) * 2 + 7);
- // Ensure that dd-ed labels use 8 byte aligned addresses.
- __ Align(8);
- __ bal(&here);
- __ dsll(at, input, 3); // Branch delay slot.
- __ bind(&here);
- __ daddu(at, at, ra);
- __ ld(at, MemOperand(at, 4 * v8::internal::Assembler::kInstrSize));
+ // Ensure that dd-ed labels use 8 bytes aligned addresses.
+ if (kArchVariant >= kMips64r6) {
ivica.bogosavljevic 2016/01/25 11:40:03 Also, I am not sure if this is a best way to do t
balazs.kilvady 2016/01/25 12:46:17 if (VERSION >= 7) {} code is quite common in sever
+ // Opposite of Align(8) as we have unaligned number of instructions before
+ // the first dd().
+ if ((masm()->pc_offset() & 7) == 0) {
ivica.bogosavljevic 2016/01/25 11:40:03 I think you should call Align(8) + additional nop(
balazs.kilvady 2016/01/25 12:46:17 I don't think so. We don't need 1 or 2 nops as add
ivica.bogosavljevic 2016/01/26 08:32:29 I am not sure what to think about this. On one han
balazs.kilvady 2016/01/26 18:40:05 I see.
+ __ nop();
+ }
+ __ addiupc(at, 5);
+ __ dlsa(at, at, input, 3);
+ __ ld(at, MemOperand(at));
+ } else {
+ Label here;
+ __ Align(8);
+ __ bal(&here);
+ __ dsll(at, input, 3); // Branch delay slot.
+ __ bind(&here);
+ __ daddu(at, at, ra);
+ __ ld(at, MemOperand(at, 4 * v8::internal::Assembler::kInstrSize));
+ }
__ jr(at);
__ nop(); // Branch delay slot nop.
for (size_t index = 0; index < case_count; ++index) {
« no previous file with comments | « no previous file | src/mips/macro-assembler-mips.h » ('j') | test/cctest/test-macro-assembler-mips64.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698