Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(148)

Unified Diff: src/serialize.cc

Issue 207012: Don't convert jump and call targets to code object pointers when (de)serializ... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/serialize.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_++;
« no previous file with comments | « src/serialize.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698