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

Side by Side Diff: src/spaces.h

Issue 163683003: The sweeper thread should not write the page flags. Added a sweeping complete phase, where the main… (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 10 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/mark-compact.cc ('k') | src/spaces.cc » ('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 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 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 // Set or clear multiple flags at a time. The flags in the mask 450 // Set or clear multiple flags at a time. The flags in the mask
451 // are set to the value in "flags", the rest retain the current value 451 // are set to the value in "flags", the rest retain the current value
452 // in flags_. 452 // in flags_.
453 void SetFlags(intptr_t flags, intptr_t mask) { 453 void SetFlags(intptr_t flags, intptr_t mask) {
454 flags_ = (flags_ & ~mask) | (flags & mask); 454 flags_ = (flags_ & ~mask) | (flags & mask);
455 } 455 }
456 456
457 // Return all current flags. 457 // Return all current flags.
458 intptr_t GetFlags() { return flags_; } 458 intptr_t GetFlags() { return flags_; }
459 459
460 intptr_t parallel_sweeping() const { 460
461 return parallel_sweeping_; 461 // PARALLEL_SWEEPING_PENDING - This page is ready for parallel sweeping.
462 // PARALLEL_SWEEPING_COMPLETE - This page was swept by a sweeper thread.
463 // PARALLEL_SWEEPING_DONE - The page state when sweeping is complete or
464 // sweeping must not be performed on that page.
465 enum ParallelSweepingState {
466 PARALLEL_SWEEPING_DONE,
467 PARALLEL_SWEEPING_COMPLETE,
Jarin 2014/02/14 09:04:13 Is not PARALLEL_SWEEPING_COMPLETE more like "in pr
Hannes Payer (out of office) 2014/02/14 12:29:17 Done.
468 PARALLEL_SWEEPING_PENDING
469 };
470
471 ParallelSweepingState parallel_sweeping() {
472 return static_cast<ParallelSweepingState>(parallel_sweeping_);
Jarin 2014/02/14 09:04:13 This should be NoBarrier_Load
Hannes Payer (out of office) 2014/02/14 12:29:17 Ups, I accidentally removed this one. Done.
462 } 473 }
463 474
464 void set_parallel_sweeping(intptr_t state) { 475 void set_parallel_sweeping(ParallelSweepingState state) {
465 parallel_sweeping_ = state; 476 NoBarrier_Store(&parallel_sweeping_, state);
466 } 477 }
467 478
468 bool TryParallelSweeping() { 479 bool TryParallelSweeping() {
469 return NoBarrier_CompareAndSwap(&parallel_sweeping_, 1, 0) == 1; 480 return NoBarrier_CompareAndSwap(&parallel_sweeping_,
481 PARALLEL_SWEEPING_PENDING,
482 PARALLEL_SWEEPING_COMPLETE) ==
483 PARALLEL_SWEEPING_PENDING;
470 } 484 }
471 485
472 // Manage live byte count (count of bytes known to be live, 486 // Manage live byte count (count of bytes known to be live,
473 // because they are marked black). 487 // because they are marked black).
474 void ResetLiveBytes() { 488 void ResetLiveBytes() {
475 if (FLAG_gc_verbose) { 489 if (FLAG_gc_verbose) {
476 PrintF("ResetLiveBytes:%p:%x->0\n", 490 PrintF("ResetLiveBytes:%p:%x->0\n",
477 static_cast<void*>(this), live_byte_count_); 491 static_cast<void*>(this), live_byte_count_);
478 } 492 }
479 live_byte_count_ = 0; 493 live_byte_count_ = 0;
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 SlotsBuffer* slots_buffer_; 709 SlotsBuffer* slots_buffer_;
696 SkipList* skip_list_; 710 SkipList* skip_list_;
697 intptr_t write_barrier_counter_; 711 intptr_t write_barrier_counter_;
698 // Used by the incremental marker to keep track of the scanning progress in 712 // Used by the incremental marker to keep track of the scanning progress in
699 // large objects that have a progress bar and are scanned in increments. 713 // large objects that have a progress bar and are scanned in increments.
700 int progress_bar_; 714 int progress_bar_;
701 // Assuming the initial allocation on a page is sequential, 715 // Assuming the initial allocation on a page is sequential,
702 // count highest number of bytes ever allocated on the page. 716 // count highest number of bytes ever allocated on the page.
703 int high_water_mark_; 717 int high_water_mark_;
704 718
705 intptr_t parallel_sweeping_; 719 AtomicWord parallel_sweeping_;
706 720
707 // PagedSpace free-list statistics. 721 // PagedSpace free-list statistics.
708 intptr_t available_in_small_free_list_; 722 intptr_t available_in_small_free_list_;
709 intptr_t available_in_medium_free_list_; 723 intptr_t available_in_medium_free_list_;
710 intptr_t available_in_large_free_list_; 724 intptr_t available_in_large_free_list_;
711 intptr_t available_in_huge_free_list_; 725 intptr_t available_in_huge_free_list_;
712 intptr_t non_available_small_blocks_; 726 intptr_t non_available_small_blocks_;
713 727
714 static MemoryChunk* Initialize(Heap* heap, 728 static MemoryChunk* Initialize(Heap* heap,
715 Address base, 729 Address base,
(...skipping 2226 matching lines...) Expand 10 before | Expand all | Expand 10 after
2942 } 2956 }
2943 // Must be small, since an iteration is used for lookup. 2957 // Must be small, since an iteration is used for lookup.
2944 static const int kMaxComments = 64; 2958 static const int kMaxComments = 64;
2945 }; 2959 };
2946 #endif 2960 #endif
2947 2961
2948 2962
2949 } } // namespace v8::internal 2963 } } // namespace v8::internal
2950 2964
2951 #endif // V8_SPACES_H_ 2965 #endif // V8_SPACES_H_
OLDNEW
« no previous file with comments | « src/mark-compact.cc ('k') | src/spaces.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698