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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
110 DCHECK(reg.is_valid()); | 110 DCHECK(reg.is_valid()); |
111 DCHECK(!reg.is(kDoubleRegZero)); | 111 DCHECK(!reg.is(kDoubleRegZero)); |
112 DCHECK(!reg.is(kLithiumScratchDouble)); | 112 DCHECK(!reg.is(kLithiumScratchDouble)); |
113 return (reg.code() / 2); | 113 return (reg.code() / 2); |
114 } | 114 } |
115 | 115 |
116 | 116 |
117 // ----------------------------------------------------------------------------- | 117 // ----------------------------------------------------------------------------- |
118 // RelocInfo. | 118 // RelocInfo. |
119 | 119 |
120 void RelocInfo::apply(intptr_t delta, ICacheFlushMode icache_flush_mode) { | 120 void RelocInfo::apply(intptr_t delta) { |
121 if (IsCodeTarget(rmode_)) { | 121 if (IsCodeTarget(rmode_)) { |
122 uint32_t scope1 = (uint32_t) target_address() & ~kImm28Mask; | 122 uint32_t scope1 = (uint32_t) target_address() & ~kImm28Mask; |
123 uint32_t scope2 = reinterpret_cast<uint32_t>(pc_) & ~kImm28Mask; | 123 uint32_t scope2 = reinterpret_cast<uint32_t>(pc_) & ~kImm28Mask; |
124 | 124 |
125 if (scope1 != scope2) { | 125 if (scope1 != scope2) { |
126 Assembler::JumpToJumpRegister(pc_); | 126 Assembler::JumpToJumpRegister(pc_); |
127 } | 127 } |
128 } | 128 } |
129 if (IsInternalReference(rmode_) || IsInternalReferenceEncoded(rmode_)) { | 129 if (IsInternalReference(rmode_) || IsInternalReferenceEncoded(rmode_)) { |
130 // Absolute code pointer inside code object moves with the code object. | 130 // Absolute code pointer inside code object moves with the code object. |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
188 host(), this, HeapObject::cast(target_code)); | 188 host(), this, HeapObject::cast(target_code)); |
189 } | 189 } |
190 } | 190 } |
191 | 191 |
192 | 192 |
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) { | |
199 return pc - Assembler::kPatchDebugBreakSlotReturnOffset; | |
200 } | |
201 | |
202 | |
203 void Assembler::set_target_internal_reference_encoded_at(Address pc, | 198 void Assembler::set_target_internal_reference_encoded_at(Address pc, |
204 Address target) { | 199 Address target) { |
205 // Encoded internal references are lui/ori load of 32-bit abolute address. | 200 // Encoded internal references are lui/ori load of 32-bit abolute address. |
206 Instr instr_lui = Assembler::instr_at(pc + 0 * Assembler::kInstrSize); | 201 Instr instr_lui = Assembler::instr_at(pc + 0 * Assembler::kInstrSize); |
207 Instr instr_ori = Assembler::instr_at(pc + 1 * Assembler::kInstrSize); | 202 Instr instr_ori = Assembler::instr_at(pc + 1 * Assembler::kInstrSize); |
208 DCHECK(Assembler::IsLui(instr_lui)); | 203 DCHECK(Assembler::IsLui(instr_lui)); |
209 DCHECK(Assembler::IsOri(instr_ori)); | 204 DCHECK(Assembler::IsOri(instr_ori)); |
210 instr_lui &= ~kImm16Mask; | 205 instr_lui &= ~kImm16Mask; |
211 instr_ori &= ~kImm16Mask; | 206 instr_ori &= ~kImm16Mask; |
212 int32_t imm = reinterpret_cast<int32_t>(target); | 207 int32_t imm = reinterpret_cast<int32_t>(target); |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
352 | 347 |
353 void RelocInfo::set_code_age_stub(Code* stub, | 348 void RelocInfo::set_code_age_stub(Code* stub, |
354 ICacheFlushMode icache_flush_mode) { | 349 ICacheFlushMode icache_flush_mode) { |
355 DCHECK(rmode_ == RelocInfo::CODE_AGE_SEQUENCE); | 350 DCHECK(rmode_ == RelocInfo::CODE_AGE_SEQUENCE); |
356 Assembler::set_target_address_at(pc_ + Assembler::kInstrSize, | 351 Assembler::set_target_address_at(pc_ + Assembler::kInstrSize, |
357 host_, | 352 host_, |
358 stub->instruction_start()); | 353 stub->instruction_start()); |
359 } | 354 } |
360 | 355 |
361 | 356 |
362 Address RelocInfo::call_address() { | 357 Address RelocInfo::debug_call_address() { |
363 DCHECK((IsJSReturn(rmode()) && IsPatchedReturnSequence()) || | |
364 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence())); | |
365 // The pc_ offset of 0 assumes mips patched return sequence per | 358 // The pc_ offset of 0 assumes mips patched return sequence per |
366 // debug-mips.cc BreakLocation::SetDebugBreakAtReturn(), or | 359 // debug-mips.cc BreakLocation::SetDebugBreakAtReturn(), or |
367 // debug break slot per BreakLocation::SetDebugBreakAtSlot(). | 360 // debug break slot per BreakLocation::SetDebugBreakAtSlot(). |
361 DCHECK(IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()); | |
368 return Assembler::target_address_at(pc_, host_); | 362 return Assembler::target_address_at(pc_, host_); |
369 } | 363 } |
370 | 364 |
371 | 365 |
372 void RelocInfo::set_call_address(Address target) { | 366 void RelocInfo::set_debug_call_address(Address target) { |
373 DCHECK((IsJSReturn(rmode()) && IsPatchedReturnSequence()) || | 367 DCHECK(IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()); |
374 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence())); | |
375 // The pc_ offset of 0 assumes mips patched return sequence per | 368 // The pc_ offset of 0 assumes mips patched return sequence per |
376 // debug-mips.cc BreakLocation::SetDebugBreakAtReturn(), or | 369 // debug-mips.cc BreakLocation::SetDebugBreakAtReturn(), or |
paul.l...
2015/07/14 19:15:59
comment nit: remove mention of deleted function Br
balazs.kilvady
2015/07/14 19:30:22
Done.
| |
377 // debug break slot per BreakLocation::SetDebugBreakAtSlot(). | 370 // debug break slot per BreakLocation::SetDebugBreakAtSlot(). |
378 Assembler::set_target_address_at(pc_, host_, target); | 371 Assembler::set_target_address_at(pc_, host_, target); |
379 if (host() != NULL) { | 372 if (host() != NULL) { |
380 Object* target_code = Code::GetCodeFromTargetAddress(target); | 373 Object* target_code = Code::GetCodeFromTargetAddress(target); |
381 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode( | 374 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode( |
382 host(), this, HeapObject::cast(target_code)); | 375 host(), this, HeapObject::cast(target_code)); |
383 } | 376 } |
384 } | 377 } |
385 | 378 |
386 | 379 |
387 Object* RelocInfo::call_object() { | |
388 return *call_object_address(); | |
389 } | |
390 | |
391 | |
392 Object** RelocInfo::call_object_address() { | |
393 DCHECK((IsJSReturn(rmode()) && IsPatchedReturnSequence()) || | |
394 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence())); | |
395 return reinterpret_cast<Object**>(pc_ + 2 * Assembler::kInstrSize); | |
396 } | |
397 | |
398 | |
399 void RelocInfo::set_call_object(Object* target) { | |
400 *call_object_address() = target; | |
401 } | |
402 | |
403 | |
404 void RelocInfo::WipeOut() { | 380 void RelocInfo::WipeOut() { |
405 DCHECK(IsEmbeddedObject(rmode_) || IsCodeTarget(rmode_) || | 381 DCHECK(IsEmbeddedObject(rmode_) || IsCodeTarget(rmode_) || |
406 IsRuntimeEntry(rmode_) || IsExternalReference(rmode_) || | 382 IsRuntimeEntry(rmode_) || IsExternalReference(rmode_) || |
407 IsInternalReference(rmode_) || IsInternalReferenceEncoded(rmode_)); | 383 IsInternalReference(rmode_) || IsInternalReferenceEncoded(rmode_)); |
408 if (IsInternalReference(rmode_)) { | 384 if (IsInternalReference(rmode_)) { |
409 Memory::Address_at(pc_) = NULL; | 385 Memory::Address_at(pc_) = NULL; |
410 } else if (IsInternalReferenceEncoded(rmode_)) { | 386 } else if (IsInternalReferenceEncoded(rmode_)) { |
411 Assembler::set_target_internal_reference_encoded_at(pc_, nullptr); | 387 Assembler::set_target_internal_reference_encoded_at(pc_, nullptr); |
412 } else { | 388 } else { |
413 Assembler::set_target_address_at(pc_, host_, NULL); | 389 Assembler::set_target_address_at(pc_, host_, NULL); |
(...skipping 28 matching lines...) Expand all Loading... | |
442 visitor->VisitCodeTarget(this); | 418 visitor->VisitCodeTarget(this); |
443 } else if (mode == RelocInfo::CELL) { | 419 } else if (mode == RelocInfo::CELL) { |
444 visitor->VisitCell(this); | 420 visitor->VisitCell(this); |
445 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { | 421 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { |
446 visitor->VisitExternalReference(this); | 422 visitor->VisitExternalReference(this); |
447 } else if (mode == RelocInfo::INTERNAL_REFERENCE || | 423 } else if (mode == RelocInfo::INTERNAL_REFERENCE || |
448 mode == RelocInfo::INTERNAL_REFERENCE_ENCODED) { | 424 mode == RelocInfo::INTERNAL_REFERENCE_ENCODED) { |
449 visitor->VisitInternalReference(this); | 425 visitor->VisitInternalReference(this); |
450 } else if (RelocInfo::IsCodeAgeSequence(mode)) { | 426 } else if (RelocInfo::IsCodeAgeSequence(mode)) { |
451 visitor->VisitCodeAgeSequence(this); | 427 visitor->VisitCodeAgeSequence(this); |
452 } else if (((RelocInfo::IsJSReturn(mode) && | 428 } else if (RelocInfo::IsDebugBreakSlot(mode) && |
453 IsPatchedReturnSequence()) || | 429 IsPatchedDebugBreakSlotSequence() && |
454 (RelocInfo::IsDebugBreakSlot(mode) && | |
455 IsPatchedDebugBreakSlotSequence())) && | |
456 isolate->debug()->has_break_points()) { | 430 isolate->debug()->has_break_points()) { |
457 visitor->VisitDebugTarget(this); | 431 visitor->VisitDebugTarget(this); |
458 } else if (RelocInfo::IsRuntimeEntry(mode)) { | 432 } else if (RelocInfo::IsRuntimeEntry(mode)) { |
459 visitor->VisitRuntimeEntry(this); | 433 visitor->VisitRuntimeEntry(this); |
460 } | 434 } |
461 } | 435 } |
462 | 436 |
463 | 437 |
464 template<typename StaticVisitor> | 438 template<typename StaticVisitor> |
465 void RelocInfo::Visit(Heap* heap) { | 439 void RelocInfo::Visit(Heap* heap) { |
466 RelocInfo::Mode mode = rmode(); | 440 RelocInfo::Mode mode = rmode(); |
467 if (mode == RelocInfo::EMBEDDED_OBJECT) { | 441 if (mode == RelocInfo::EMBEDDED_OBJECT) { |
468 StaticVisitor::VisitEmbeddedPointer(heap, this); | 442 StaticVisitor::VisitEmbeddedPointer(heap, this); |
469 } else if (RelocInfo::IsCodeTarget(mode)) { | 443 } else if (RelocInfo::IsCodeTarget(mode)) { |
470 StaticVisitor::VisitCodeTarget(heap, this); | 444 StaticVisitor::VisitCodeTarget(heap, this); |
471 } else if (mode == RelocInfo::CELL) { | 445 } else if (mode == RelocInfo::CELL) { |
472 StaticVisitor::VisitCell(heap, this); | 446 StaticVisitor::VisitCell(heap, this); |
473 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { | 447 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { |
474 StaticVisitor::VisitExternalReference(this); | 448 StaticVisitor::VisitExternalReference(this); |
475 } else if (mode == RelocInfo::INTERNAL_REFERENCE || | 449 } else if (mode == RelocInfo::INTERNAL_REFERENCE || |
476 mode == RelocInfo::INTERNAL_REFERENCE_ENCODED) { | 450 mode == RelocInfo::INTERNAL_REFERENCE_ENCODED) { |
477 StaticVisitor::VisitInternalReference(this); | 451 StaticVisitor::VisitInternalReference(this); |
478 } else if (RelocInfo::IsCodeAgeSequence(mode)) { | 452 } else if (RelocInfo::IsCodeAgeSequence(mode)) { |
479 StaticVisitor::VisitCodeAgeSequence(heap, this); | 453 StaticVisitor::VisitCodeAgeSequence(heap, this); |
480 } else if (heap->isolate()->debug()->has_break_points() && | 454 } else if (heap->isolate()->debug()->has_break_points() && |
481 ((RelocInfo::IsJSReturn(mode) && | 455 RelocInfo::IsDebugBreakSlot(mode) && |
482 IsPatchedReturnSequence()) || | 456 IsPatchedDebugBreakSlotSequence()) { |
483 (RelocInfo::IsDebugBreakSlot(mode) && | |
484 IsPatchedDebugBreakSlotSequence()))) { | |
485 StaticVisitor::VisitDebugTarget(heap, this); | 457 StaticVisitor::VisitDebugTarget(heap, this); |
486 } else if (RelocInfo::IsRuntimeEntry(mode)) { | 458 } else if (RelocInfo::IsRuntimeEntry(mode)) { |
487 StaticVisitor::VisitRuntimeEntry(this); | 459 StaticVisitor::VisitRuntimeEntry(this); |
488 } | 460 } |
489 } | 461 } |
490 | 462 |
491 | 463 |
492 // ----------------------------------------------------------------------------- | 464 // ----------------------------------------------------------------------------- |
493 // Assembler. | 465 // Assembler. |
494 | 466 |
(...skipping 18 matching lines...) Expand all Loading... | |
513 } | 485 } |
514 *reinterpret_cast<Instr*>(pc_) = x; | 486 *reinterpret_cast<Instr*>(pc_) = x; |
515 pc_ += kInstrSize; | 487 pc_ += kInstrSize; |
516 CheckTrampolinePoolQuick(); | 488 CheckTrampolinePoolQuick(); |
517 } | 489 } |
518 | 490 |
519 | 491 |
520 } } // namespace v8::internal | 492 } } // namespace v8::internal |
521 | 493 |
522 #endif // V8_MIPS_ASSEMBLER_MIPS_INL_H_ | 494 #endif // V8_MIPS_ASSEMBLER_MIPS_INL_H_ |
OLD | NEW |