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

Side by Side Diff: src/mips64/assembler-mips64-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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 Address Assembler::target_address_from_return_address(Address pc) { 187 Address Assembler::target_address_from_return_address(Address pc) {
188 return pc - kCallTargetAddressOffset; 188 return pc - kCallTargetAddressOffset;
189 } 189 }
190 190
191 191
192 Address Assembler::break_address_from_return_address(Address pc) { 192 Address Assembler::break_address_from_return_address(Address pc) {
193 return pc - Assembler::kPatchDebugBreakSlotReturnOffset; 193 return pc - Assembler::kPatchDebugBreakSlotReturnOffset;
194 } 194 }
195 195
196 196
197 void Assembler::set_target_internal_reference_encoded_at(Address pc,
198 Address target) {
199 // Encoded internal references are lui/ori load of 48-bit absolute address.
200 Instr instr_lui = Assembler::instr_at(pc + 0 * Assembler::kInstrSize);
201 Instr instr_ori = Assembler::instr_at(pc + 1 * Assembler::kInstrSize);
202 Instr instr_ori2 = Assembler::instr_at(pc + 3 * Assembler::kInstrSize);
203 DCHECK(Assembler::IsLui(instr_lui));
204 DCHECK(Assembler::IsOri(instr_ori));
205 DCHECK(Assembler::IsOri(instr_ori2));
206 instr_lui &= ~kImm16Mask;
207 instr_ori &= ~kImm16Mask;
208 instr_ori2 &= ~kImm16Mask;
209 int64_t imm = reinterpret_cast<int64_t>(target);
210 DCHECK((imm & 3) == 0);
211 Assembler::instr_at_put(pc + 0 * Assembler::kInstrSize,
212 instr_lui | ((imm >> 32) & kImm16Mask));
213 Assembler::instr_at_put(pc + 1 * Assembler::kInstrSize,
214 instr_ori | ((imm >> 16) & kImm16Mask));
215 Assembler::instr_at_put(pc + 3 * Assembler::kInstrSize,
216 instr_ori | (imm & kImm16Mask));
217 // Currently used only by deserializer, and all code will be flushed
218 // after complete deserialization, no need to flush on each reference.
219 }
220
221
197 void Assembler::deserialization_set_target_internal_reference_at( 222 void Assembler::deserialization_set_target_internal_reference_at(
198 Address pc, Address target) { 223 Address pc, Address target) {
199 if (IsLui(instr_at(pc))) { 224 Memory::Address_at(pc) = target;
200 // Encoded internal references are lui/ori load of 48-bit abolute address.
201 Instr instr_lui = Assembler::instr_at(pc + 0 * Assembler::kInstrSize);
202 Instr instr_ori = Assembler::instr_at(pc + 1 * Assembler::kInstrSize);
203 Instr instr_ori2 = Assembler::instr_at(pc + 3 * Assembler::kInstrSize);
204 DCHECK(Assembler::IsLui(instr_lui));
205 DCHECK(Assembler::IsOri(instr_ori));
206 DCHECK(Assembler::IsOri(instr_ori2));
207 instr_lui &= ~kImm16Mask;
208 instr_ori &= ~kImm16Mask;
209 instr_ori2 &= ~kImm16Mask;
210 int64_t imm = reinterpret_cast<int64_t>(target);
211 DCHECK((imm & 3) == 0);
212 Assembler::instr_at_put(pc + 0 * Assembler::kInstrSize,
213 instr_lui | ((imm >> 32) & kImm16Mask));
214 Assembler::instr_at_put(pc + 1 * Assembler::kInstrSize,
215 instr_ori | ((imm >> 16) & kImm16Mask));
216 Assembler::instr_at_put(pc + 3 * Assembler::kInstrSize,
217 instr_ori | (imm & kImm16Mask));
218 // Currently used only by deserializer, and all code will be flushed
219 // after complete deserialization, no need to flush on each reference.
220 } else {
221 Memory::Address_at(pc) = target;
222 }
223 } 225 }
224 226
225 227
228 void Assembler::deserialization_set_target_internal_reference_encoded_at(
229 Address pc, Address target) {
230 DCHECK(IsLui(instr_at(pc)));
231 set_target_internal_reference_encoded_at(pc, target);
232 }
233
234
226 Object* RelocInfo::target_object() { 235 Object* RelocInfo::target_object() {
227 DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); 236 DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
228 return reinterpret_cast<Object*>(Assembler::target_address_at(pc_, host_)); 237 return reinterpret_cast<Object*>(Assembler::target_address_at(pc_, host_));
229 } 238 }
230 239
231 240
232 Handle<Object> RelocInfo::target_object_handle(Assembler* origin) { 241 Handle<Object> RelocInfo::target_object_handle(Assembler* origin) {
233 DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); 242 DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
234 return Handle<Object>(reinterpret_cast<Object**>( 243 return Handle<Object>(reinterpret_cast<Object**>(
235 Assembler::target_address_at(pc_, host_))); 244 Assembler::target_address_at(pc_, host_)));
(...skipping 19 matching lines...) Expand all
255 Address RelocInfo::target_external_reference() { 264 Address RelocInfo::target_external_reference() {
256 DCHECK(rmode_ == EXTERNAL_REFERENCE); 265 DCHECK(rmode_ == EXTERNAL_REFERENCE);
257 return Assembler::target_address_at(pc_, host_); 266 return Assembler::target_address_at(pc_, host_);
258 } 267 }
259 268
260 269
261 Address RelocInfo::target_internal_reference() { 270 Address RelocInfo::target_internal_reference() {
262 if (rmode_ == INTERNAL_REFERENCE) { 271 if (rmode_ == INTERNAL_REFERENCE) {
263 return Memory::Address_at(pc_); 272 return Memory::Address_at(pc_);
264 } else { 273 } else {
265 // Encoded internal references are lui/ori load of 48-bit abolute address. 274 // Encoded internal references are lui/ori load of 48-bit absolute address.
266 DCHECK(rmode_ == INTERNAL_REFERENCE_ENCODED); 275 DCHECK(rmode_ == INTERNAL_REFERENCE_ENCODED);
267 Instr instr_lui = Assembler::instr_at(pc_ + 0 * Assembler::kInstrSize); 276 Instr instr_lui = Assembler::instr_at(pc_ + 0 * Assembler::kInstrSize);
268 Instr instr_ori = Assembler::instr_at(pc_ + 1 * Assembler::kInstrSize); 277 Instr instr_ori = Assembler::instr_at(pc_ + 1 * Assembler::kInstrSize);
269 Instr instr_ori2 = Assembler::instr_at(pc_ + 3 * Assembler::kInstrSize); 278 Instr instr_ori2 = Assembler::instr_at(pc_ + 3 * Assembler::kInstrSize);
270 DCHECK(Assembler::IsLui(instr_lui)); 279 DCHECK(Assembler::IsLui(instr_lui));
271 DCHECK(Assembler::IsOri(instr_ori)); 280 DCHECK(Assembler::IsOri(instr_ori));
272 DCHECK(Assembler::IsOri(instr_ori2)); 281 DCHECK(Assembler::IsOri(instr_ori2));
273 int64_t imm = (instr_lui & static_cast<int64_t>(kImm16Mask)) << 32; 282 int64_t imm = (instr_lui & static_cast<int64_t>(kImm16Mask)) << 32;
274 imm |= (instr_ori & static_cast<int64_t>(kImm16Mask)) << 16; 283 imm |= (instr_ori & static_cast<int64_t>(kImm16Mask)) << 16;
275 imm |= (instr_ori2 & static_cast<int64_t>(kImm16Mask)); 284 imm |= (instr_ori2 & static_cast<int64_t>(kImm16Mask));
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 } 403 }
395 404
396 405
397 void RelocInfo::WipeOut() { 406 void RelocInfo::WipeOut() {
398 DCHECK(IsEmbeddedObject(rmode_) || IsCodeTarget(rmode_) || 407 DCHECK(IsEmbeddedObject(rmode_) || IsCodeTarget(rmode_) ||
399 IsRuntimeEntry(rmode_) || IsExternalReference(rmode_) || 408 IsRuntimeEntry(rmode_) || IsExternalReference(rmode_) ||
400 IsInternalReference(rmode_) || IsInternalReferenceEncoded(rmode_)); 409 IsInternalReference(rmode_) || IsInternalReferenceEncoded(rmode_));
401 if (IsInternalReference(rmode_)) { 410 if (IsInternalReference(rmode_)) {
402 Memory::Address_at(pc_) = NULL; 411 Memory::Address_at(pc_) = NULL;
403 } else if (IsInternalReferenceEncoded(rmode_)) { 412 } else if (IsInternalReferenceEncoded(rmode_)) {
404 Instr instr_lui = Assembler::instr_at(pc_ + 0 * Assembler::kInstrSize); 413 Assembler::set_target_internal_reference_encoded_at(pc_, nullptr);
405 Instr instr_ori = Assembler::instr_at(pc_ + 1 * Assembler::kInstrSize);
406 Instr instr_ori2 = Assembler::instr_at(pc_ + 3 * Assembler::kInstrSize);
407 DCHECK(Assembler::IsLui(instr_lui));
408 DCHECK(Assembler::IsOri(instr_ori));
409 DCHECK(Assembler::IsOri(instr_ori2));
410 instr_lui &= ~kImm16Mask;
411 instr_ori &= ~kImm16Mask;
412 instr_ori2 &= ~kImm16Mask;
413 int64_t imm = 0;
414 Assembler::instr_at_put(pc_ + 0 * Assembler::kInstrSize,
415 instr_lui | ((imm >> 32) & kImm16Mask));
416 Assembler::instr_at_put(pc_ + 1 * Assembler::kInstrSize,
417 instr_ori | ((imm >> 16) & kImm16Mask));
418 Assembler::instr_at_put(pc_ + 3 * Assembler::kInstrSize,
419 instr_ori | (imm & kImm16Mask));
420 // Currently used only by deserializer, and all code will be flushed
421 // after complete deserialization, no need to flush on each reference.
422 } else { 414 } else {
423 Assembler::set_target_address_at(pc_, host_, NULL); 415 Assembler::set_target_address_at(pc_, host_, NULL);
424 } 416 }
425 } 417 }
426 418
427 419
428 bool RelocInfo::IsPatchedReturnSequence() { 420 bool RelocInfo::IsPatchedReturnSequence() {
429 Instr instr0 = Assembler::instr_at(pc_); // lui. 421 Instr instr0 = Assembler::instr_at(pc_); // lui.
430 Instr instr1 = Assembler::instr_at(pc_ + 1 * Assembler::kInstrSize); // ori. 422 Instr instr1 = Assembler::instr_at(pc_ + 1 * Assembler::kInstrSize); // ori.
431 Instr instr2 = Assembler::instr_at(pc_ + 2 * Assembler::kInstrSize); // dsll. 423 Instr instr2 = Assembler::instr_at(pc_ + 2 * Assembler::kInstrSize); // dsll.
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 } 528 }
537 *reinterpret_cast<uint64_t*>(pc_) = x; 529 *reinterpret_cast<uint64_t*>(pc_) = x;
538 pc_ += kInstrSize * 2; 530 pc_ += kInstrSize * 2;
539 CheckTrampolinePoolQuick(); 531 CheckTrampolinePoolQuick();
540 } 532 }
541 533
542 534
543 } } // namespace v8::internal 535 } } // namespace v8::internal
544 536
545 #endif // V8_MIPS_ASSEMBLER_MIPS_INL_H_ 537 #endif // V8_MIPS_ASSEMBLER_MIPS_INL_H_
OLDNEW
« no previous file with comments | « src/mips64/assembler-mips64.h ('k') | src/serialize.h » ('j') | src/serialize.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698