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

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

Issue 227533006: Synchronize store buffer processing and concurrent sweeping. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 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/heap-inl.h ('k') | src/objects.h » ('j') | src/spaces.cc » ('J')
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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 2970 matching lines...) Expand 10 before | Expand all | Expand 10 after
2981 2981
2982 private: 2982 private:
2983 inline void UpdatePointer(Object** p) { 2983 inline void UpdatePointer(Object** p) {
2984 UpdateSlot(heap_, p); 2984 UpdateSlot(heap_, p);
2985 } 2985 }
2986 2986
2987 Heap* heap_; 2987 Heap* heap_;
2988 }; 2988 };
2989 2989
2990 2990
2991 static void UpdatePointer(HeapObject** p, HeapObject* object) { 2991 static void UpdatePointer(HeapObject** address,
2992 ASSERT(*p == object); 2992 HeapObject* new_value,
2993 2993 Object* old_value) {
2994 Address old_addr = object->address(); 2994 Address new_addr = Memory::Address_at(new_value->address());
2995
2996 Address new_addr = Memory::Address_at(old_addr);
2997 2995
2998 // The new space sweep will overwrite the map word of dead objects 2996 // The new space sweep will overwrite the map word of dead objects
2999 // with NULL. In this case we do not need to transfer this entry to 2997 // with NULL. In this case we do not need to transfer this entry to
3000 // the store buffer which we are rebuilding. 2998 // the store buffer which we are rebuilding.
2999 // We perform the pointer update with a no barrier compare-and-swap. The
3000 // compare and swap may fail in the case where the pointer update tries to
3001 // update garbage memory which was concurrently accessed by the sweeper.
3001 if (new_addr != NULL) { 3002 if (new_addr != NULL) {
3002 *p = HeapObject::FromAddress(new_addr); 3003 NoBarrier_CompareAndSwap(
3004 reinterpret_cast<AtomicWord*>(address),
3005 reinterpret_cast<AtomicWord>(old_value),
3006 reinterpret_cast<AtomicWord>(HeapObject::FromAddress(new_addr)));
3003 } else { 3007 } else {
3004 // We have to zap this pointer, because the store buffer may overflow later, 3008 // We have to zap this pointer, because the store buffer may overflow later,
3005 // and then we have to scan the entire heap and we don't want to find 3009 // and then we have to scan the entire heap and we don't want to find
3006 // spurious newspace pointers in the old space. 3010 // spurious newspace pointers in the old space.
3007 // TODO(mstarzinger): This was changed to a sentinel value to track down 3011 // TODO(mstarzinger): This was changed to a sentinel value to track down
3008 // rare crashes, change it back to Smi::FromInt(0) later. 3012 // rare crashes, change it back to Smi::FromInt(0) later.
3009 *p = reinterpret_cast<HeapObject*>(Smi::FromInt(0x0f100d00 >> 1)); // flood 3013 NoBarrier_CompareAndSwap(
3014 reinterpret_cast<AtomicWord*>(address),
3015 reinterpret_cast<AtomicWord>(old_value),
3016 reinterpret_cast<AtomicWord>(Smi::FromInt(0x0f100d00 >> 1)));
3010 } 3017 }
3011 } 3018 }
3012 3019
3013 3020
3014 static String* UpdateReferenceInExternalStringTableEntry(Heap* heap, 3021 static String* UpdateReferenceInExternalStringTableEntry(Heap* heap,
3015 Object** p) { 3022 Object** p) {
3016 MapWord map_word = HeapObject::cast(*p)->map_word(); 3023 MapWord map_word = HeapObject::cast(*p)->map_word();
3017 3024
3018 if (map_word.IsForwardingAddress()) { 3025 if (map_word.IsForwardingAddress()) {
3019 return String::cast(map_word.ToForwardingAddress()); 3026 return String::cast(map_word.ToForwardingAddress());
(...skipping 1504 matching lines...) Expand 10 before | Expand all | Expand 10 after
4524 while (buffer != NULL) { 4531 while (buffer != NULL) {
4525 SlotsBuffer* next_buffer = buffer->next(); 4532 SlotsBuffer* next_buffer = buffer->next();
4526 DeallocateBuffer(buffer); 4533 DeallocateBuffer(buffer);
4527 buffer = next_buffer; 4534 buffer = next_buffer;
4528 } 4535 }
4529 *buffer_address = NULL; 4536 *buffer_address = NULL;
4530 } 4537 }
4531 4538
4532 4539
4533 } } // namespace v8::internal 4540 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap-inl.h ('k') | src/objects.h » ('j') | src/spaces.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698