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

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

Issue 2542403002: MIPS: Use JIC/JIALC offset when possible (Closed)
Patch Set: Fix deserialization problem, rebase to master 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 1994-2006 Sun Microsystems Inc. 1 // Copyright (c) 1994-2006 Sun Microsystems Inc.
2 // All Rights Reserved. 2 // All Rights Reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // - Redistributions of source code must retain the above copyright notice, 8 // - Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer. 9 // this list of conditions and the following disclaimer.
10 // 10 //
(...skipping 2059 matching lines...) Expand 10 before | Expand all | Expand 10 after
2070 2070
2071 void Assembler::lui(Register rd, int32_t j) { 2071 void Assembler::lui(Register rd, int32_t j) {
2072 DCHECK(is_uint16(j)); 2072 DCHECK(is_uint16(j));
2073 GenInstrImmediate(LUI, zero_reg, rd, j); 2073 GenInstrImmediate(LUI, zero_reg, rd, j);
2074 } 2074 }
2075 2075
2076 2076
2077 void Assembler::aui(Register rt, Register rs, int32_t j) { 2077 void Assembler::aui(Register rt, Register rs, int32_t j) {
2078 // This instruction uses same opcode as 'lui'. The difference in encoding is 2078 // This instruction uses same opcode as 'lui'. The difference in encoding is
2079 // 'lui' has zero reg. for rs field. 2079 // 'lui' has zero reg. for rs field.
2080 DCHECK(IsMipsArchVariant(kMips32r6));
2080 DCHECK(!(rs.is(zero_reg))); 2081 DCHECK(!(rs.is(zero_reg)));
2081 DCHECK(is_uint16(j)); 2082 DCHECK(is_uint16(j));
2082 GenInstrImmediate(LUI, rs, rt, j); 2083 GenInstrImmediate(LUI, rs, rt, j);
2083 } 2084 }
2084 2085
2085 // ---------PC-Relative instructions----------- 2086 // ---------PC-Relative instructions-----------
2086 2087
2087 void Assembler::addiupc(Register rs, int32_t imm19) { 2088 void Assembler::addiupc(Register rs, int32_t imm19) {
2088 DCHECK(IsMipsArchVariant(kMips32r6)); 2089 DCHECK(IsMipsArchVariant(kMips32r6));
2089 DCHECK(rs.is_valid() && is_int19(imm19)); 2090 DCHECK(rs.is_valid() && is_int19(imm19));
(...skipping 1649 matching lines...) Expand 10 before | Expand all | Expand 10 after
3739 next_buffer_check_ = pc_offset() + 3740 next_buffer_check_ = pc_offset() +
3740 kMaxBranchOffset - kTrampolineSlotsSize * 16; 3741 kMaxBranchOffset - kTrampolineSlotsSize * 16;
3741 } 3742 }
3742 return; 3743 return;
3743 } 3744 }
3744 3745
3745 3746
3746 Address Assembler::target_address_at(Address pc) { 3747 Address Assembler::target_address_at(Address pc) {
3747 Instr instr1 = instr_at(pc); 3748 Instr instr1 = instr_at(pc);
3748 Instr instr2 = instr_at(pc + kInstrSize); 3749 Instr instr2 = instr_at(pc + kInstrSize);
3749 // Interpret 2 instructions generated by li: lui/ori 3750 // Interpret 2 instructions generated by li (lui/ori) or optimized pairs
3750 if (IsLui(instr1) && IsOri(instr2)) { 3751 // lui/jic, aui/jic or lui/jialc.
3751 // Assemble the 32 bit value. 3752 if (IsLui(instr1)) {
3752 return reinterpret_cast<Address>((GetImmediate16(instr1) << kLuiShift) | 3753 if (IsOri(instr2)) {
3753 GetImmediate16(instr2)); 3754 // Assemble the 32 bit value.
3755 return reinterpret_cast<Address>((GetImmediate16(instr1) << kLuiShift) |
3756 GetImmediate16(instr2));
3757 } else if (IsJicOrJialc(instr2)) {
3758 // Assemble the 32 bit value.
3759 return reinterpret_cast<Address>(CreateTargetAddress(instr1, instr2));
3760 }
3754 } 3761 }
3755 3762
3756 // We should never get here, force a bad address if we do. 3763 // We should never get here, force a bad address if we do.
3757 UNREACHABLE(); 3764 UNREACHABLE();
3758 return (Address)0x0; 3765 return (Address)0x0;
3759 } 3766 }
3760 3767
3761 3768
3762 // MIPS and ia32 use opposite encoding for qNaN and sNaN, such that ia32 3769 // MIPS and ia32 use opposite encoding for qNaN and sNaN, such that ia32
3763 // qNaN is a MIPS sNaN, and ia32 sNaN is MIPS qNaN. If running from a heap 3770 // qNaN is a MIPS sNaN, and ia32 sNaN is MIPS qNaN. If running from a heap
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
3814 3821
3815 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { 3822 if (icache_flush_mode != SKIP_ICACHE_FLUSH) {
3816 Assembler::FlushICache(isolate, pc, 2 * sizeof(int32_t)); 3823 Assembler::FlushICache(isolate, pc, 2 * sizeof(int32_t));
3817 } 3824 }
3818 } 3825 }
3819 3826
3820 } // namespace internal 3827 } // namespace internal
3821 } // namespace v8 3828 } // namespace v8
3822 3829
3823 #endif // V8_TARGET_ARCH_MIPS 3830 #endif // V8_TARGET_ARCH_MIPS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698