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

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

Issue 2542403002: MIPS: Use JIC/JIALC offset when possible (Closed)
Patch Set: Simplify using Call and Jump Created 4 years 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 1919 matching lines...) Expand 10 before | Expand all | Expand 10 after
1930 1930
1931 void Assembler::lui(Register rd, int32_t j) { 1931 void Assembler::lui(Register rd, int32_t j) {
1932 DCHECK(is_uint16(j)); 1932 DCHECK(is_uint16(j));
1933 GenInstrImmediate(LUI, zero_reg, rd, j); 1933 GenInstrImmediate(LUI, zero_reg, rd, j);
1934 } 1934 }
1935 1935
1936 1936
1937 void Assembler::aui(Register rt, Register rs, int32_t j) { 1937 void Assembler::aui(Register rt, Register rs, int32_t j) {
1938 // This instruction uses same opcode as 'lui'. The difference in encoding is 1938 // This instruction uses same opcode as 'lui'. The difference in encoding is
1939 // 'lui' has zero reg. for rs field. 1939 // 'lui' has zero reg. for rs field.
1940 DCHECK(IsMipsArchVariant(kMips32r6));
1940 DCHECK(!(rs.is(zero_reg))); 1941 DCHECK(!(rs.is(zero_reg)));
1941 DCHECK(is_uint16(j)); 1942 DCHECK(is_uint16(j));
1942 GenInstrImmediate(LUI, rs, rt, j); 1943 GenInstrImmediate(LUI, rs, rt, j);
1943 } 1944 }
1944 1945
1945 // ---------PC-Relative instructions----------- 1946 // ---------PC-Relative instructions-----------
1946 1947
1947 void Assembler::addiupc(Register rs, int32_t imm19) { 1948 void Assembler::addiupc(Register rs, int32_t imm19) {
1948 DCHECK(IsMipsArchVariant(kMips32r6)); 1949 DCHECK(IsMipsArchVariant(kMips32r6));
1949 DCHECK(rs.is_valid() && is_int19(imm19)); 1950 DCHECK(rs.is_valid() && is_int19(imm19));
(...skipping 1243 matching lines...) Expand 10 before | Expand all | Expand 10 after
3193 Address Assembler::target_address_at(Address pc) { 3194 Address Assembler::target_address_at(Address pc) {
3194 Instr instr1 = instr_at(pc); 3195 Instr instr1 = instr_at(pc);
3195 Instr instr2 = instr_at(pc + kInstrSize); 3196 Instr instr2 = instr_at(pc + kInstrSize);
3196 // Interpret 2 instructions generated by li: lui/ori 3197 // Interpret 2 instructions generated by li: lui/ori
3197 if (IsLui(instr1) && IsOri(instr2)) { 3198 if (IsLui(instr1) && IsOri(instr2)) {
3198 // Assemble the 32 bit value. 3199 // Assemble the 32 bit value.
3199 return reinterpret_cast<Address>((GetImmediate16(instr1) << kLuiShift) | 3200 return reinterpret_cast<Address>((GetImmediate16(instr1) << kLuiShift) |
3200 GetImmediate16(instr2)); 3201 GetImmediate16(instr2));
3201 } 3202 }
3202 3203
3204 if (IsLui(instr1) && IsJicOrJialc(instr2)) {
3205 // Assemble the 32 bit value.
ivica.bogosavljevic 2016/12/12 13:29:39 You already checked IsLui in the previous if state
3206 return reinterpret_cast<Address>(CreateTargetAddress(instr1, instr2));
3207 }
3208
3203 // We should never get here, force a bad address if we do. 3209 // We should never get here, force a bad address if we do.
3204 UNREACHABLE(); 3210 UNREACHABLE();
3205 return (Address)0x0; 3211 return (Address)0x0;
3206 } 3212 }
3207 3213
3208 3214
3209 // MIPS and ia32 use opposite encoding for qNaN and sNaN, such that ia32 3215 // MIPS and ia32 use opposite encoding for qNaN and sNaN, such that ia32
3210 // qNaN is a MIPS sNaN, and ia32 sNaN is MIPS qNaN. If running from a heap 3216 // qNaN is a MIPS sNaN, and ia32 sNaN is MIPS qNaN. If running from a heap
3211 // snapshot generated on ia32, the resulting MIPS sNaN must be quieted. 3217 // snapshot generated on ia32, the resulting MIPS sNaN must be quieted.
3212 // OS::nan_value() returns a qNaN. 3218 // OS::nan_value() returns a qNaN.
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
3259 3265
3260 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { 3266 if (icache_flush_mode != SKIP_ICACHE_FLUSH) {
3261 Assembler::FlushICache(isolate, pc, 2 * sizeof(int32_t)); 3267 Assembler::FlushICache(isolate, pc, 2 * sizeof(int32_t));
3262 } 3268 }
3263 } 3269 }
3264 3270
3265 } // namespace internal 3271 } // namespace internal
3266 } // namespace v8 3272 } // namespace v8
3267 3273
3268 #endif // V8_TARGET_ARCH_MIPS 3274 #endif // V8_TARGET_ARCH_MIPS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698