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

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 | « no previous file | src/objects.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 // 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, HeapObject* object) {
2992 ASSERT(*p == object); 2992 Address new_addr = Memory::Address_at(object->address());
2993
2994 Address old_addr = object->address();
2995
2996 Address new_addr = Memory::Address_at(old_addr);
2997 2993
2998 // The new space sweep will overwrite the map word of dead objects 2994 // 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 2995 // with NULL. In this case we do not need to transfer this entry to
3000 // the store buffer which we are rebuilding. 2996 // the store buffer which we are rebuilding.
2997 // We perform the pointer update with a no barrier compare-and-swap. The
2998 // compare and swap may fail in the case where the pointer update tries to
2999 // update garbage memory which was concurrently accessed by the sweeper.
3001 if (new_addr != NULL) { 3000 if (new_addr != NULL) {
3002 *p = HeapObject::FromAddress(new_addr); 3001 NoBarrier_CompareAndSwap(
3002 reinterpret_cast<AtomicWord*>(address),
3003 reinterpret_cast<AtomicWord>(object),
3004 reinterpret_cast<AtomicWord>(HeapObject::FromAddress(new_addr)));
3003 } else { 3005 } else {
3004 // We have to zap this pointer, because the store buffer may overflow later, 3006 // 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 3007 // and then we have to scan the entire heap and we don't want to find
3006 // spurious newspace pointers in the old space. 3008 // spurious newspace pointers in the old space.
3007 // TODO(mstarzinger): This was changed to a sentinel value to track down 3009 // TODO(mstarzinger): This was changed to a sentinel value to track down
3008 // rare crashes, change it back to Smi::FromInt(0) later. 3010 // rare crashes, change it back to Smi::FromInt(0) later.
3009 *p = reinterpret_cast<HeapObject*>(Smi::FromInt(0x0f100d00 >> 1)); // flood 3011 NoBarrier_CompareAndSwap(
3012 reinterpret_cast<AtomicWord*>(address),
3013 reinterpret_cast<AtomicWord>(object),
3014 reinterpret_cast<AtomicWord>(Smi::FromInt(0x0f100d00 >> 1)));
3010 } 3015 }
3011 } 3016 }
3012 3017
3013 3018
3014 static String* UpdateReferenceInExternalStringTableEntry(Heap* heap, 3019 static String* UpdateReferenceInExternalStringTableEntry(Heap* heap,
3015 Object** p) { 3020 Object** p) {
3016 MapWord map_word = HeapObject::cast(*p)->map_word(); 3021 MapWord map_word = HeapObject::cast(*p)->map_word();
3017 3022
3018 if (map_word.IsForwardingAddress()) { 3023 if (map_word.IsForwardingAddress()) {
3019 return String::cast(map_word.ToForwardingAddress()); 3024 return String::cast(map_word.ToForwardingAddress());
(...skipping 1504 matching lines...) Expand 10 before | Expand all | Expand 10 after
4524 while (buffer != NULL) { 4529 while (buffer != NULL) {
4525 SlotsBuffer* next_buffer = buffer->next(); 4530 SlotsBuffer* next_buffer = buffer->next();
4526 DeallocateBuffer(buffer); 4531 DeallocateBuffer(buffer);
4527 buffer = next_buffer; 4532 buffer = next_buffer;
4528 } 4533 }
4529 *buffer_address = NULL; 4534 *buffer_address = NULL;
4530 } 4535 }
4531 4536
4532 4537
4533 } } // namespace v8::internal 4538 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698