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/base/atomicops.h" | 7 #include "src/base/atomicops.h" |
8 #include "src/base/bits.h" | 8 #include "src/base/bits.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/compilation-cache.h" | 10 #include "src/compilation-cache.h" |
(...skipping 2866 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2877 } | 2877 } |
2878 | 2878 |
2879 void VisitEmbeddedPointer(RelocInfo* rinfo) { | 2879 void VisitEmbeddedPointer(RelocInfo* rinfo) { |
2880 DCHECK(rinfo->rmode() == RelocInfo::EMBEDDED_OBJECT); | 2880 DCHECK(rinfo->rmode() == RelocInfo::EMBEDDED_OBJECT); |
2881 Object* target = rinfo->target_object(); | 2881 Object* target = rinfo->target_object(); |
2882 Object* old_target = target; | 2882 Object* old_target = target; |
2883 VisitPointer(&target); | 2883 VisitPointer(&target); |
2884 // Avoid unnecessary changes that might unnecessary flush the instruction | 2884 // Avoid unnecessary changes that might unnecessary flush the instruction |
2885 // cache. | 2885 // cache. |
2886 if (target != old_target) { | 2886 if (target != old_target) { |
2887 // TODO(jochen): Remove again after fixing http://crbug.com/452095 | |
2888 CHECK(target->IsHeapObject() == old_target->IsHeapObject()); | |
2889 rinfo->set_target_object(target); | 2887 rinfo->set_target_object(target); |
2890 } | 2888 } |
2891 } | 2889 } |
2892 | 2890 |
2893 void VisitCodeTarget(RelocInfo* rinfo) { | 2891 void VisitCodeTarget(RelocInfo* rinfo) { |
2894 DCHECK(RelocInfo::IsCodeTarget(rinfo->rmode())); | 2892 DCHECK(RelocInfo::IsCodeTarget(rinfo->rmode())); |
2895 Object* target = Code::GetCodeFromTargetAddress(rinfo->target_address()); | 2893 Object* target = Code::GetCodeFromTargetAddress(rinfo->target_address()); |
2896 Object* old_target = target; | 2894 Object* old_target = target; |
2897 VisitPointer(&target); | 2895 VisitPointer(&target); |
2898 if (target != old_target) { | 2896 if (target != old_target) { |
2899 // TODO(jochen): Remove again after fixing http://crbug.com/452095 | |
2900 CHECK(target->IsHeapObject() == old_target->IsHeapObject()); | |
2901 rinfo->set_target_address(Code::cast(target)->instruction_start()); | 2897 rinfo->set_target_address(Code::cast(target)->instruction_start()); |
2902 } | 2898 } |
2903 } | 2899 } |
2904 | 2900 |
2905 void VisitCodeAgeSequence(RelocInfo* rinfo) { | 2901 void VisitCodeAgeSequence(RelocInfo* rinfo) { |
2906 DCHECK(RelocInfo::IsCodeAgeSequence(rinfo->rmode())); | 2902 DCHECK(RelocInfo::IsCodeAgeSequence(rinfo->rmode())); |
2907 Object* stub = rinfo->code_age_stub(); | 2903 Object* stub = rinfo->code_age_stub(); |
2908 DCHECK(stub != NULL); | 2904 DCHECK(stub != NULL); |
2909 VisitPointer(&stub); | 2905 VisitPointer(&stub); |
2910 if (stub != rinfo->code_age_stub()) { | 2906 if (stub != rinfo->code_age_stub()) { |
2911 // TODO(jochen): Remove again after fixing http://crbug.com/452095 | |
2912 CHECK(stub->IsHeapObject() == rinfo->code_age_stub()->IsHeapObject()); | |
2913 rinfo->set_code_age_stub(Code::cast(stub)); | 2907 rinfo->set_code_age_stub(Code::cast(stub)); |
2914 } | 2908 } |
2915 } | 2909 } |
2916 | 2910 |
2917 void VisitDebugTarget(RelocInfo* rinfo) { | 2911 void VisitDebugTarget(RelocInfo* rinfo) { |
2918 DCHECK((RelocInfo::IsJSReturn(rinfo->rmode()) && | 2912 DCHECK((RelocInfo::IsJSReturn(rinfo->rmode()) && |
2919 rinfo->IsPatchedReturnSequence()) || | 2913 rinfo->IsPatchedReturnSequence()) || |
2920 (RelocInfo::IsDebugBreakSlot(rinfo->rmode()) && | 2914 (RelocInfo::IsDebugBreakSlot(rinfo->rmode()) && |
2921 rinfo->IsPatchedDebugBreakSlotSequence())); | 2915 rinfo->IsPatchedDebugBreakSlotSequence())); |
2922 Object* target = Code::GetCodeFromTargetAddress(rinfo->call_address()); | 2916 Object* target = Code::GetCodeFromTargetAddress(rinfo->call_address()); |
2923 VisitPointer(&target); | 2917 VisitPointer(&target); |
2924 // TODO(jochen): Remove again after fixing http://crbug.com/452095 | |
2925 CHECK(target->IsCode() && | |
2926 HAS_SMI_TAG(Code::cast(target)->instruction_start())); | |
2927 rinfo->set_call_address(Code::cast(target)->instruction_start()); | 2918 rinfo->set_call_address(Code::cast(target)->instruction_start()); |
2928 } | 2919 } |
2929 | 2920 |
2930 static inline void UpdateSlot(Heap* heap, Object** slot) { | 2921 static inline void UpdateSlot(Heap* heap, Object** slot) { |
2931 Object* obj = reinterpret_cast<Object*>( | 2922 Object* obj = reinterpret_cast<Object*>( |
2932 base::NoBarrier_Load(reinterpret_cast<base::AtomicWord*>(slot))); | 2923 base::NoBarrier_Load(reinterpret_cast<base::AtomicWord*>(slot))); |
2933 | 2924 |
2934 if (!obj->IsHeapObject()) return; | 2925 if (!obj->IsHeapObject()) return; |
2935 | 2926 |
2936 HeapObject* heap_obj = HeapObject::cast(obj); | 2927 HeapObject* heap_obj = HeapObject::cast(obj); |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3061 | 3052 |
3062 | 3053 |
3063 static void UpdatePointer(HeapObject** address, HeapObject* object) { | 3054 static void UpdatePointer(HeapObject** address, HeapObject* object) { |
3064 MapWord map_word = object->map_word(); | 3055 MapWord map_word = object->map_word(); |
3065 // The store buffer can still contain stale pointers in dead large objects. | 3056 // The store buffer can still contain stale pointers in dead large objects. |
3066 // Ignore these pointers here. | 3057 // Ignore these pointers here. |
3067 DCHECK(map_word.IsForwardingAddress() || | 3058 DCHECK(map_word.IsForwardingAddress() || |
3068 object->GetHeap()->lo_space()->FindPage( | 3059 object->GetHeap()->lo_space()->FindPage( |
3069 reinterpret_cast<Address>(address)) != NULL); | 3060 reinterpret_cast<Address>(address)) != NULL); |
3070 if (map_word.IsForwardingAddress()) { | 3061 if (map_word.IsForwardingAddress()) { |
3071 // TODO(jochen): Remove again after fixing http://crbug.com/452095 | |
3072 CHECK((*address)->IsHeapObject() == | |
3073 map_word.ToForwardingAddress()->IsHeapObject()); | |
3074 // Update the corresponding slot. | 3062 // Update the corresponding slot. |
3075 *address = map_word.ToForwardingAddress(); | 3063 *address = map_word.ToForwardingAddress(); |
3076 } | 3064 } |
3077 } | 3065 } |
3078 | 3066 |
3079 | 3067 |
3080 static String* UpdateReferenceInExternalStringTableEntry(Heap* heap, | 3068 static String* UpdateReferenceInExternalStringTableEntry(Heap* heap, |
3081 Object** p) { | 3069 Object** p) { |
3082 MapWord map_word = HeapObject::cast(*p)->map_word(); | 3070 MapWord map_word = HeapObject::cast(*p)->map_word(); |
3083 | 3071 |
(...skipping 1678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4762 SlotsBuffer* buffer = *buffer_address; | 4750 SlotsBuffer* buffer = *buffer_address; |
4763 while (buffer != NULL) { | 4751 while (buffer != NULL) { |
4764 SlotsBuffer* next_buffer = buffer->next(); | 4752 SlotsBuffer* next_buffer = buffer->next(); |
4765 DeallocateBuffer(buffer); | 4753 DeallocateBuffer(buffer); |
4766 buffer = next_buffer; | 4754 buffer = next_buffer; |
4767 } | 4755 } |
4768 *buffer_address = NULL; | 4756 *buffer_address = NULL; |
4769 } | 4757 } |
4770 } | 4758 } |
4771 } // namespace v8::internal | 4759 } // namespace v8::internal |
OLD | NEW |