Index: src/serialize.cc |
diff --git a/src/serialize.cc b/src/serialize.cc |
index 81a94ddc8a09fdb9627f911c7fdcd4cd023661e4..f8681e61bba918fdeb54c15f04c7b6f609eae523 100644 |
--- a/src/serialize.cc |
+++ b/src/serialize.cc |
@@ -761,6 +761,14 @@ void Deserializer::ReadObject(int space_number, |
static const int kUnknownOffsetFromStart = -1; |
+#ifdef V8_TARGET_ARCH_MIPS |
+#define PATCH_SITE_ADJUST(addr) \ |
+ (addr - 3 * kPointerSize) |
+#else |
+#define PATCH_SITE_ADJUST(addr) \ |
+ (addr) |
+#endif |
+ |
void Deserializer::ReadChunk(Object** current, |
Object** limit, |
@@ -833,7 +841,11 @@ void Deserializer::ReadChunk(Object** current, |
if (how == kFromCode) { \ |
Address location_of_branch_data = \ |
reinterpret_cast<Address>(current); \ |
- Assembler::set_target_at(location_of_branch_data, \ |
+ Address patch_site = PATCH_SITE_ADJUST(location_of_branch_data); \ |
+ if (patch_site != location_of_branch_data) { \ |
+ current_was_incremented = true; \ |
+ } \ |
+ Assembler::set_target_at(patch_site, \ |
reinterpret_cast<Address>(new_object)); \ |
if (within == kFirstInstruction) { \ |
location_of_branch_data += Assembler::kCallTargetSize; \ |
@@ -967,6 +979,11 @@ void Deserializer::ReadChunk(Object** current, |
// Deserialize a new object and write a pointer to it to the current |
// object. |
ONE_PER_SPACE(kNewObject, kPlain, kStartOfObject) |
+ // Deserialize a new object from pointer found in code and write |
+ // a pointer to it to the current object. Required only for MIPS. |
+#if V8_TARGET_ARCH_MIPS |
+ ONE_PER_SPACE(kNewObject, kFromCode, kStartOfObject) |
+#endif |
// Support for direct instruction pointers in functions |
ONE_PER_CODE_SPACE(kNewObject, kPlain, kFirstInstruction) |
// Deserialize a new code object and write a pointer to its first |
@@ -976,6 +993,10 @@ void Deserializer::ReadChunk(Object** current, |
// allocation point and write a pointer to it to the current object. |
ALL_SPACES(kBackref, kPlain, kStartOfObject) |
// Find a recently deserialized code object using its offset from the |
+ // current allocation point and write a pointer to it to the current |
+ // object. Required only for MIPS. |
+ ALL_SPACES(kBackref, kFromCode, kStartOfObject) |
+ // Find a recently deserialized code object using its offset from the |
// current allocation point and write a pointer to its first instruction |
// to the current code object or the instruction pointer in a function |
// object. |
@@ -989,6 +1010,10 @@ void Deserializer::ReadChunk(Object** current, |
// start and write a pointer to its first instruction to the current code |
// object. |
ALL_SPACES(kFromStart, kFromCode, kFirstInstruction) |
+ // Find an already deserialized code object using its offset from |
+ // the start and write a pointer to it to the current object. |
+ // Required only for MIPS. |
+ ALL_SPACES(kFromStart, kFromCode, kStartOfObject) |
// Find an object in the roots array and write a pointer to it to the |
// current object. |
CASE_STATEMENT(kRootArray, kPlain, kStartOfObject, 0) |