Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Side by Side Diff: src/mark-compact.cc

Issue 316133002: Move atomic ops and related files to base library (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: updates Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/lazy-instance.h ('k') | src/objects-inl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/code-stubs.h" 8 #include "src/code-stubs.h"
8 #include "src/compilation-cache.h" 9 #include "src/compilation-cache.h"
9 #include "src/cpu-profiler.h" 10 #include "src/cpu-profiler.h"
10 #include "src/deoptimizer.h" 11 #include "src/deoptimizer.h"
11 #include "src/execution.h" 12 #include "src/execution.h"
12 #include "src/gdb-jit.h" 13 #include "src/gdb-jit.h"
13 #include "src/global-handles.h" 14 #include "src/global-handles.h"
14 #include "src/heap-profiler.h" 15 #include "src/heap-profiler.h"
15 #include "src/ic-inl.h" 16 #include "src/ic-inl.h"
16 #include "src/incremental-marking.h" 17 #include "src/incremental-marking.h"
(...skipping 2948 matching lines...) Expand 10 before | Expand all | Expand 10 after
2965 static void UpdatePointer(HeapObject** address, HeapObject* object) { 2966 static void UpdatePointer(HeapObject** address, HeapObject* object) {
2966 Address new_addr = Memory::Address_at(object->address()); 2967 Address new_addr = Memory::Address_at(object->address());
2967 2968
2968 // The new space sweep will overwrite the map word of dead objects 2969 // 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 2970 // with NULL. In this case we do not need to transfer this entry to
2970 // the store buffer which we are rebuilding. 2971 // the store buffer which we are rebuilding.
2971 // We perform the pointer update with a no barrier compare-and-swap. The 2972 // 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 2973 // 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. 2974 // update garbage memory which was concurrently accessed by the sweeper.
2974 if (new_addr != NULL) { 2975 if (new_addr != NULL) {
2975 NoBarrier_CompareAndSwap( 2976 base::NoBarrier_CompareAndSwap(
2976 reinterpret_cast<AtomicWord*>(address), 2977 reinterpret_cast<base::AtomicWord*>(address),
2977 reinterpret_cast<AtomicWord>(object), 2978 reinterpret_cast<base::AtomicWord>(object),
2978 reinterpret_cast<AtomicWord>(HeapObject::FromAddress(new_addr))); 2979 reinterpret_cast<base::AtomicWord>(HeapObject::FromAddress(new_addr)));
2979 } else { 2980 } else {
2980 // We have to zap this pointer, because the store buffer may overflow later, 2981 // 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 2982 // and then we have to scan the entire heap and we don't want to find
2982 // spurious newspace pointers in the old space. 2983 // spurious newspace pointers in the old space.
2983 // TODO(mstarzinger): This was changed to a sentinel value to track down 2984 // TODO(mstarzinger): This was changed to a sentinel value to track down
2984 // rare crashes, change it back to Smi::FromInt(0) later. 2985 // rare crashes, change it back to Smi::FromInt(0) later.
2985 NoBarrier_CompareAndSwap( 2986 base::NoBarrier_CompareAndSwap(
2986 reinterpret_cast<AtomicWord*>(address), 2987 reinterpret_cast<base::AtomicWord*>(address),
2987 reinterpret_cast<AtomicWord>(object), 2988 reinterpret_cast<base::AtomicWord>(object),
2988 reinterpret_cast<AtomicWord>(Smi::FromInt(0x0f100d00 >> 1))); 2989 reinterpret_cast<base::AtomicWord>(Smi::FromInt(0x0f100d00 >> 1)));
2989 } 2990 }
2990 } 2991 }
2991 2992
2992 2993
2993 static String* UpdateReferenceInExternalStringTableEntry(Heap* heap, 2994 static String* UpdateReferenceInExternalStringTableEntry(Heap* heap,
2994 Object** p) { 2995 Object** p) {
2995 MapWord map_word = HeapObject::cast(*p)->map_word(); 2996 MapWord map_word = HeapObject::cast(*p)->map_word();
2996 2997
2997 if (map_word.IsForwardingAddress()) { 2998 if (map_word.IsForwardingAddress()) {
2998 return String::cast(map_word.ToForwardingAddress()); 2999 return String::cast(map_word.ToForwardingAddress());
(...skipping 1465 matching lines...) Expand 10 before | Expand all | Expand 10 after
4464 while (buffer != NULL) { 4465 while (buffer != NULL) {
4465 SlotsBuffer* next_buffer = buffer->next(); 4466 SlotsBuffer* next_buffer = buffer->next();
4466 DeallocateBuffer(buffer); 4467 DeallocateBuffer(buffer);
4467 buffer = next_buffer; 4468 buffer = next_buffer;
4468 } 4469 }
4469 *buffer_address = NULL; 4470 *buffer_address = NULL;
4470 } 4471 }
4471 4472
4472 4473
4473 } } // namespace v8::internal 4474 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/lazy-instance.h ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698