* Fix new snapshot code on ARM.

Review URL: http://codereview.chromium.org/344011

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3161 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
erik.corry@gmail.com 2009-10-28 12:37:54 +00:00
parent b5dd1e3a82
commit 97de363ef5
6 changed files with 26 additions and 8 deletions

View File

@ -245,6 +245,12 @@ Address Assembler::target_address_at(Address pc) {
}
void Assembler::set_target_at(Address constant_pool_entry,
Address target) {
Memory::Address_at(constant_pool_entry) = target;
}
void Assembler::set_target_address_at(Address pc, Address target) {
Memory::Address_at(target_address_address_at(pc)) = target;
// Intuitively, we would think it is necessary to flush the instruction cache

View File

@ -437,6 +437,9 @@ class Assembler : public Malloced {
INLINE(static Address target_address_at(Address pc));
INLINE(static void set_target_address_at(Address pc, Address target));
// Modify the code target address in a constant pool entry.
inline static void set_target_at(Address constant_pool_entry, Address target);
// Here we are patching the address in the constant pool, not the actual call
// instruction. The address in the constant pool is the same size as a
// pointer.

View File

@ -439,6 +439,12 @@ class Assembler : public Malloced {
inline static Address target_address_at(Address pc);
inline static void set_target_address_at(Address pc, Address target);
// This sets the branch destination (which is in the instruction on x86).
inline static void set_target_at(Address instruction_payload,
Address target) {
set_target_address_at(instruction_payload, target);
}
static const int kCallTargetSize = kPointerSize;
// Distance between the address of the code target in the call instruction

View File

@ -1949,8 +1949,8 @@ bool Deserializer2::ReadObject(Object** write_back) {
Code* code_object = reinterpret_cast<Code*>(new_code_object);
// Setting a branch/call to another code object from code.
Address location_of_branch_data = reinterpret_cast<Address>(current);
Assembler::set_target_address_at(location_of_branch_data,
code_object->instruction_start());
Assembler::set_target_at(location_of_branch_data,
code_object->instruction_start());
location_of_branch_data += Assembler::kCallTargetSize;
current = reinterpret_cast<Object**>(location_of_branch_data);
break;
@ -1972,8 +1972,8 @@ bool Deserializer2::ReadObject(Object** write_back) {
Code* code_object = reinterpret_cast<Code*>(GetAddress(backref_space));
// Setting a branch/call to previously decoded code object from code.
Address location_of_branch_data = reinterpret_cast<Address>(current);
Assembler::set_target_address_at(location_of_branch_data,
code_object->instruction_start());
Assembler::set_target_at(location_of_branch_data,
code_object->instruction_start());
location_of_branch_data += Assembler::kCallTargetSize;
current = reinterpret_cast<Object**>(location_of_branch_data);
break;
@ -2173,6 +2173,8 @@ void Serializer2::ObjectSerializer::OutputRawData(Address up_to) {
Address object_start = object_->address();
int up_to_offset = up_to - object_start;
int skipped = up_to_offset - bytes_processed_so_far_;
// This assert will fail if the reloc info gives us the target_address_address
// locations in a non-ascending order. Luckily that doesn't happen.
ASSERT(skipped >= 0);
if (skipped != 0) {
sink_->Put(RAW_DATA_SERIALIZATION, "raw data");

View File

@ -458,6 +458,11 @@ class Assembler : public Malloced {
// the relative displacements stored in the code.
static inline Address target_address_at(Address pc);
static inline void set_target_address_at(Address pc, Address target);
// This sets the branch destination (which is in the instruction on x64).
inline static void set_target_at(Address instruction_payload,
Address target) {
set_target_address_at(instruction_payload, target);
}
inline Handle<Object> code_target_object_handle_at(Address pc);
// Number of bytes taken up by the branch target in the code.
static const int kCallTargetSize = 4; // Use 32-bit displacement.

View File

@ -47,10 +47,6 @@ test-serialize/DependentTestThatAlwaysFails: FAIL
[ $arch == arm ]
# New serialization doesn't work on ARM yet.
test-serialize/Deserialize2: SKIP
test-serialize/DeserializeAndRunScript2: SKIP
# BUG(113): Test seems flaky on ARM.
test-spaces/LargeObjectSpace: PASS || FAIL