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

Side by Side Diff: src/spaces.cc

Issue 12342017: Execute a memory barrier when adding a new page to a space to synchronize access with concurrent sw… (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 9 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 519 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 } 530 }
531 531
532 area_end_ = area_start_ + requested; 532 area_end_ = area_start_ + requested;
533 return true; 533 return true;
534 } 534 }
535 535
536 536
537 void MemoryChunk::InsertAfter(MemoryChunk* other) { 537 void MemoryChunk::InsertAfter(MemoryChunk* other) {
538 next_chunk_ = other->next_chunk_; 538 next_chunk_ = other->next_chunk_;
539 prev_chunk_ = other; 539 prev_chunk_ = other;
540
541 // This memory barrier is needed since concurrent sweeper threads may iterate
542 // over the list of pages while a new page is inserted.
543 // TODO(hpayer): find a cleaner way to guarantee that the page list can be
544 // expanded concurrently
545 MemoryBarrier();
546
547 // The following two write operations can take effect in arbitrary order
548 // since pages are always iterated by the sweeper threads in LIFO order, i.e,
549 // the inserted page becomes visible for the sweeper threads after
550 // other->next_chunk_ = this;
540 other->next_chunk_->prev_chunk_ = this; 551 other->next_chunk_->prev_chunk_ = this;
541 other->next_chunk_ = this; 552 other->next_chunk_ = this;
542 } 553 }
543 554
544 555
545 void MemoryChunk::Unlink() { 556 void MemoryChunk::Unlink() {
546 if (!InNewSpace() && IsFlagSet(SCAN_ON_SCAVENGE)) { 557 if (!InNewSpace() && IsFlagSet(SCAN_ON_SCAVENGE)) {
547 heap_->decrement_scan_on_scavenge_pages(); 558 heap_->decrement_scan_on_scavenge_pages();
548 ClearFlag(SCAN_ON_SCAVENGE); 559 ClearFlag(SCAN_ON_SCAVENGE);
549 } 560 }
(...skipping 2582 matching lines...) Expand 10 before | Expand all | Expand 10 after
3132 object->ShortPrint(); 3143 object->ShortPrint();
3133 PrintF("\n"); 3144 PrintF("\n");
3134 } 3145 }
3135 printf(" --------------------------------------\n"); 3146 printf(" --------------------------------------\n");
3136 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); 3147 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes());
3137 } 3148 }
3138 3149
3139 #endif // DEBUG 3150 #endif // DEBUG
3140 3151
3141 } } // namespace v8::internal 3152 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698