Index: src/serialize.cc |
diff --git a/src/serialize.cc b/src/serialize.cc |
index d0a1a639f355d88797e3f796a9d424767d2754aa..577366716f080858f8191cf9b04a3b3af82bb4bd 100644 |
--- a/src/serialize.cc |
+++ b/src/serialize.cc |
@@ -761,6 +761,7 @@ void Deserializer::ReadObject(int space_number, |
static const int kUnknownOffsetFromStart = -1; |
+static const int kInstructionsForSplitImmediate = 3*kPointerSize; |
void Deserializer::ReadChunk(Object** current, |
Object** limit, |
@@ -833,7 +834,12 @@ 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 = location_of_branch_data; \ |
+ if (Assembler::kCallTargetSize == 0) { \ |
+ current_was_incremented = true; \ |
+ patch_site -= kInstructionsForSplitImmediate; \ |
+ } \ |
+ Assembler::set_target_at(patch_site, \ |
reinterpret_cast<Address>(new_object)); \ |
if (within == kFirstInstruction) { \ |
location_of_branch_data += Assembler::kCallTargetSize; \ |
@@ -967,6 +973,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 +987,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,10 +1004,21 @@ 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) |
CASE_BODY(kRootArray, kPlain, kStartOfObject, 0, kUnknownOffsetFromStart) |
+ // Required only for MIPS. |
+ CASE_STATEMENT(kRootArray, kFromCode, kStartOfObject, 0) |
+ CASE_BODY(kRootArray, |
+ kFromCode, |
+ kStartOfObject, |
+ 0, |
+ kUnknownOffsetFromStart) |
// Find an object in the partial snapshots cache and write a pointer to it |
// to the current object. |
CASE_STATEMENT(kPartialSnapshotCache, kPlain, kStartOfObject, 0) |