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

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

Issue 1025453003: MIPS: Fix 'MIPS: Serializer: serialize internal references via object visitor.' (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix comment. Created 5 years, 9 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.h ('k') | src/mips64/assembler-mips64.h » ('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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 Address Assembler::target_address_from_return_address(Address pc) { 193 Address Assembler::target_address_from_return_address(Address pc) {
194 return pc - kCallTargetAddressOffset; 194 return pc - kCallTargetAddressOffset;
195 } 195 }
196 196
197 197
198 Address Assembler::break_address_from_return_address(Address pc) { 198 Address Assembler::break_address_from_return_address(Address pc) {
199 return pc - Assembler::kPatchDebugBreakSlotReturnOffset; 199 return pc - Assembler::kPatchDebugBreakSlotReturnOffset;
200 } 200 }
201 201
202 202
203 void Assembler::set_target_internal_reference_encoded_at(Address pc,
204 Address target) {
205 // Encoded internal references are lui/ori load of 32-bit abolute address.
206 Instr instr_lui = Assembler::instr_at(pc + 0 * Assembler::kInstrSize);
207 Instr instr_ori = Assembler::instr_at(pc + 1 * Assembler::kInstrSize);
208 DCHECK(Assembler::IsLui(instr_lui));
209 DCHECK(Assembler::IsOri(instr_ori));
210 instr_lui &= ~kImm16Mask;
211 instr_ori &= ~kImm16Mask;
212 int32_t imm = reinterpret_cast<int32_t>(target);
213 DCHECK((imm & 3) == 0);
214 Assembler::instr_at_put(pc + 0 * Assembler::kInstrSize,
215 instr_lui | ((imm >> kLuiShift) & kImm16Mask));
216 Assembler::instr_at_put(pc + 1 * Assembler::kInstrSize,
217 instr_ori | (imm & kImm16Mask));
218
219 // Currently used only by deserializer, and all code will be flushed
220 // after complete deserialization, no need to flush on each reference.
221 }
222
223
203 void Assembler::deserialization_set_target_internal_reference_at( 224 void Assembler::deserialization_set_target_internal_reference_at(
204 Address pc, Address target) { 225 Address pc, Address target, RelocInfo::Mode mode) {
205 if (IsLui(instr_at(pc))) { 226 if (mode == RelocInfo::INTERNAL_REFERENCE_ENCODED) {
206 // Encoded internal references are lui/ori load of 32-bit abolute address. 227 DCHECK(IsLui(instr_at(pc)));
207 Instr instr_lui = Assembler::instr_at(pc + 0 * Assembler::kInstrSize); 228 set_target_internal_reference_encoded_at(pc, target);
208 Instr instr_ori = Assembler::instr_at(pc + 1 * Assembler::kInstrSize);
209 DCHECK(Assembler::IsLui(instr_lui));
210 DCHECK(Assembler::IsOri(instr_ori));
211 instr_lui &= ~kImm16Mask;
212 instr_ori &= ~kImm16Mask;
213 int32_t imm = reinterpret_cast<int32_t>(target);
214 DCHECK((imm & 3) == 0);
215 Assembler::instr_at_put(pc + 0 * Assembler::kInstrSize,
216 instr_lui | ((imm >> kLuiShift) & kImm16Mask));
217 Assembler::instr_at_put(pc + 1 * Assembler::kInstrSize,
218 instr_ori | (imm & kImm16Mask));
219 } else { 229 } else {
230 DCHECK(mode == RelocInfo::INTERNAL_REFERENCE);
220 Memory::Address_at(pc) = target; 231 Memory::Address_at(pc) = target;
221 } 232 }
222 } 233 }
223 234
224 235
225 Object* RelocInfo::target_object() { 236 Object* RelocInfo::target_object() {
226 DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); 237 DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
227 return reinterpret_cast<Object*>(Assembler::target_address_at(pc_, host_)); 238 return reinterpret_cast<Object*>(Assembler::target_address_at(pc_, host_));
228 } 239 }
229 240
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 } 401 }
391 402
392 403
393 void RelocInfo::WipeOut() { 404 void RelocInfo::WipeOut() {
394 DCHECK(IsEmbeddedObject(rmode_) || IsCodeTarget(rmode_) || 405 DCHECK(IsEmbeddedObject(rmode_) || IsCodeTarget(rmode_) ||
395 IsRuntimeEntry(rmode_) || IsExternalReference(rmode_) || 406 IsRuntimeEntry(rmode_) || IsExternalReference(rmode_) ||
396 IsInternalReference(rmode_) || IsInternalReferenceEncoded(rmode_)); 407 IsInternalReference(rmode_) || IsInternalReferenceEncoded(rmode_));
397 if (IsInternalReference(rmode_)) { 408 if (IsInternalReference(rmode_)) {
398 Memory::Address_at(pc_) = NULL; 409 Memory::Address_at(pc_) = NULL;
399 } else if (IsInternalReferenceEncoded(rmode_)) { 410 } else if (IsInternalReferenceEncoded(rmode_)) {
400 Instr instr_lui = Assembler::instr_at(pc_ + 0 * Assembler::kInstrSize); 411 Assembler::set_target_internal_reference_encoded_at(pc_, nullptr);
401 Instr instr_ori = Assembler::instr_at(pc_ + 1 * Assembler::kInstrSize);
402 DCHECK(Assembler::IsLui(instr_lui));
403 DCHECK(Assembler::IsOri(instr_ori));
404 instr_lui &= ~kImm16Mask;
405 instr_ori &= ~kImm16Mask;
406 int32_t imm = 0;
407 Assembler::instr_at_put(pc_ + 0 * Assembler::kInstrSize,
408 instr_lui | ((imm >> kLuiShift) & kImm16Mask));
409 Assembler::instr_at_put(pc_ + 1 * Assembler::kInstrSize,
410 instr_ori | (imm & kImm16Mask));
411 // Currently used only by deserializer, and all code will be flushed
412 // after complete deserialization, no need to flush on each reference.
413 } else { 412 } else {
414 Assembler::set_target_address_at(pc_, host_, NULL); 413 Assembler::set_target_address_at(pc_, host_, NULL);
415 } 414 }
416 } 415 }
417 416
418 417
419 bool RelocInfo::IsPatchedReturnSequence() { 418 bool RelocInfo::IsPatchedReturnSequence() {
420 Instr instr0 = Assembler::instr_at(pc_); 419 Instr instr0 = Assembler::instr_at(pc_);
421 Instr instr1 = Assembler::instr_at(pc_ + 1 * Assembler::kInstrSize); 420 Instr instr1 = Assembler::instr_at(pc_ + 1 * Assembler::kInstrSize);
422 Instr instr2 = Assembler::instr_at(pc_ + 2 * Assembler::kInstrSize); 421 Instr instr2 = Assembler::instr_at(pc_ + 2 * Assembler::kInstrSize);
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 } 513 }
515 *reinterpret_cast<Instr*>(pc_) = x; 514 *reinterpret_cast<Instr*>(pc_) = x;
516 pc_ += kInstrSize; 515 pc_ += kInstrSize;
517 CheckTrampolinePoolQuick(); 516 CheckTrampolinePoolQuick();
518 } 517 }
519 518
520 519
521 } } // namespace v8::internal 520 } } // namespace v8::internal
522 521
523 #endif // V8_MIPS_ASSEMBLER_MIPS_INL_H_ 522 #endif // V8_MIPS_ASSEMBLER_MIPS_INL_H_
OLDNEW
« no previous file with comments | « src/mips/assembler-mips.h ('k') | src/mips64/assembler-mips64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698