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/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/compilation-cache.h" | 9 #include "src/compilation-cache.h" |
10 #include "src/cpu-profiler.h" | 10 #include "src/cpu-profiler.h" |
(...skipping 2927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2938 // with NULL. In this case we do not need to transfer this entry to | 2938 // with NULL. In this case we do not need to transfer this entry to |
2939 // the store buffer which we are rebuilding. | 2939 // the store buffer which we are rebuilding. |
2940 // We perform the pointer update with a no barrier compare-and-swap. The | 2940 // We perform the pointer update with a no barrier compare-and-swap. The |
2941 // compare and swap may fail in the case where the pointer update tries to | 2941 // compare and swap may fail in the case where the pointer update tries to |
2942 // update garbage memory which was concurrently accessed by the sweeper. | 2942 // update garbage memory which was concurrently accessed by the sweeper. |
2943 if (new_addr != NULL) { | 2943 if (new_addr != NULL) { |
2944 base::NoBarrier_CompareAndSwap( | 2944 base::NoBarrier_CompareAndSwap( |
2945 reinterpret_cast<base::AtomicWord*>(address), | 2945 reinterpret_cast<base::AtomicWord*>(address), |
2946 reinterpret_cast<base::AtomicWord>(object), | 2946 reinterpret_cast<base::AtomicWord>(object), |
2947 reinterpret_cast<base::AtomicWord>(HeapObject::FromAddress(new_addr))); | 2947 reinterpret_cast<base::AtomicWord>(HeapObject::FromAddress(new_addr))); |
2948 } else { | |
2949 // We have to zap this pointer, because the store buffer may overflow later, | |
2950 // and then we have to scan the entire heap and we don't want to find | |
2951 // spurious newspace pointers in the old space. | |
2952 // TODO(mstarzinger): This was changed to a sentinel value to track down | |
2953 // rare crashes, change it back to Smi::FromInt(0) later. | |
2954 base::NoBarrier_CompareAndSwap( | |
2955 reinterpret_cast<base::AtomicWord*>(address), | |
2956 reinterpret_cast<base::AtomicWord>(object), | |
2957 reinterpret_cast<base::AtomicWord>(Smi::FromInt(0x0f100d00 >> 1))); | |
2958 } | 2948 } |
2959 } | 2949 } |
2960 | 2950 |
2961 | 2951 |
2962 static String* UpdateReferenceInExternalStringTableEntry(Heap* heap, | 2952 static String* UpdateReferenceInExternalStringTableEntry(Heap* heap, |
2963 Object** p) { | 2953 Object** p) { |
2964 MapWord map_word = HeapObject::cast(*p)->map_word(); | 2954 MapWord map_word = HeapObject::cast(*p)->map_word(); |
2965 | 2955 |
2966 if (map_word.IsForwardingAddress()) { | 2956 if (map_word.IsForwardingAddress()) { |
2967 return String::cast(map_word.ToForwardingAddress()); | 2957 return String::cast(map_word.ToForwardingAddress()); |
(...skipping 1714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4682 SlotsBuffer* buffer = *buffer_address; | 4672 SlotsBuffer* buffer = *buffer_address; |
4683 while (buffer != NULL) { | 4673 while (buffer != NULL) { |
4684 SlotsBuffer* next_buffer = buffer->next(); | 4674 SlotsBuffer* next_buffer = buffer->next(); |
4685 DeallocateBuffer(buffer); | 4675 DeallocateBuffer(buffer); |
4686 buffer = next_buffer; | 4676 buffer = next_buffer; |
4687 } | 4677 } |
4688 *buffer_address = NULL; | 4678 *buffer_address = NULL; |
4689 } | 4679 } |
4690 } | 4680 } |
4691 } // namespace v8::internal | 4681 } // namespace v8::internal |
OLD | NEW |