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

Unified Diff: src/serialize.cc

Issue 200095: Add near calls (32-bit displacement) to Code objects on X64 platform. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 2 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/objects.cc ('k') | src/x64/assembler-x64.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/serialize.cc
===================================================================
--- src/serialize.cc (revision 3020)
+++ src/serialize.cc (working copy)
@@ -922,7 +922,9 @@
serializer_(serializer),
reference_encoder_(serializer->reference_encoder_),
offsets_(8),
- addresses_(8) {
+ addresses_(8),
+ offsets_32_bit_(0),
+ data_32_bit_(0) {
}
virtual void VisitPointers(Object** start, Object** end) {
@@ -939,9 +941,13 @@
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);
- }
+ // All calls and jumps are to code objects that encode into 32 bits.
+ offsets_32_bit_.Add(rinfo->target_address_address() - obj_address_);
+ uint32_t small_target =
+ static_cast<uint32_t>(reinterpret_cast<uintptr_t>(encoded_target));
+ ASSERT(reinterpret_cast<uintptr_t>(encoded_target) == small_target);
+ data_32_bit_.Add(small_target);
+ }
virtual void VisitExternalReferences(Address* start, Address* end) {
@@ -965,6 +971,10 @@
for (int i = 0; i < offsets_.length(); i++) {
memcpy(start_address + offsets_[i], &addresses_[i], sizeof(Address));
}
+ for (int i = 0; i < offsets_32_bit_.length(); i++) {
+ memcpy(start_address + offsets_32_bit_[i], &data_32_bit_[i],
+ sizeof(uint32_t));
+ }
}
private:
@@ -973,6 +983,10 @@
ExternalReferenceEncoder* reference_encoder_;
List<int> offsets_;
List<Address> addresses_;
+ // Some updates are 32-bit even on a 64-bit platform.
+ // We keep a separate list of them on 64-bit platforms.
+ List<int> offsets_32_bit_;
+ List<uint32_t> data_32_bit_;
};
@@ -1432,7 +1446,9 @@
void Deserializer::VisitCodeTarget(RelocInfo* rinfo) {
ASSERT(RelocInfo::IsCodeTarget(rinfo->rmode()));
- Address encoded_address = reinterpret_cast<Address>(rinfo->target_object());
+ // On all platforms, the encoded code object address is only 32 bits.
+ Address encoded_address = reinterpret_cast<Address>(Memory::uint32_at(
+ reinterpret_cast<Address>(rinfo->target_object_address())));
Code* target_object = reinterpret_cast<Code*>(Resolve(encoded_address));
rinfo->set_target_address(target_object->instruction_start());
}
@@ -1663,7 +1679,6 @@
// Encoded addresses of HeapObjects always have 'HeapObject' tags.
ASSERT(o->IsHeapObject());
-
switch (GetSpace(encoded)) {
// For Map space and Old space, we cache the known Pages in map_pages,
// old_pointer_pages and old_data_pages. Even though MapSpace keeps a list
« no previous file with comments | « src/objects.cc ('k') | src/x64/assembler-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698