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 2906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2917 DCHECK((RelocInfo::IsJSReturn(rinfo->rmode()) && | 2917 DCHECK((RelocInfo::IsJSReturn(rinfo->rmode()) && |
2918 rinfo->IsPatchedReturnSequence()) || | 2918 rinfo->IsPatchedReturnSequence()) || |
2919 (RelocInfo::IsDebugBreakSlot(rinfo->rmode()) && | 2919 (RelocInfo::IsDebugBreakSlot(rinfo->rmode()) && |
2920 rinfo->IsPatchedDebugBreakSlotSequence())); | 2920 rinfo->IsPatchedDebugBreakSlotSequence())); |
2921 Object* target = Code::GetCodeFromTargetAddress(rinfo->call_address()); | 2921 Object* target = Code::GetCodeFromTargetAddress(rinfo->call_address()); |
2922 VisitPointer(&target); | 2922 VisitPointer(&target); |
2923 rinfo->set_call_address(Code::cast(target)->instruction_start()); | 2923 rinfo->set_call_address(Code::cast(target)->instruction_start()); |
2924 } | 2924 } |
2925 | 2925 |
2926 static inline void UpdateSlot(Heap* heap, Object** slot) { | 2926 static inline void UpdateSlot(Heap* heap, Object** slot) { |
2927 Object* obj = *slot; | 2927 Object* obj = reinterpret_cast<Object*>( |
| 2928 base::NoBarrier_Load(reinterpret_cast<base::AtomicWord*>(slot))); |
2928 | 2929 |
2929 if (!obj->IsHeapObject()) return; | 2930 if (!obj->IsHeapObject()) return; |
2930 | 2931 |
2931 HeapObject* heap_obj = HeapObject::cast(obj); | 2932 HeapObject* heap_obj = HeapObject::cast(obj); |
2932 | 2933 |
2933 MapWord map_word = heap_obj->map_word(); | 2934 MapWord map_word = heap_obj->map_word(); |
2934 if (map_word.IsForwardingAddress()) { | 2935 if (map_word.IsForwardingAddress()) { |
2935 DCHECK(heap->InFromSpace(heap_obj) || | 2936 DCHECK(heap->InFromSpace(heap_obj) || |
2936 MarkCompactCollector::IsOnEvacuationCandidate(heap_obj)); | 2937 MarkCompactCollector::IsOnEvacuationCandidate(heap_obj)); |
2937 HeapObject* target = map_word.ToForwardingAddress(); | 2938 HeapObject* target = map_word.ToForwardingAddress(); |
2938 *slot = target; | 2939 base::NoBarrier_CompareAndSwap( |
| 2940 reinterpret_cast<base::AtomicWord*>(slot), |
| 2941 reinterpret_cast<base::AtomicWord>(obj), |
| 2942 reinterpret_cast<base::AtomicWord>(target)); |
2939 DCHECK(!heap->InFromSpace(target) && | 2943 DCHECK(!heap->InFromSpace(target) && |
2940 !MarkCompactCollector::IsOnEvacuationCandidate(target)); | 2944 !MarkCompactCollector::IsOnEvacuationCandidate(target)); |
2941 } | 2945 } |
2942 } | 2946 } |
2943 | 2947 |
2944 private: | 2948 private: |
2945 inline void UpdatePointer(Object** p) { UpdateSlot(heap_, p); } | 2949 inline void UpdatePointer(Object** p) { UpdateSlot(heap_, p); } |
2946 | 2950 |
2947 Heap* heap_; | 2951 Heap* heap_; |
2948 }; | 2952 }; |
(...skipping 1496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4445 SlotsBuffer* buffer = *buffer_address; | 4449 SlotsBuffer* buffer = *buffer_address; |
4446 while (buffer != NULL) { | 4450 while (buffer != NULL) { |
4447 SlotsBuffer* next_buffer = buffer->next(); | 4451 SlotsBuffer* next_buffer = buffer->next(); |
4448 DeallocateBuffer(buffer); | 4452 DeallocateBuffer(buffer); |
4449 buffer = next_buffer; | 4453 buffer = next_buffer; |
4450 } | 4454 } |
4451 *buffer_address = NULL; | 4455 *buffer_address = NULL; |
4452 } | 4456 } |
4453 } | 4457 } |
4454 } // namespace v8::internal | 4458 } // namespace v8::internal |
OLD | NEW |