| OLD | NEW |
| 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 Loading... |
| 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, RelocInfo::Mode mode) { |
| 199 if (IsLui(instr_at(pc))) { | 224 if (mode == RelocInfo::INTERNAL_REFERENCE_ENCODED) { |
| 200 // Encoded internal references are lui/ori load of 48-bit abolute address. | 225 DCHECK(IsLui(instr_at(pc))); |
| 201 Instr instr_lui = Assembler::instr_at(pc + 0 * Assembler::kInstrSize); | 226 set_target_internal_reference_encoded_at(pc, target); |
| 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 { | 227 } else { |
| 228 DCHECK(mode == RelocInfo::INTERNAL_REFERENCE); |
| 221 Memory::Address_at(pc) = target; | 229 Memory::Address_at(pc) = target; |
| 222 } | 230 } |
| 223 } | 231 } |
| 224 | 232 |
| 225 | 233 |
| 226 Object* RelocInfo::target_object() { | 234 Object* RelocInfo::target_object() { |
| 227 DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); | 235 DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); |
| 228 return reinterpret_cast<Object*>(Assembler::target_address_at(pc_, host_)); | 236 return reinterpret_cast<Object*>(Assembler::target_address_at(pc_, host_)); |
| 229 } | 237 } |
| 230 | 238 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 255 Address RelocInfo::target_external_reference() { | 263 Address RelocInfo::target_external_reference() { |
| 256 DCHECK(rmode_ == EXTERNAL_REFERENCE); | 264 DCHECK(rmode_ == EXTERNAL_REFERENCE); |
| 257 return Assembler::target_address_at(pc_, host_); | 265 return Assembler::target_address_at(pc_, host_); |
| 258 } | 266 } |
| 259 | 267 |
| 260 | 268 |
| 261 Address RelocInfo::target_internal_reference() { | 269 Address RelocInfo::target_internal_reference() { |
| 262 if (rmode_ == INTERNAL_REFERENCE) { | 270 if (rmode_ == INTERNAL_REFERENCE) { |
| 263 return Memory::Address_at(pc_); | 271 return Memory::Address_at(pc_); |
| 264 } else { | 272 } else { |
| 265 // Encoded internal references are lui/ori load of 48-bit abolute address. | 273 // Encoded internal references are lui/ori load of 48-bit absolute address. |
| 266 DCHECK(rmode_ == INTERNAL_REFERENCE_ENCODED); | 274 DCHECK(rmode_ == INTERNAL_REFERENCE_ENCODED); |
| 267 Instr instr_lui = Assembler::instr_at(pc_ + 0 * Assembler::kInstrSize); | 275 Instr instr_lui = Assembler::instr_at(pc_ + 0 * Assembler::kInstrSize); |
| 268 Instr instr_ori = Assembler::instr_at(pc_ + 1 * Assembler::kInstrSize); | 276 Instr instr_ori = Assembler::instr_at(pc_ + 1 * Assembler::kInstrSize); |
| 269 Instr instr_ori2 = Assembler::instr_at(pc_ + 3 * Assembler::kInstrSize); | 277 Instr instr_ori2 = Assembler::instr_at(pc_ + 3 * Assembler::kInstrSize); |
| 270 DCHECK(Assembler::IsLui(instr_lui)); | 278 DCHECK(Assembler::IsLui(instr_lui)); |
| 271 DCHECK(Assembler::IsOri(instr_ori)); | 279 DCHECK(Assembler::IsOri(instr_ori)); |
| 272 DCHECK(Assembler::IsOri(instr_ori2)); | 280 DCHECK(Assembler::IsOri(instr_ori2)); |
| 273 int64_t imm = (instr_lui & static_cast<int64_t>(kImm16Mask)) << 32; | 281 int64_t imm = (instr_lui & static_cast<int64_t>(kImm16Mask)) << 32; |
| 274 imm |= (instr_ori & static_cast<int64_t>(kImm16Mask)) << 16; | 282 imm |= (instr_ori & static_cast<int64_t>(kImm16Mask)) << 16; |
| 275 imm |= (instr_ori2 & static_cast<int64_t>(kImm16Mask)); | 283 imm |= (instr_ori2 & static_cast<int64_t>(kImm16Mask)); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 } | 402 } |
| 395 | 403 |
| 396 | 404 |
| 397 void RelocInfo::WipeOut() { | 405 void RelocInfo::WipeOut() { |
| 398 DCHECK(IsEmbeddedObject(rmode_) || IsCodeTarget(rmode_) || | 406 DCHECK(IsEmbeddedObject(rmode_) || IsCodeTarget(rmode_) || |
| 399 IsRuntimeEntry(rmode_) || IsExternalReference(rmode_) || | 407 IsRuntimeEntry(rmode_) || IsExternalReference(rmode_) || |
| 400 IsInternalReference(rmode_) || IsInternalReferenceEncoded(rmode_)); | 408 IsInternalReference(rmode_) || IsInternalReferenceEncoded(rmode_)); |
| 401 if (IsInternalReference(rmode_)) { | 409 if (IsInternalReference(rmode_)) { |
| 402 Memory::Address_at(pc_) = NULL; | 410 Memory::Address_at(pc_) = NULL; |
| 403 } else if (IsInternalReferenceEncoded(rmode_)) { | 411 } else if (IsInternalReferenceEncoded(rmode_)) { |
| 404 Instr instr_lui = Assembler::instr_at(pc_ + 0 * Assembler::kInstrSize); | 412 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 { | 413 } else { |
| 423 Assembler::set_target_address_at(pc_, host_, NULL); | 414 Assembler::set_target_address_at(pc_, host_, NULL); |
| 424 } | 415 } |
| 425 } | 416 } |
| 426 | 417 |
| 427 | 418 |
| 428 bool RelocInfo::IsPatchedReturnSequence() { | 419 bool RelocInfo::IsPatchedReturnSequence() { |
| 429 Instr instr0 = Assembler::instr_at(pc_); // lui. | 420 Instr instr0 = Assembler::instr_at(pc_); // lui. |
| 430 Instr instr1 = Assembler::instr_at(pc_ + 1 * Assembler::kInstrSize); // ori. | 421 Instr instr1 = Assembler::instr_at(pc_ + 1 * Assembler::kInstrSize); // ori. |
| 431 Instr instr2 = Assembler::instr_at(pc_ + 2 * Assembler::kInstrSize); // dsll. | 422 Instr instr2 = Assembler::instr_at(pc_ + 2 * Assembler::kInstrSize); // dsll. |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 } | 527 } |
| 537 *reinterpret_cast<uint64_t*>(pc_) = x; | 528 *reinterpret_cast<uint64_t*>(pc_) = x; |
| 538 pc_ += kInstrSize * 2; | 529 pc_ += kInstrSize * 2; |
| 539 CheckTrampolinePoolQuick(); | 530 CheckTrampolinePoolQuick(); |
| 540 } | 531 } |
| 541 | 532 |
| 542 | 533 |
| 543 } } // namespace v8::internal | 534 } } // namespace v8::internal |
| 544 | 535 |
| 545 #endif // V8_MIPS_ASSEMBLER_MIPS_INL_H_ | 536 #endif // V8_MIPS_ASSEMBLER_MIPS_INL_H_ |
| OLD | NEW |