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

Side by Side Diff: src/mips/macro-assembler-mips.cc

Issue 9309077: MIPS: Don't allow large immediates for certain instructions. (Closed)
Patch Set: rebased on r10618. Created 8 years, 10 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 unified diff | Download patch
« no previous file with comments | « src/mips/assembler-mips.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 void MacroAssembler::li(Register rd, Operand j, bool gen2instr) { 764 void MacroAssembler::li(Register rd, Operand j, bool gen2instr) {
765 ASSERT(!j.is_reg()); 765 ASSERT(!j.is_reg());
766 BlockTrampolinePoolScope block_trampoline_pool(this); 766 BlockTrampolinePoolScope block_trampoline_pool(this);
767 if (!MustUseReg(j.rmode_) && !gen2instr) { 767 if (!MustUseReg(j.rmode_) && !gen2instr) {
768 // Normal load of an immediate value which does not need Relocation Info. 768 // Normal load of an immediate value which does not need Relocation Info.
769 if (is_int16(j.imm32_)) { 769 if (is_int16(j.imm32_)) {
770 addiu(rd, zero_reg, j.imm32_); 770 addiu(rd, zero_reg, j.imm32_);
771 } else if (!(j.imm32_ & kHiMask)) { 771 } else if (!(j.imm32_ & kHiMask)) {
772 ori(rd, zero_reg, j.imm32_); 772 ori(rd, zero_reg, j.imm32_);
773 } else if (!(j.imm32_ & kImm16Mask)) { 773 } else if (!(j.imm32_ & kImm16Mask)) {
774 lui(rd, (j.imm32_ & kHiMask) >> kLuiShift); 774 lui(rd, (j.imm32_ >> kLuiShift) & kImm16Mask);
775 } else { 775 } else {
776 lui(rd, (j.imm32_ & kHiMask) >> kLuiShift); 776 lui(rd, (j.imm32_ >> kLuiShift) & kImm16Mask);
777 ori(rd, rd, (j.imm32_ & kImm16Mask)); 777 ori(rd, rd, (j.imm32_ & kImm16Mask));
778 } 778 }
779 } else if (MustUseReg(j.rmode_) || gen2instr) { 779 } else if (MustUseReg(j.rmode_) || gen2instr) {
780 if (MustUseReg(j.rmode_)) { 780 if (MustUseReg(j.rmode_)) {
781 RecordRelocInfo(j.rmode_, j.imm32_); 781 RecordRelocInfo(j.rmode_, j.imm32_);
782 } 782 }
783 // We need always the same number of instructions as we may need to patch 783 // We always need the same number of instructions as we may need to patch
784 // this code to load another value which may need 2 instructions to load. 784 // this code to load another value which may need 2 instructions to load.
785 lui(rd, (j.imm32_ & kHiMask) >> kLuiShift); 785 lui(rd, (j.imm32_ >> kLuiShift) & kImm16Mask);
786 ori(rd, rd, (j.imm32_ & kImm16Mask)); 786 ori(rd, rd, (j.imm32_ & kImm16Mask));
787 } 787 }
788 } 788 }
789 789
790 790
791 void MacroAssembler::MultiPush(RegList regs) { 791 void MacroAssembler::MultiPush(RegList regs) {
792 int16_t num_to_push = NumberOfBitsSet(regs); 792 int16_t num_to_push = NumberOfBitsSet(regs);
793 int16_t stack_offset = num_to_push * kPointerSize; 793 int16_t stack_offset = num_to_push * kPointerSize;
794 794
795 Subu(sp, sp, Operand(stack_offset)); 795 Subu(sp, sp, Operand(stack_offset));
(...skipping 4410 matching lines...) Expand 10 before | Expand all | Expand 10 after
5206 opcode == BGTZL); 5206 opcode == BGTZL);
5207 opcode = (cond == eq) ? BEQ : BNE; 5207 opcode = (cond == eq) ? BEQ : BNE;
5208 instr = (instr & ~kOpcodeMask) | opcode; 5208 instr = (instr & ~kOpcodeMask) | opcode;
5209 masm_.emit(instr); 5209 masm_.emit(instr);
5210 } 5210 }
5211 5211
5212 5212
5213 } } // namespace v8::internal 5213 } } // namespace v8::internal
5214 5214
5215 #endif // V8_TARGET_ARCH_MIPS 5215 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/assembler-mips.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698