OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/api.h" | 8 #include "src/api.h" |
9 #include "src/base/platform/platform.h" | 9 #include "src/base/platform/platform.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
892 | 892 |
893 Object* write_back_obj = obj; | 893 Object* write_back_obj = obj; |
894 UnalignedCopy(write_back, &write_back_obj); | 894 UnalignedCopy(write_back, &write_back_obj); |
895 #ifdef DEBUG | 895 #ifdef DEBUG |
896 if (obj->IsCode()) { | 896 if (obj->IsCode()) { |
897 DCHECK(space_number == CODE_SPACE || space_number == LO_SPACE); | 897 DCHECK(space_number == CODE_SPACE || space_number == LO_SPACE); |
898 } else { | 898 } else { |
899 DCHECK(space_number != CODE_SPACE); | 899 DCHECK(space_number != CODE_SPACE); |
900 } | 900 } |
901 #endif | 901 #endif |
| 902 #if V8_TARGET_ARCH_PPC && \ |
| 903 (ABI_USES_FUNCTION_DESCRIPTORS || V8_OOL_CONSTANT_POOL) |
| 904 // If we're on a platform that uses function descriptors |
| 905 // these jump tables make use of RelocInfo::INTERNAL_REFERENCE. |
| 906 // As the V8 serialization code doesn't handle that relocation type |
| 907 // we use this to fix up code that has function descriptors. |
| 908 if (space_number == CODE_SPACE) { |
| 909 Code* code = reinterpret_cast<Code*>(HeapObject::FromAddress(address)); |
| 910 for (RelocIterator it(code); !it.done(); it.next()) { |
| 911 RelocInfo::Mode rmode = it.rinfo()->rmode(); |
| 912 if (rmode == RelocInfo::INTERNAL_REFERENCE) { |
| 913 Assembler::RelocateInternalReference(it.rinfo()->pc(), 0, |
| 914 code->instruction_start()); |
| 915 } |
| 916 } |
| 917 } |
| 918 #endif |
902 } | 919 } |
903 | 920 |
904 | 921 |
905 // We know the space requirements before deserialization and can | 922 // We know the space requirements before deserialization and can |
906 // pre-allocate that reserved space. During deserialization, all we need | 923 // pre-allocate that reserved space. During deserialization, all we need |
907 // to do is to bump up the pointer for each space in the reserved | 924 // to do is to bump up the pointer for each space in the reserved |
908 // space. This is also used for fixing back references. | 925 // space. This is also used for fixing back references. |
909 // We may have to split up the pre-allocation into several chunks | 926 // We may have to split up the pre-allocation into several chunks |
910 // because it would not fit onto a single page. We do not have to keep | 927 // because it would not fit onto a single page. We do not have to keep |
911 // track of when to move to the next chunk. An opcode will signal this. | 928 // track of when to move to the next chunk. An opcode will signal this. |
(...skipping 1636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2548 return GetHeaderValue(kNumInternalizedStringsOffset); | 2565 return GetHeaderValue(kNumInternalizedStringsOffset); |
2549 } | 2566 } |
2550 | 2567 |
2551 Vector<const uint32_t> SerializedCodeData::CodeStubKeys() const { | 2568 Vector<const uint32_t> SerializedCodeData::CodeStubKeys() const { |
2552 int reservations_size = GetHeaderValue(kReservationsOffset) * kInt32Size; | 2569 int reservations_size = GetHeaderValue(kReservationsOffset) * kInt32Size; |
2553 const byte* start = data_ + kHeaderSize + reservations_size; | 2570 const byte* start = data_ + kHeaderSize + reservations_size; |
2554 return Vector<const uint32_t>(reinterpret_cast<const uint32_t*>(start), | 2571 return Vector<const uint32_t>(reinterpret_cast<const uint32_t*>(start), |
2555 GetHeaderValue(kNumCodeStubKeysOffset)); | 2572 GetHeaderValue(kNumCodeStubKeysOffset)); |
2556 } | 2573 } |
2557 } } // namespace v8::internal | 2574 } } // namespace v8::internal |
OLD | NEW |