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