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

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

Issue 2816743003: [turbofan] Add alignment parameter to StackSlot operator (Closed)
Patch Set: Small fixes in test Created 3 years, 7 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 | « src/compiler/machine-operator.cc ('k') | src/compiler/mips/instruction-selector-mips.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/mips/code-generator-mips.cc
diff --git a/src/compiler/mips/code-generator-mips.cc b/src/compiler/mips/code-generator-mips.cc
index 476099e5cfedce23c01792ccef2832ab450ffb80..18a8c293e4f1cca4b0a383c68eceea92e4212ab3 100644
--- a/src/compiler/mips/code-generator-mips.cc
+++ b/src/compiler/mips/code-generator-mips.cc
@@ -775,8 +775,35 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
case kArchStackSlot: {
FrameOffset offset =
frame_access_state()->GetFrameOffset(i.InputInt32(0));
- __ Addu(i.OutputRegister(), offset.from_stack_pointer() ? sp : fp,
- Operand(offset.offset()));
+ Register base_reg = offset.from_stack_pointer() ? sp : fp;
+ __ Addu(i.OutputRegister(), base_reg, Operand(offset.offset()));
+ int alignment = i.InputInt32(1);
+ DCHECK(alignment == 0 || alignment == 4 || alignment == 8 ||
+ alignment == 16);
+ if (FLAG_debug_code && alignment > 0) {
+ // Verify that the output_register is properly aligned
+ __ And(kScratchReg, i.OutputRegister(), Operand(kPointerSize - 1));
+ __ Assert(eq, kAllocationIsNotDoubleAligned, kScratchReg,
+ Operand(zero_reg));
+ }
+
+ if (alignment == 2 * kPointerSize) {
+ Label done;
+ __ Addu(kScratchReg, base_reg, Operand(offset.offset()));
+ __ And(kScratchReg, kScratchReg, Operand(alignment - 1));
+ __ BranchShort(&done, eq, kScratchReg, Operand(zero_reg));
+ __ Addu(i.OutputRegister(), i.OutputRegister(), kPointerSize);
+ __ bind(&done);
+ } else if (alignment > 2 * kPointerSize) {
+ Label done;
+ __ Addu(kScratchReg, base_reg, Operand(offset.offset()));
+ __ And(kScratchReg, kScratchReg, Operand(alignment - 1));
+ __ BranchShort(&done, eq, kScratchReg, Operand(zero_reg));
+ __ li(kScratchReg2, alignment);
+ __ Subu(kScratchReg2, kScratchReg2, Operand(kScratchReg));
+ __ Addu(i.OutputRegister(), i.OutputRegister(), kScratchReg2);
+ __ bind(&done);
+ }
break;
}
case kIeee754Float64Acos:
« no previous file with comments | « src/compiler/machine-operator.cc ('k') | src/compiler/mips/instruction-selector-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698