Index: src/serialize.cc |
diff --git a/src/serialize.cc b/src/serialize.cc |
index 4b28d23fe9ac060f73c46c84fb5076739c99a7f5..eda9771b511e91a8ce8f30ff5246d2a351114b7e 100644 |
--- a/src/serialize.cc |
+++ b/src/serialize.cc |
@@ -800,6 +800,23 @@ void Deserializer::ReadObject(int space_number, |
bool is_codespace = (space_number == CODE_SPACE); |
DCHECK(obj->IsCode() == is_codespace); |
#endif |
+#if V8_TARGET_ARCH_PPC && \ |
+ (ABI_USES_FUNCTION_DESCRIPTORS || V8_OOL_CONSTANT_POOL) |
+ // If we're on a platform that uses function descriptors |
+ // these jump tables make use of RelocInfo::INTERNAL_REFERENCE. |
+ // As the V8 serialization code doesn't handle that relocation type |
+ // we use this hack to fix up code that has function descriptors. |
+ if (space_number == CODE_SPACE) { |
+ Code* code = reinterpret_cast<Code*>(HeapObject::FromAddress(address)); |
+ for (RelocIterator it(code); !it.done(); it.next()) { |
+ RelocInfo::Mode rmode = it.rinfo()->rmode(); |
+ if (rmode == RelocInfo::INTERNAL_REFERENCE) { |
+ Assembler::RelocateInternalReference(it.rinfo()->pc(), 0, |
+ code->instruction_start()); |
+ } |
+ } |
+ } |
+#endif |
} |
void Deserializer::ReadChunk(Object** current, |
@@ -1062,16 +1079,16 @@ void Deserializer::ReadChunk(Object** current, |
// allocation point and write a pointer to it to the current object. |
ALL_SPACES(kBackref, kPlain, kStartOfObject) |
ALL_SPACES(kBackrefWithSkip, kPlain, kStartOfObject) |
-#if defined(V8_TARGET_ARCH_MIPS) || V8_OOL_CONSTANT_POOL || \ |
- defined(V8_TARGET_ARCH_MIPS64) |
+#if defined(V8_TARGET_ARCH_MIPS) || defined(V8_TARGET_ARCH_MIPS64) || \ |
+ defined(V8_TARGET_ARCH_PPC) || V8_OOL_CONSTANT_POOL |
// Deserialize a new object from pointer found in code and write |
- // a pointer to it to the current object. Required only for MIPS or ARM |
- // with ool constant pool, and omitted on the other architectures because |
- // it is fully unrolled and would cause bloat. |
+ // a pointer to it to the current object. Required only for MIPS, PPC or |
+ // ARM with ool constant pool, and omitted on the other architectures |
+ // because it is fully unrolled and would cause bloat. |
ALL_SPACES(kNewObject, kFromCode, 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 or ARM with ool constant pool. |
+ // object. Required only for MIPS, PPC or ARM with ool constant pool. |
ALL_SPACES(kBackref, kFromCode, kStartOfObject) |
ALL_SPACES(kBackrefWithSkip, kFromCode, kStartOfObject) |
#endif |
@@ -1291,8 +1308,8 @@ int Serializer::RootIndex(HeapObject* heap_object, HowToCode from) { |
for (int i = 0; i < root_index_wave_front_; i++) { |
Object* root = heap->roots_array_start()[i]; |
if (!root->IsSmi() && root == heap_object) { |
-#if defined(V8_TARGET_ARCH_MIPS) || V8_OOL_CONSTANT_POOL || \ |
- defined(V8_TARGET_ARCH_MIPS64) |
+#if defined(V8_TARGET_ARCH_MIPS) || defined(V8_TARGET_ARCH_MIPS64) || \ |
+ defined(V8_TARGET_ARCH_PPC) || V8_OOL_CONSTANT_POOL |
if (from == kFromCode) { |
// In order to avoid code bloat in the deserializer we don't have |
// support for the encoding that specifies a particular root should |