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

Side by Side Diff: src/mips/assembler-mips-inl.h

Issue 1573983002: MIPS: Replace JR/JALR with JIC/JIALC for r6 (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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') | src/mips/macro-assembler-mips.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 // Copyright (c) 1994-2006 Sun Microsystems Inc. 2 // Copyright (c) 1994-2006 Sun Microsystems Inc.
3 // All Rights Reserved. 3 // All Rights Reserved.
4 // 4 //
5 // Redistribution and use in source and binary forms, with or without 5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are 6 // modification, are permitted provided that the following conditions are
7 // met: 7 // met:
8 // 8 //
9 // - Redistributions of source code must retain the above copyright notice, 9 // - Redistributions of source code must retain the above copyright notice,
10 // this list of conditions and the following disclaimer. 10 // this list of conditions and the following disclaimer.
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 } 153 }
154 154
155 155
156 Address Assembler::target_address_from_return_address(Address pc) { 156 Address Assembler::target_address_from_return_address(Address pc) {
157 return pc - kCallTargetAddressOffset; 157 return pc - kCallTargetAddressOffset;
158 } 158 }
159 159
160 160
161 void Assembler::set_target_internal_reference_encoded_at(Address pc, 161 void Assembler::set_target_internal_reference_encoded_at(Address pc,
162 Address target) { 162 Address target) {
163 // Encoded internal references are lui/ori load of 32-bit abolute address. 163 Instr instr1 = Assembler::instr_at(pc + 0 * Assembler::kInstrSize);
164 Instr instr_lui = Assembler::instr_at(pc + 0 * Assembler::kInstrSize); 164 Instr instr2 = Assembler::instr_at(pc + 1 * Assembler::kInstrSize);
165 Instr instr_ori = Assembler::instr_at(pc + 1 * Assembler::kInstrSize); 165 DCHECK(Assembler::IsLui(instr1));
166 DCHECK(Assembler::IsLui(instr_lui)); 166 DCHECK(Assembler::IsOri(instr2) || Assembler::IsJicOrJialc(instr2));
167 DCHECK(Assembler::IsOri(instr_ori)); 167 instr1 &= ~kImm16Mask;
168 instr_lui &= ~kImm16Mask; 168 instr2 &= ~kImm16Mask;
169 instr_ori &= ~kImm16Mask;
170 int32_t imm = reinterpret_cast<int32_t>(target); 169 int32_t imm = reinterpret_cast<int32_t>(target);
171 DCHECK((imm & 3) == 0); 170 DCHECK((imm & 3) == 0);
172 Assembler::instr_at_put(pc + 0 * Assembler::kInstrSize, 171 if (Assembler::IsJicOrJialc(instr2)) {
173 instr_lui | ((imm >> kLuiShift) & kImm16Mask)); 172 // Encoded internal references are lui/jic load of 32-bit absolute address.
174 Assembler::instr_at_put(pc + 1 * Assembler::kInstrSize, 173 uint32_t lui_offset_u, jic_offset_u;
175 instr_ori | (imm & kImm16Mask)); 174 Assembler::UnpackTargetAddressUnsigned(imm, lui_offset_u, jic_offset_u);
175
176 Assembler::instr_at_put(pc + 0 * Assembler::kInstrSize,
177 instr1 | lui_offset_u);
178 Assembler::instr_at_put(pc + 1 * Assembler::kInstrSize,
179 instr2 | jic_offset_u);
180 } else {
181 // Encoded internal references are lui/ori load of 32-bit absolute address.
182 Assembler::instr_at_put(pc + 0 * Assembler::kInstrSize,
183 instr1 | ((imm >> kLuiShift) & kImm16Mask));
184 Assembler::instr_at_put(pc + 1 * Assembler::kInstrSize,
185 instr2 | (imm & kImm16Mask));
186 }
176 187
177 // Currently used only by deserializer, and all code will be flushed 188 // Currently used only by deserializer, and all code will be flushed
178 // after complete deserialization, no need to flush on each reference. 189 // after complete deserialization, no need to flush on each reference.
179 } 190 }
180 191
181 192
182 void Assembler::deserialization_set_target_internal_reference_at( 193 void Assembler::deserialization_set_target_internal_reference_at(
183 Isolate* isolate, Address pc, Address target, RelocInfo::Mode mode) { 194 Isolate* isolate, Address pc, Address target, RelocInfo::Mode mode) {
184 if (mode == RelocInfo::INTERNAL_REFERENCE_ENCODED) { 195 if (mode == RelocInfo::INTERNAL_REFERENCE_ENCODED) {
185 DCHECK(IsLui(instr_at(pc))); 196 DCHECK(IsLui(instr_at(pc)));
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 Address RelocInfo::target_external_reference() { 234 Address RelocInfo::target_external_reference() {
224 DCHECK(rmode_ == EXTERNAL_REFERENCE); 235 DCHECK(rmode_ == EXTERNAL_REFERENCE);
225 return Assembler::target_address_at(pc_, host_); 236 return Assembler::target_address_at(pc_, host_);
226 } 237 }
227 238
228 239
229 Address RelocInfo::target_internal_reference() { 240 Address RelocInfo::target_internal_reference() {
230 if (rmode_ == INTERNAL_REFERENCE) { 241 if (rmode_ == INTERNAL_REFERENCE) {
231 return Memory::Address_at(pc_); 242 return Memory::Address_at(pc_);
232 } else { 243 } else {
233 // Encoded internal references are lui/ori load of 32-bit abolute address. 244 // Encoded internal references are lui/ori or lui/jic load of 32-bit
245 // absolute address.
234 DCHECK(rmode_ == INTERNAL_REFERENCE_ENCODED); 246 DCHECK(rmode_ == INTERNAL_REFERENCE_ENCODED);
235 Instr instr_lui = Assembler::instr_at(pc_ + 0 * Assembler::kInstrSize); 247 Instr instr1 = Assembler::instr_at(pc_ + 0 * Assembler::kInstrSize);
236 Instr instr_ori = Assembler::instr_at(pc_ + 1 * Assembler::kInstrSize); 248 Instr instr2 = Assembler::instr_at(pc_ + 1 * Assembler::kInstrSize);
237 DCHECK(Assembler::IsLui(instr_lui)); 249 DCHECK(Assembler::IsLui(instr1));
238 DCHECK(Assembler::IsOri(instr_ori)); 250 DCHECK(Assembler::IsOri(instr2) || Assembler::IsJicOrJialc(instr2));
239 int32_t imm = (instr_lui & static_cast<int32_t>(kImm16Mask)) << kLuiShift; 251 if (Assembler::IsJicOrJialc(instr2)) {
240 imm |= (instr_ori & static_cast<int32_t>(kImm16Mask)); 252 return reinterpret_cast<Address>(
253 Assembler::CreateTargetAddress(instr1, instr2));
254 }
255 int32_t imm = (instr1 & static_cast<int32_t>(kImm16Mask)) << kLuiShift;
256 imm |= (instr2 & static_cast<int32_t>(kImm16Mask));
241 return reinterpret_cast<Address>(imm); 257 return reinterpret_cast<Address>(imm);
242 } 258 }
243 } 259 }
244 260
245 261
246 Address RelocInfo::target_internal_reference_address() { 262 Address RelocInfo::target_internal_reference_address() {
247 DCHECK(rmode_ == INTERNAL_REFERENCE || rmode_ == INTERNAL_REFERENCE_ENCODED); 263 DCHECK(rmode_ == INTERNAL_REFERENCE || rmode_ == INTERNAL_REFERENCE_ENCODED);
248 return reinterpret_cast<Address>(pc_); 264 return reinterpret_cast<Address>(pc_);
249 } 265 }
250 266
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 CheckBuffer(); 479 CheckBuffer();
464 } 480 }
465 EmitHelper(x, is_compact_branch); 481 EmitHelper(x, is_compact_branch);
466 } 482 }
467 483
468 484
469 } // namespace internal 485 } // namespace internal
470 } // namespace v8 486 } // namespace v8
471 487
472 #endif // V8_MIPS_ASSEMBLER_MIPS_INL_H_ 488 #endif // V8_MIPS_ASSEMBLER_MIPS_INL_H_
OLDNEW
« no previous file with comments | « src/mips/assembler-mips.cc ('k') | src/mips/macro-assembler-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698