Index: src/serialize.cc |
=================================================================== |
--- src/serialize.cc (revision 2931) |
+++ src/serialize.cc (working copy) |
@@ -935,6 +935,19 @@ |
} |
} |
+ // Do not assert that code targets have been converted to object pointers. |
+ virtual void BeginCodeIteration(Code* code) { |
+ } |
+ |
+ virtual void VisitCodeTarget(RelocInfo* rinfo) { |
+ ASSERT(RelocInfo::IsCodeTarget(rinfo->rmode())); |
+ Code* target = Code::GetCodeFromTargetAddress(rinfo->target_address()); |
+ Address encoded_target = serializer_->GetSavedAddress(target); |
+ offsets_.Add(rinfo->target_address_address() - obj_address_); |
+ addresses_.Add(encoded_target); |
+ } |
+ |
+ |
virtual void VisitExternalReferences(Address* start, Address* end) { |
for (Address* p = start; p < end; ++p) { |
uint32_t code = reference_encoder_->Encode(*p); |
@@ -1093,6 +1106,14 @@ |
} |
+void Serializer::VisitCodeTarget(RelocInfo* rinfo) { |
+ ASSERT(RelocInfo::IsCodeTarget(rinfo->rmode())); |
+ Code* target = Code::GetCodeFromTargetAddress(rinfo->target_address()); |
+ bool serialized; |
+ Encode(target, &serialized); |
+} |
+ |
+ |
class GlobalHandlesRetriever: public ObjectVisitor { |
public: |
explicit GlobalHandlesRetriever(List<Object**>* handles) |
@@ -1255,10 +1276,7 @@ |
SaveAddress(obj, addr); |
if (type == CODE_TYPE) { |
- Code* code = Code::cast(obj); |
- // Ensure Code objects contain Object pointers, not Addresses. |
- code->ConvertICTargetsFromAddressToObject(); |
- LOG(CodeMoveEvent(code->address(), addr)); |
+ LOG(CodeMoveEvent(obj->address(), addr)); |
} |
// Write out the object prologue: type, size, and simulated address of obj. |
@@ -1290,12 +1308,6 @@ |
} |
#endif |
- if (type == CODE_TYPE) { |
- Code* code = Code::cast(obj); |
- // Convert relocations from Object* to Address in Code objects |
- code->ConvertICTargetsFromObjectToAddress(); |
- } |
- |
objects_++; |
return addr; |
} |
@@ -1422,6 +1434,14 @@ |
} |
+void Deserializer::VisitCodeTarget(RelocInfo* rinfo) { |
+ ASSERT(RelocInfo::IsCodeTarget(rinfo->rmode())); |
+ Address encoded_address = reinterpret_cast<Address>(rinfo->target_object()); |
+ Code* target_object = reinterpret_cast<Code*>(Resolve(encoded_address)); |
+ rinfo->set_target_address(target_object->instruction_start()); |
+} |
+ |
+ |
void Deserializer::VisitExternalReferences(Address* start, Address* end) { |
for (Address* p = start; p < end; ++p) { |
uint32_t code = static_cast<uint32_t>(reinterpret_cast<uintptr_t>(*p)); |
@@ -1617,8 +1637,6 @@ |
if (type == CODE_TYPE) { |
Code* code = Code::cast(obj); |
- // Convert relocations from Object* to Address in Code objects |
- code->ConvertICTargetsFromObjectToAddress(); |
LOG(CodeMoveEvent(a, code->address())); |
} |
objects_++; |