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 2864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2875 DCHECK((RelocInfo::IsJSReturn(rinfo->rmode()) && | 2875 DCHECK((RelocInfo::IsJSReturn(rinfo->rmode()) && |
2876 rinfo->IsPatchedReturnSequence()) || | 2876 rinfo->IsPatchedReturnSequence()) || |
2877 (RelocInfo::IsDebugBreakSlot(rinfo->rmode()) && | 2877 (RelocInfo::IsDebugBreakSlot(rinfo->rmode()) && |
2878 rinfo->IsPatchedDebugBreakSlotSequence())); | 2878 rinfo->IsPatchedDebugBreakSlotSequence())); |
2879 Object* target = Code::GetCodeFromTargetAddress(rinfo->call_address()); | 2879 Object* target = Code::GetCodeFromTargetAddress(rinfo->call_address()); |
2880 VisitPointer(&target); | 2880 VisitPointer(&target); |
2881 rinfo->set_call_address(Code::cast(target)->instruction_start()); | 2881 rinfo->set_call_address(Code::cast(target)->instruction_start()); |
2882 } | 2882 } |
2883 | 2883 |
2884 static inline void UpdateSlot(Heap* heap, Object** slot) { | 2884 static inline void UpdateSlot(Heap* heap, Object** slot) { |
2885 Object* obj = *slot; | 2885 Object* obj = reinterpret_cast<Object*>( |
| 2886 base::NoBarrier_Load(reinterpret_cast<base::AtomicWord*>(slot))); |
2886 | 2887 |
2887 if (!obj->IsHeapObject()) return; | 2888 if (!obj->IsHeapObject()) return; |
2888 | 2889 |
2889 HeapObject* heap_obj = HeapObject::cast(obj); | 2890 HeapObject* heap_obj = HeapObject::cast(obj); |
2890 | 2891 |
2891 MapWord map_word = heap_obj->map_word(); | 2892 MapWord map_word = heap_obj->map_word(); |
2892 if (map_word.IsForwardingAddress()) { | 2893 if (map_word.IsForwardingAddress()) { |
2893 DCHECK(heap->InFromSpace(heap_obj) || | 2894 DCHECK(heap->InFromSpace(heap_obj) || |
2894 MarkCompactCollector::IsOnEvacuationCandidate(heap_obj)); | 2895 MarkCompactCollector::IsOnEvacuationCandidate(heap_obj)); |
2895 HeapObject* target = map_word.ToForwardingAddress(); | 2896 HeapObject* target = map_word.ToForwardingAddress(); |
2896 *slot = target; | 2897 base::NoBarrier_CompareAndSwap( |
| 2898 reinterpret_cast<base::AtomicWord*>(slot), |
| 2899 reinterpret_cast<base::AtomicWord>(obj), |
| 2900 reinterpret_cast<base::AtomicWord>(target)); |
2897 DCHECK(!heap->InFromSpace(target) && | 2901 DCHECK(!heap->InFromSpace(target) && |
2898 !MarkCompactCollector::IsOnEvacuationCandidate(target)); | 2902 !MarkCompactCollector::IsOnEvacuationCandidate(target)); |
2899 } | 2903 } |
2900 } | 2904 } |
2901 | 2905 |
2902 private: | 2906 private: |
2903 inline void UpdatePointer(Object** p) { UpdateSlot(heap_, p); } | 2907 inline void UpdatePointer(Object** p) { UpdateSlot(heap_, p); } |
2904 | 2908 |
2905 Heap* heap_; | 2909 Heap* heap_; |
2906 }; | 2910 }; |
(...skipping 1496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4403 SlotsBuffer* buffer = *buffer_address; | 4407 SlotsBuffer* buffer = *buffer_address; |
4404 while (buffer != NULL) { | 4408 while (buffer != NULL) { |
4405 SlotsBuffer* next_buffer = buffer->next(); | 4409 SlotsBuffer* next_buffer = buffer->next(); |
4406 DeallocateBuffer(buffer); | 4410 DeallocateBuffer(buffer); |
4407 buffer = next_buffer; | 4411 buffer = next_buffer; |
4408 } | 4412 } |
4409 *buffer_address = NULL; | 4413 *buffer_address = NULL; |
4410 } | 4414 } |
4411 } | 4415 } |
4412 } // namespace v8::internal | 4416 } // namespace v8::internal |
OLD | NEW |