Chromium Code Reviews| Index: src/serialize.cc |
| diff --git a/src/serialize.cc b/src/serialize.cc |
| index 4249d369d54a49487baccc0522f95a85fc17294e..8757d1427806a779cdb74f5a5705fbfd0ce0a45f 100644 |
| --- a/src/serialize.cc |
| +++ b/src/serialize.cc |
| @@ -777,6 +777,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) |
|
Erik Corry
2012/03/17 02:49:18
This should be kInstructionSize (and I moved the f
|
| +#else |
| +#define PATCH_SITE_ADJUST(addr) \ |
| + (addr) |
| +#endif |
| + |
| void Deserializer::ReadChunk(Object** current, |
| Object** limit, |
| @@ -849,7 +857,11 @@ void Deserializer::ReadChunk(Object** current, |
| if (how == kFromCode) { \ |
| Address location_of_branch_data = \ |
| reinterpret_cast<Address>(current); \ |
|
Erik Corry
2012/03/17 02:49:18
It turns out this code can be simplified a little
|
| - 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; \ |
| @@ -983,6 +995,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 |
| @@ -992,6 +1009,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) |
|
Erik Corry
2012/03/17 02:49:18
The order is not important here so I moved these i
|
| + // 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. |
| @@ -1005,6 +1026,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) |