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/code-stubs.h" | 7 #include "src/code-stubs.h" |
8 #include "src/compilation-cache.h" | 8 #include "src/compilation-cache.h" |
9 #include "src/cpu-profiler.h" | 9 #include "src/cpu-profiler.h" |
10 #include "src/deoptimizer.h" | 10 #include "src/deoptimizer.h" |
(...skipping 2954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2965 static void UpdatePointer(HeapObject** address, HeapObject* object) { | 2965 static void UpdatePointer(HeapObject** address, HeapObject* object) { |
2966 Address new_addr = Memory::Address_at(object->address()); | 2966 Address new_addr = Memory::Address_at(object->address()); |
2967 | 2967 |
2968 // The new space sweep will overwrite the map word of dead objects | 2968 // The new space sweep will overwrite the map word of dead objects |
2969 // with NULL. In this case we do not need to transfer this entry to | 2969 // with NULL. In this case we do not need to transfer this entry to |
2970 // the store buffer which we are rebuilding. | 2970 // the store buffer which we are rebuilding. |
2971 // We perform the pointer update with a no barrier compare-and-swap. The | 2971 // We perform the pointer update with a no barrier compare-and-swap. The |
2972 // compare and swap may fail in the case where the pointer update tries to | 2972 // compare and swap may fail in the case where the pointer update tries to |
2973 // update garbage memory which was concurrently accessed by the sweeper. | 2973 // update garbage memory which was concurrently accessed by the sweeper. |
2974 if (new_addr != NULL) { | 2974 if (new_addr != NULL) { |
2975 NoBarrier_CompareAndSwap( | 2975 base::NoBarrier_CompareAndSwap( |
Jakob Kummerow
2014/06/05 11:49:06
IWYU?
| |
2976 reinterpret_cast<AtomicWord*>(address), | 2976 reinterpret_cast<base::AtomicWord*>(address), |
2977 reinterpret_cast<AtomicWord>(object), | 2977 reinterpret_cast<base::AtomicWord>(object), |
2978 reinterpret_cast<AtomicWord>(HeapObject::FromAddress(new_addr))); | 2978 reinterpret_cast<base::AtomicWord>(HeapObject::FromAddress(new_addr))); |
2979 } else { | 2979 } else { |
2980 // We have to zap this pointer, because the store buffer may overflow later, | 2980 // We have to zap this pointer, because the store buffer may overflow later, |
2981 // and then we have to scan the entire heap and we don't want to find | 2981 // and then we have to scan the entire heap and we don't want to find |
2982 // spurious newspace pointers in the old space. | 2982 // spurious newspace pointers in the old space. |
2983 // TODO(mstarzinger): This was changed to a sentinel value to track down | 2983 // TODO(mstarzinger): This was changed to a sentinel value to track down |
2984 // rare crashes, change it back to Smi::FromInt(0) later. | 2984 // rare crashes, change it back to Smi::FromInt(0) later. |
2985 NoBarrier_CompareAndSwap( | 2985 base::NoBarrier_CompareAndSwap( |
2986 reinterpret_cast<AtomicWord*>(address), | 2986 reinterpret_cast<base::AtomicWord*>(address), |
2987 reinterpret_cast<AtomicWord>(object), | 2987 reinterpret_cast<base::AtomicWord>(object), |
2988 reinterpret_cast<AtomicWord>(Smi::FromInt(0x0f100d00 >> 1))); | 2988 reinterpret_cast<base::AtomicWord>(Smi::FromInt(0x0f100d00 >> 1))); |
2989 } | 2989 } |
2990 } | 2990 } |
2991 | 2991 |
2992 | 2992 |
2993 static String* UpdateReferenceInExternalStringTableEntry(Heap* heap, | 2993 static String* UpdateReferenceInExternalStringTableEntry(Heap* heap, |
2994 Object** p) { | 2994 Object** p) { |
2995 MapWord map_word = HeapObject::cast(*p)->map_word(); | 2995 MapWord map_word = HeapObject::cast(*p)->map_word(); |
2996 | 2996 |
2997 if (map_word.IsForwardingAddress()) { | 2997 if (map_word.IsForwardingAddress()) { |
2998 return String::cast(map_word.ToForwardingAddress()); | 2998 return String::cast(map_word.ToForwardingAddress()); |
(...skipping 1465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4464 while (buffer != NULL) { | 4464 while (buffer != NULL) { |
4465 SlotsBuffer* next_buffer = buffer->next(); | 4465 SlotsBuffer* next_buffer = buffer->next(); |
4466 DeallocateBuffer(buffer); | 4466 DeallocateBuffer(buffer); |
4467 buffer = next_buffer; | 4467 buffer = next_buffer; |
4468 } | 4468 } |
4469 *buffer_address = NULL; | 4469 *buffer_address = NULL; |
4470 } | 4470 } |
4471 | 4471 |
4472 | 4472 |
4473 } } // namespace v8::internal | 4473 } } // namespace v8::internal |
OLD | NEW |