OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <limits.h> // For LONG_MIN, LONG_MAX. | 5 #include <limits.h> // For LONG_MIN, LONG_MAX. |
6 | 6 |
7 #if V8_TARGET_ARCH_MIPS | 7 #if V8_TARGET_ARCH_MIPS |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/base/division-by-constant.h" | 10 #include "src/base/division-by-constant.h" |
(...skipping 1388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1399 | 1399 |
1400 void MacroAssembler::li(Register rd, Operand j, LiFlags mode) { | 1400 void MacroAssembler::li(Register rd, Operand j, LiFlags mode) { |
1401 DCHECK(!j.is_reg()); | 1401 DCHECK(!j.is_reg()); |
1402 BlockTrampolinePoolScope block_trampoline_pool(this); | 1402 BlockTrampolinePoolScope block_trampoline_pool(this); |
1403 if (!MustUseReg(j.rmode_) && mode == OPTIMIZE_SIZE) { | 1403 if (!MustUseReg(j.rmode_) && mode == OPTIMIZE_SIZE) { |
1404 // Normal load of an immediate value which does not need Relocation Info. | 1404 // Normal load of an immediate value which does not need Relocation Info. |
1405 if (is_int16(j.imm32_)) { | 1405 if (is_int16(j.imm32_)) { |
1406 addiu(rd, zero_reg, j.imm32_); | 1406 addiu(rd, zero_reg, j.imm32_); |
1407 } else if (!(j.imm32_ & kHiMask)) { | 1407 } else if (!(j.imm32_ & kHiMask)) { |
1408 ori(rd, zero_reg, j.imm32_); | 1408 ori(rd, zero_reg, j.imm32_); |
1409 } else if (!(j.imm32_ & kImm16Mask)) { | |
1410 lui(rd, (j.imm32_ >> kLuiShift) & kImm16Mask); | |
1411 } else { | 1409 } else { |
1412 lui(rd, (j.imm32_ >> kLuiShift) & kImm16Mask); | 1410 lui(rd, (j.imm32_ >> kLuiShift) & kImm16Mask); |
1413 ori(rd, rd, (j.imm32_ & kImm16Mask)); | 1411 if (j.imm32_ & kImm16Mask) { |
| 1412 ori(rd, rd, (j.imm32_ & kImm16Mask)); |
| 1413 } |
1414 } | 1414 } |
1415 } else { | 1415 } else { |
1416 if (MustUseReg(j.rmode_)) { | 1416 if (MustUseReg(j.rmode_)) { |
1417 RecordRelocInfo(j.rmode_, j.imm32_); | 1417 RecordRelocInfo(j.rmode_, j.imm32_); |
1418 } | 1418 } |
1419 // We always need the same number of instructions as we may need to patch | 1419 // We always need the same number of instructions as we may need to patch |
1420 // this code to load another value which may need 2 instructions to load. | 1420 // this code to load another value which may need 2 instructions to load. |
1421 lui(rd, (j.imm32_ >> kLuiShift) & kImm16Mask); | 1421 lui(rd, (j.imm32_ >> kLuiShift) & kImm16Mask); |
1422 ori(rd, rd, (j.imm32_ & kImm16Mask)); | 1422 ori(rd, rd, (j.imm32_ & kImm16Mask)); |
1423 } | 1423 } |
(...skipping 5211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6635 if (mag.shift > 0) sra(result, result, mag.shift); | 6635 if (mag.shift > 0) sra(result, result, mag.shift); |
6636 srl(at, dividend, 31); | 6636 srl(at, dividend, 31); |
6637 Addu(result, result, Operand(at)); | 6637 Addu(result, result, Operand(at)); |
6638 } | 6638 } |
6639 | 6639 |
6640 | 6640 |
6641 } // namespace internal | 6641 } // namespace internal |
6642 } // namespace v8 | 6642 } // namespace v8 |
6643 | 6643 |
6644 #endif // V8_TARGET_ARCH_MIPS | 6644 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |