Avoiding the assumption that the pc pointer of RelocInfo points to the word containing the target address. It wasn't true for ARM. (One step closer to serialization on ARM).
Review URL: http://codereview.chromium.org/17376 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1067 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
70af3cc4ba
commit
ce673ec9ad
@ -61,13 +61,19 @@ void RelocInfo::apply(int delta) {
|
||||
|
||||
|
||||
Address RelocInfo::target_address() {
|
||||
ASSERT(IsCodeTarget(rmode_));
|
||||
ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY);
|
||||
return Assembler::target_address_at(pc_);
|
||||
}
|
||||
|
||||
|
||||
Address RelocInfo::target_address_address() {
|
||||
ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY);
|
||||
return reinterpret_cast<Address>(Assembler::target_address_address_at(pc_));
|
||||
}
|
||||
|
||||
|
||||
void RelocInfo::set_target_address(Address target) {
|
||||
ASSERT(IsCodeTarget(rmode_));
|
||||
ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY);
|
||||
Assembler::set_target_address_at(pc_, target);
|
||||
}
|
||||
|
||||
@ -92,7 +98,7 @@ void RelocInfo::set_target_object(Object* target) {
|
||||
|
||||
Address* RelocInfo::target_reference_address() {
|
||||
ASSERT(rmode_ == EXTERNAL_REFERENCE);
|
||||
return reinterpret_cast<Address*>(pc_);
|
||||
return reinterpret_cast<Address*>(Assembler::target_address_address_at(pc_));
|
||||
}
|
||||
|
||||
|
||||
|
@ -70,6 +70,12 @@ Address RelocInfo::target_address() {
|
||||
}
|
||||
|
||||
|
||||
Address RelocInfo::target_address_address() {
|
||||
ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY);
|
||||
return reinterpret_cast<Address>(pc_);
|
||||
}
|
||||
|
||||
|
||||
void RelocInfo::set_target_address(Address target) {
|
||||
ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY);
|
||||
Assembler::set_target_address_at(pc_, target);
|
||||
|
@ -230,14 +230,19 @@ class RelocInfo BASE_EMBEDDED {
|
||||
// Apply a relocation by delta bytes
|
||||
INLINE(void apply(int delta));
|
||||
|
||||
// Read/modify the code target in the branch/call instruction this relocation
|
||||
// applies to; can only be called if IsCodeTarget(rmode_)
|
||||
// Read/modify the code target in the branch/call instruction
|
||||
// this relocation applies to;
|
||||
// can only be called if IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY
|
||||
INLINE(Address target_address());
|
||||
INLINE(void set_target_address(Address target));
|
||||
INLINE(Object* target_object());
|
||||
INLINE(Object** target_object_address());
|
||||
INLINE(void set_target_object(Object* target));
|
||||
|
||||
// Read the address of the word containing the target_address. Can only
|
||||
// be called if IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY.
|
||||
INLINE(Address target_address_address());
|
||||
|
||||
// Read/modify the reference in the instruction this relocation
|
||||
// applies to; can only be called if rmode_ is external_reference
|
||||
INLINE(Address* target_reference_address());
|
||||
|
@ -586,29 +586,33 @@ ExternalReferenceTable::ExternalReferenceTable() : refs_(64) {
|
||||
UNCLASSIFIED,
|
||||
3,
|
||||
"StackGuard::address_of_limit()");
|
||||
Add(ExternalReference::debug_break().address(),
|
||||
Add(ExternalReference::address_of_regexp_stack_limit().address(),
|
||||
UNCLASSIFIED,
|
||||
4,
|
||||
"RegExpStack::limit_address()");
|
||||
Add(ExternalReference::debug_break().address(),
|
||||
UNCLASSIFIED,
|
||||
5,
|
||||
"Debug::Break()");
|
||||
Add(ExternalReference::new_space_start().address(),
|
||||
UNCLASSIFIED,
|
||||
5,
|
||||
6,
|
||||
"Heap::NewSpaceStart()");
|
||||
Add(ExternalReference::heap_always_allocate_scope_depth().address(),
|
||||
UNCLASSIFIED,
|
||||
6,
|
||||
7,
|
||||
"Heap::always_allocate_scope_depth()");
|
||||
Add(ExternalReference::new_space_allocation_limit_address().address(),
|
||||
UNCLASSIFIED,
|
||||
7,
|
||||
8,
|
||||
"Heap::NewSpaceAllocationLimitAddress()");
|
||||
Add(ExternalReference::new_space_allocation_top_address().address(),
|
||||
UNCLASSIFIED,
|
||||
8,
|
||||
9,
|
||||
"Heap::NewSpaceAllocationTopAddress()");
|
||||
Add(ExternalReference::debug_step_in_fp_address().address(),
|
||||
UNCLASSIFIED,
|
||||
9,
|
||||
10,
|
||||
"Debug::step_in_fp_addr()");
|
||||
}
|
||||
|
||||
@ -804,7 +808,7 @@ class ReferenceUpdater: public ObjectVisitor {
|
||||
Address target = rinfo->target_address();
|
||||
uint32_t encoding = reference_encoder_->Encode(target);
|
||||
CHECK(target == NULL ? encoding == 0 : encoding != 0);
|
||||
offsets_.Add(reinterpret_cast<Address>(rinfo->pc()) - obj_address_);
|
||||
offsets_.Add(rinfo->target_address_address() - obj_address_);
|
||||
addresses_.Add(reinterpret_cast<Address>(encoding));
|
||||
}
|
||||
|
||||
@ -1269,7 +1273,7 @@ void Deserializer::VisitExternalReferences(Address* start, Address* end) {
|
||||
|
||||
|
||||
void Deserializer::VisitRuntimeEntry(RelocInfo* rinfo) {
|
||||
uint32_t* pc = reinterpret_cast<uint32_t*>(rinfo->pc());
|
||||
uint32_t* pc = reinterpret_cast<uint32_t*>(rinfo->target_address_address());
|
||||
uint32_t encoding = *pc;
|
||||
Address target = reference_decoder_->Decode(encoding);
|
||||
rinfo->set_target_address(target);
|
||||
|
@ -109,9 +109,9 @@ TEST(ExternalReferenceEncoder) {
|
||||
ExternalReference::address_of_stack_guard_limit();
|
||||
CHECK_EQ(make_code(UNCLASSIFIED, 3),
|
||||
encoder.Encode(stack_guard_limit_address.address()));
|
||||
CHECK_EQ(make_code(UNCLASSIFIED, 4),
|
||||
encoder.Encode(ExternalReference::debug_break().address()));
|
||||
CHECK_EQ(make_code(UNCLASSIFIED, 5),
|
||||
encoder.Encode(ExternalReference::debug_break().address()));
|
||||
CHECK_EQ(make_code(UNCLASSIFIED, 6),
|
||||
encoder.Encode(ExternalReference::new_space_start().address()));
|
||||
}
|
||||
|
||||
@ -141,9 +141,9 @@ TEST(ExternalReferenceDecoder) {
|
||||
CHECK_EQ(ExternalReference::address_of_stack_guard_limit().address(),
|
||||
decoder.Decode(make_code(UNCLASSIFIED, 3)));
|
||||
CHECK_EQ(ExternalReference::debug_break().address(),
|
||||
decoder.Decode(make_code(UNCLASSIFIED, 4)));
|
||||
CHECK_EQ(ExternalReference::new_space_start().address(),
|
||||
decoder.Decode(make_code(UNCLASSIFIED, 5)));
|
||||
CHECK_EQ(ExternalReference::new_space_start().address(),
|
||||
decoder.Decode(make_code(UNCLASSIFIED, 6)));
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user