Index: src/x64/assembler-x64-inl.h |
=================================================================== |
--- src/x64/assembler-x64-inl.h (revision 13870) |
+++ src/x64/assembler-x64-inl.h (working copy) |
@@ -86,6 +86,14 @@ |
} |
+void Assembler::emit_runtime_entry(Address entry, RelocInfo::Mode rmode) { |
+ ASSERT(RelocInfo::IsRuntimeEntry(rmode)); |
+ ASSERT(isolate()->code_range()->exists()); |
+ RecordRelocInfo(rmode); |
+ emitl(static_cast<uint32_t>(entry - isolate()->code_range()->start())); |
+} |
+ |
+ |
void Assembler::emit_rex_64(Register reg, Register rm_reg) { |
emit(0x48 | reg.high_bit() << 2 | rm_reg.high_bit()); |
} |
@@ -208,6 +216,12 @@ |
return code_targets_[Memory::int32_at(pc)]; |
} |
+ |
+Address Assembler::runtime_entry_at(Address pc) { |
+ ASSERT(isolate()->code_range()->exists()); |
+ return Memory::int32_at(pc) + isolate()->code_range()->start(); |
+} |
+ |
// ----------------------------------------------------------------------------- |
// Implementation of RelocInfo |
@@ -217,7 +231,7 @@ |
// absolute code pointer inside code object moves with the code object. |
Memory::Address_at(pc_) += static_cast<int32_t>(delta); |
CPU::FlushICache(pc_, sizeof(Address)); |
- } else if (IsCodeTarget(rmode_)) { |
+ } else if (IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)) { |
Memory::int32_at(pc_) -= static_cast<int32_t>(delta); |
CPU::FlushICache(pc_, sizeof(int32_t)); |
} else if (rmode_ == CODE_AGE_SEQUENCE) { |
@@ -231,17 +245,13 @@ |
Address RelocInfo::target_address() { |
- ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY); |
- if (IsCodeTarget(rmode_)) { |
- return Assembler::target_address_at(pc_); |
- } else { |
- return Memory::Address_at(pc_); |
- } |
+ ASSERT(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)); |
+ return Assembler::target_address_at(pc_); |
} |
Address RelocInfo::target_address_address() { |
- ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY |
+ ASSERT(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_) |
|| rmode_ == EMBEDDED_OBJECT |
|| rmode_ == EXTERNAL_REFERENCE); |
return reinterpret_cast<Address>(pc_); |
@@ -258,17 +268,12 @@ |
void RelocInfo::set_target_address(Address target, WriteBarrierMode mode) { |
- ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY); |
- if (IsCodeTarget(rmode_)) { |
- Assembler::set_target_address_at(pc_, target); |
+ ASSERT(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)); |
+ Assembler::set_target_address_at(pc_, target); |
+ if (mode == UPDATE_WRITE_BARRIER && host() != NULL && IsCodeTarget(rmode_)) { |
Object* target_code = Code::GetCodeFromTargetAddress(target); |
- if (mode == UPDATE_WRITE_BARRIER && host() != NULL) { |
- host()->GetHeap()->incremental_marking()->RecordWriteIntoCode( |
- host(), this, HeapObject::cast(target_code)); |
- } |
- } else { |
- Memory::Address_at(pc_) = target; |
- CPU::FlushICache(pc_, sizeof(Address)); |
+ host()->GetHeap()->incremental_marking()->RecordWriteIntoCode( |
+ host(), this, HeapObject::cast(target_code)); |
} |
} |
@@ -314,6 +319,19 @@ |
} |
+Address RelocInfo::target_runtime_entry(Assembler* origin) { |
+ ASSERT(IsRuntimeEntry(rmode_)); |
+ return origin->runtime_entry_at(pc_); |
+} |
+ |
+ |
+void RelocInfo::set_target_runtime_entry(Address target, |
+ WriteBarrierMode mode) { |
+ ASSERT(IsRuntimeEntry(rmode_)); |
+ if (target_address() != target) set_target_address(target, mode); |
+} |
+ |
+ |
Handle<JSGlobalPropertyCell> RelocInfo::target_cell_handle() { |
ASSERT(rmode_ == RelocInfo::GLOBAL_PROPERTY_CELL); |
Address address = Memory::Address_at(pc_); |
@@ -443,7 +461,7 @@ |
Isolate::Current()->debug()->has_break_points()) { |
visitor->VisitDebugTarget(this); |
#endif |
- } else if (mode == RelocInfo::RUNTIME_ENTRY) { |
+ } else if (RelocInfo::IsRuntimeEntry(mode)) { |
visitor->VisitRuntimeEntry(this); |
} |
} |
@@ -472,7 +490,7 @@ |
IsPatchedDebugBreakSlotSequence()))) { |
StaticVisitor::VisitDebugTarget(heap, this); |
#endif |
- } else if (mode == RelocInfo::RUNTIME_ENTRY) { |
+ } else if (RelocInfo::IsRuntimeEntry(mode)) { |
StaticVisitor::VisitRuntimeEntry(this); |
} |
} |