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 && \ | 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 | 903 // If we're on a platform that uses function descriptors |
905 // these jump tables make use of RelocInfo::INTERNAL_REFERENCE. | 904 // these jump tables make use of RelocInfo::INTERNAL_REFERENCE. |
906 // As the V8 serialization code doesn't handle that relocation type | 905 // As the V8 serialization code doesn't handle that relocation type |
907 // we use this to fix up code that has function descriptors. | 906 // we use this to fix up code that has function descriptors. |
908 if (space_number == CODE_SPACE) { | 907 if (space_number == CODE_SPACE) { |
909 Code* code = reinterpret_cast<Code*>(HeapObject::FromAddress(address)); | 908 Code* code = reinterpret_cast<Code*>(HeapObject::FromAddress(address)); |
910 for (RelocIterator it(code); !it.done(); it.next()) { | 909 for (RelocIterator it(code); !it.done(); it.next()) { |
911 RelocInfo::Mode rmode = it.rinfo()->rmode(); | 910 RelocInfo::Mode rmode = it.rinfo()->rmode(); |
912 if (rmode == RelocInfo::INTERNAL_REFERENCE) { | 911 if (RelocInfo::IsInternalReference(rmode) || |
| 912 RelocInfo::IsInternalReferenceEncoded(rmode)) { |
913 Assembler::RelocateInternalReference(it.rinfo()->pc(), 0, | 913 Assembler::RelocateInternalReference(it.rinfo()->pc(), 0, |
914 code->instruction_start()); | 914 code->instruction_start(), rmode); |
915 } | 915 } |
916 } | 916 } |
917 } | 917 } |
918 #endif | 918 #endif |
919 } | 919 } |
920 | 920 |
921 | 921 |
922 // We know the space requirements before deserialization and can | 922 // We know the space requirements before deserialization and can |
923 // pre-allocate that reserved space. During deserialization, all we need | 923 // pre-allocate that reserved space. During deserialization, all we need |
924 // 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 |
(...skipping 1747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2672 DisallowHeapAllocation no_gc; | 2672 DisallowHeapAllocation no_gc; |
2673 SerializedCodeData* scd = new SerializedCodeData(cached_data); | 2673 SerializedCodeData* scd = new SerializedCodeData(cached_data); |
2674 SanityCheckResult r = scd->SanityCheck(source); | 2674 SanityCheckResult r = scd->SanityCheck(source); |
2675 if (r == CHECK_SUCCESS) return scd; | 2675 if (r == CHECK_SUCCESS) return scd; |
2676 cached_data->Reject(); | 2676 cached_data->Reject(); |
2677 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); | 2677 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); |
2678 delete scd; | 2678 delete scd; |
2679 return NULL; | 2679 return NULL; |
2680 } | 2680 } |
2681 } } // namespace v8::internal | 2681 } } // namespace v8::internal |
OLD | NEW |