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

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 nits. 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
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) {
205 if (IsLui(instr_at(pc))) { 226 Memory::Address_at(pc) = target;
206 // Encoded internal references are lui/ori load of 32-bit abolute address.
207 Instr instr_lui = Assembler::instr_at(pc + 0 * Assembler::kInstrSize);
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 {
220 Memory::Address_at(pc) = target;
221 }
222 } 227 }
223 228
224 229
230 void Assembler::deserialization_set_target_internal_reference_encoded_at(
231 Address pc, Address target) {
232 DCHECK(IsLui(instr_at(pc)));
233 set_target_internal_reference_encoded_at(pc, target);
234 }
235
236
225 Object* RelocInfo::target_object() { 237 Object* RelocInfo::target_object() {
226 DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); 238 DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
227 return reinterpret_cast<Object*>(Assembler::target_address_at(pc_, host_)); 239 return reinterpret_cast<Object*>(Assembler::target_address_at(pc_, host_));
228 } 240 }
229 241
230 242
231 Handle<Object> RelocInfo::target_object_handle(Assembler* origin) { 243 Handle<Object> RelocInfo::target_object_handle(Assembler* origin) {
232 DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); 244 DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
233 return Handle<Object>(reinterpret_cast<Object**>( 245 return Handle<Object>(reinterpret_cast<Object**>(
234 Assembler::target_address_at(pc_, host_))); 246 Assembler::target_address_at(pc_, host_)));
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 } 402 }
391 403
392 404
393 void RelocInfo::WipeOut() { 405 void RelocInfo::WipeOut() {
394 DCHECK(IsEmbeddedObject(rmode_) || IsCodeTarget(rmode_) || 406 DCHECK(IsEmbeddedObject(rmode_) || IsCodeTarget(rmode_) ||
395 IsRuntimeEntry(rmode_) || IsExternalReference(rmode_) || 407 IsRuntimeEntry(rmode_) || IsExternalReference(rmode_) ||
396 IsInternalReference(rmode_) || IsInternalReferenceEncoded(rmode_)); 408 IsInternalReference(rmode_) || IsInternalReferenceEncoded(rmode_));
397 if (IsInternalReference(rmode_)) { 409 if (IsInternalReference(rmode_)) {
398 Memory::Address_at(pc_) = NULL; 410 Memory::Address_at(pc_) = NULL;
399 } else if (IsInternalReferenceEncoded(rmode_)) { 411 } else if (IsInternalReferenceEncoded(rmode_)) {
400 Instr instr_lui = Assembler::instr_at(pc_ + 0 * Assembler::kInstrSize); 412 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 { 413 } else {
414 Assembler::set_target_address_at(pc_, host_, NULL); 414 Assembler::set_target_address_at(pc_, host_, NULL);
415 } 415 }
416 } 416 }
417 417
418 418
419 bool RelocInfo::IsPatchedReturnSequence() { 419 bool RelocInfo::IsPatchedReturnSequence() {
420 Instr instr0 = Assembler::instr_at(pc_); 420 Instr instr0 = Assembler::instr_at(pc_);
421 Instr instr1 = Assembler::instr_at(pc_ + 1 * Assembler::kInstrSize); 421 Instr instr1 = Assembler::instr_at(pc_ + 1 * Assembler::kInstrSize);
422 Instr instr2 = Assembler::instr_at(pc_ + 2 * Assembler::kInstrSize); 422 Instr instr2 = Assembler::instr_at(pc_ + 2 * Assembler::kInstrSize);
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 } 514 }
515 *reinterpret_cast<Instr*>(pc_) = x; 515 *reinterpret_cast<Instr*>(pc_) = x;
516 pc_ += kInstrSize; 516 pc_ += kInstrSize;
517 CheckTrampolinePoolQuick(); 517 CheckTrampolinePoolQuick();
518 } 518 }
519 519
520 520
521 } } // namespace v8::internal 521 } } // namespace v8::internal
522 522
523 #endif // V8_MIPS_ASSEMBLER_MIPS_INL_H_ 523 #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') | src/serialize.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698