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

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 MemoryBarrier();
Michael Starzinger 2013/03/11 11:40:36 As discussed in length offline: We agree that star
544
545 // The following two write operations can take effect in arbitrary order
546 // since pages are always iterated by the sweeper threads in LIFO order, i.e,
547 // the inserted page becomes visible for the sweeper threads after
548 // other->next_chunk_ = this;
540 other->next_chunk_->prev_chunk_ = this; 549 other->next_chunk_->prev_chunk_ = this;
541 other->next_chunk_ = this; 550 other->next_chunk_ = this;
542 } 551 }
543 552
544 553
545 void MemoryChunk::Unlink() { 554 void MemoryChunk::Unlink() {
546 if (!InNewSpace() && IsFlagSet(SCAN_ON_SCAVENGE)) { 555 if (!InNewSpace() && IsFlagSet(SCAN_ON_SCAVENGE)) {
547 heap_->decrement_scan_on_scavenge_pages(); 556 heap_->decrement_scan_on_scavenge_pages();
548 ClearFlag(SCAN_ON_SCAVENGE); 557 ClearFlag(SCAN_ON_SCAVENGE);
549 } 558 }
(...skipping 2602 matching lines...) Expand 10 before | Expand all | Expand 10 after
3152 object->ShortPrint(); 3161 object->ShortPrint();
3153 PrintF("\n"); 3162 PrintF("\n");
3154 } 3163 }
3155 printf(" --------------------------------------\n"); 3164 printf(" --------------------------------------\n");
3156 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); 3165 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes());
3157 } 3166 }
3158 3167
3159 #endif // DEBUG 3168 #endif // DEBUG
3160 3169
3161 } } // namespace v8::internal 3170 } } // 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