Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(551)

Side by Side Diff: src/heap/mark-compact.cc

Issue 1035763002: Add CHECKs when updating pointers from the slots and store buffers (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updatser Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/heap/heap-inl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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());
2887 rinfo->set_target_object(target); 2889 rinfo->set_target_object(target);
2888 } 2890 }
2889 } 2891 }
2890 2892
2891 void VisitCodeTarget(RelocInfo* rinfo) { 2893 void VisitCodeTarget(RelocInfo* rinfo) {
2892 DCHECK(RelocInfo::IsCodeTarget(rinfo->rmode())); 2894 DCHECK(RelocInfo::IsCodeTarget(rinfo->rmode()));
2893 Object* target = Code::GetCodeFromTargetAddress(rinfo->target_address()); 2895 Object* target = Code::GetCodeFromTargetAddress(rinfo->target_address());
2894 Object* old_target = target; 2896 Object* old_target = target;
2895 VisitPointer(&target); 2897 VisitPointer(&target);
2896 if (target != old_target) { 2898 if (target != old_target) {
2899 // TODO(jochen): Remove again after fixing http://crbug.com/452095
2900 CHECK(target->IsHeapObject() == old_target->IsHeapObject());
2897 rinfo->set_target_address(Code::cast(target)->instruction_start()); 2901 rinfo->set_target_address(Code::cast(target)->instruction_start());
2898 } 2902 }
2899 } 2903 }
2900 2904
2901 void VisitCodeAgeSequence(RelocInfo* rinfo) { 2905 void VisitCodeAgeSequence(RelocInfo* rinfo) {
2902 DCHECK(RelocInfo::IsCodeAgeSequence(rinfo->rmode())); 2906 DCHECK(RelocInfo::IsCodeAgeSequence(rinfo->rmode()));
2903 Object* stub = rinfo->code_age_stub(); 2907 Object* stub = rinfo->code_age_stub();
2904 DCHECK(stub != NULL); 2908 DCHECK(stub != NULL);
2905 VisitPointer(&stub); 2909 VisitPointer(&stub);
2906 if (stub != rinfo->code_age_stub()) { 2910 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());
2907 rinfo->set_code_age_stub(Code::cast(stub)); 2913 rinfo->set_code_age_stub(Code::cast(stub));
2908 } 2914 }
2909 } 2915 }
2910 2916
2911 void VisitDebugTarget(RelocInfo* rinfo) { 2917 void VisitDebugTarget(RelocInfo* rinfo) {
2912 DCHECK((RelocInfo::IsJSReturn(rinfo->rmode()) && 2918 DCHECK((RelocInfo::IsJSReturn(rinfo->rmode()) &&
2913 rinfo->IsPatchedReturnSequence()) || 2919 rinfo->IsPatchedReturnSequence()) ||
2914 (RelocInfo::IsDebugBreakSlot(rinfo->rmode()) && 2920 (RelocInfo::IsDebugBreakSlot(rinfo->rmode()) &&
2915 rinfo->IsPatchedDebugBreakSlotSequence())); 2921 rinfo->IsPatchedDebugBreakSlotSequence()));
2916 Object* target = Code::GetCodeFromTargetAddress(rinfo->call_address()); 2922 Object* target = Code::GetCodeFromTargetAddress(rinfo->call_address());
2917 VisitPointer(&target); 2923 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()));
2918 rinfo->set_call_address(Code::cast(target)->instruction_start()); 2927 rinfo->set_call_address(Code::cast(target)->instruction_start());
2919 } 2928 }
2920 2929
2921 static inline void UpdateSlot(Heap* heap, Object** slot) { 2930 static inline void UpdateSlot(Heap* heap, Object** slot) {
2922 Object* obj = reinterpret_cast<Object*>( 2931 Object* obj = reinterpret_cast<Object*>(
2923 base::NoBarrier_Load(reinterpret_cast<base::AtomicWord*>(slot))); 2932 base::NoBarrier_Load(reinterpret_cast<base::AtomicWord*>(slot)));
2924 2933
2925 if (!obj->IsHeapObject()) return; 2934 if (!obj->IsHeapObject()) return;
2926 2935
2927 HeapObject* heap_obj = HeapObject::cast(obj); 2936 HeapObject* heap_obj = HeapObject::cast(obj);
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
3052 3061
3053 3062
3054 static void UpdatePointer(HeapObject** address, HeapObject* object) { 3063 static void UpdatePointer(HeapObject** address, HeapObject* object) {
3055 MapWord map_word = object->map_word(); 3064 MapWord map_word = object->map_word();
3056 // The store buffer can still contain stale pointers in dead large objects. 3065 // The store buffer can still contain stale pointers in dead large objects.
3057 // Ignore these pointers here. 3066 // Ignore these pointers here.
3058 DCHECK(map_word.IsForwardingAddress() || 3067 DCHECK(map_word.IsForwardingAddress() ||
3059 object->GetHeap()->lo_space()->FindPage( 3068 object->GetHeap()->lo_space()->FindPage(
3060 reinterpret_cast<Address>(address)) != NULL); 3069 reinterpret_cast<Address>(address)) != NULL);
3061 if (map_word.IsForwardingAddress()) { 3070 if (map_word.IsForwardingAddress()) {
3071 // TODO(jochen): Remove again after fixing http://crbug.com/452095
3072 CHECK((*address)->IsHeapObject() ==
3073 map_word.ToForwardingAddress()->IsHeapObject());
3062 // Update the corresponding slot. 3074 // Update the corresponding slot.
3063 *address = map_word.ToForwardingAddress(); 3075 *address = map_word.ToForwardingAddress();
3064 } 3076 }
3065 } 3077 }
3066 3078
3067 3079
3068 static String* UpdateReferenceInExternalStringTableEntry(Heap* heap, 3080 static String* UpdateReferenceInExternalStringTableEntry(Heap* heap,
3069 Object** p) { 3081 Object** p) {
3070 MapWord map_word = HeapObject::cast(*p)->map_word(); 3082 MapWord map_word = HeapObject::cast(*p)->map_word();
3071 3083
(...skipping 1678 matching lines...) Expand 10 before | Expand all | Expand 10 after
4750 SlotsBuffer* buffer = *buffer_address; 4762 SlotsBuffer* buffer = *buffer_address;
4751 while (buffer != NULL) { 4763 while (buffer != NULL) {
4752 SlotsBuffer* next_buffer = buffer->next(); 4764 SlotsBuffer* next_buffer = buffer->next();
4753 DeallocateBuffer(buffer); 4765 DeallocateBuffer(buffer);
4754 buffer = next_buffer; 4766 buffer = next_buffer;
4755 } 4767 }
4756 *buffer_address = NULL; 4768 *buffer_address = NULL;
4757 } 4769 }
4758 } 4770 }
4759 } // namespace v8::internal 4771 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap/heap-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698