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

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

Issue 12261011: Move sweeping pending status field of concurrent sweepers to MarkCompactCollector. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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.h ('k') | src/sweeper-thread.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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 MarkCompactCollector::MarkCompactCollector() : // NOLINT 59 MarkCompactCollector::MarkCompactCollector() : // NOLINT
60 #ifdef DEBUG 60 #ifdef DEBUG
61 state_(IDLE), 61 state_(IDLE),
62 #endif 62 #endif
63 sweep_precisely_(false), 63 sweep_precisely_(false),
64 reduce_memory_footprint_(false), 64 reduce_memory_footprint_(false),
65 abort_incremental_marking_(false), 65 abort_incremental_marking_(false),
66 marking_parity_(ODD_MARKING_PARITY), 66 marking_parity_(ODD_MARKING_PARITY),
67 compacting_(false), 67 compacting_(false),
68 was_marked_incrementally_(false), 68 was_marked_incrementally_(false),
69 sweeping_pending_(false),
69 tracer_(NULL), 70 tracer_(NULL),
70 migration_slots_buffer_(NULL), 71 migration_slots_buffer_(NULL),
71 heap_(NULL), 72 heap_(NULL),
72 code_flusher_(NULL), 73 code_flusher_(NULL),
73 encountered_weak_maps_(NULL) { } 74 encountered_weak_maps_(NULL) { }
74 75
75 76
76 #ifdef VERIFY_HEAP 77 #ifdef VERIFY_HEAP
77 class VerifyMarkingVisitor: public ObjectVisitor { 78 class VerifyMarkingVisitor: public ObjectVisitor {
78 public: 79 public:
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 MarkBit mark_bit = Marking::MarkBitFrom(obj); 521 MarkBit mark_bit = Marking::MarkBitFrom(obj);
521 mark_bit.Clear(); 522 mark_bit.Clear();
522 mark_bit.Next().Clear(); 523 mark_bit.Next().Clear();
523 Page::FromAddress(obj->address())->ResetProgressBar(); 524 Page::FromAddress(obj->address())->ResetProgressBar();
524 Page::FromAddress(obj->address())->ResetLiveBytes(); 525 Page::FromAddress(obj->address())->ResetLiveBytes();
525 } 526 }
526 } 527 }
527 528
528 529
529 void MarkCompactCollector::StartSweeperThreads() { 530 void MarkCompactCollector::StartSweeperThreads() {
530 SweeperThread::set_sweeping_pending(true); 531 sweeping_pending_ = true;
531 for (int i = 0; i < FLAG_sweeper_threads; i++) { 532 for (int i = 0; i < FLAG_sweeper_threads; i++) {
532 heap()->isolate()->sweeper_threads()[i]->StartSweeping(); 533 heap()->isolate()->sweeper_threads()[i]->StartSweeping();
533 } 534 }
534 } 535 }
535 536
536 537
537 void MarkCompactCollector::WaitUntilSweepingCompleted() { 538 void MarkCompactCollector::WaitUntilSweepingCompleted() {
538 if (SweeperThread::sweeping_pending()) { 539 if (sweeping_pending_) {
539 for (int i = 0; i < FLAG_sweeper_threads; i++) { 540 for (int i = 0; i < FLAG_sweeper_threads; i++) {
540 heap()->isolate()->sweeper_threads()[i]->WaitForSweeperThread(); 541 heap()->isolate()->sweeper_threads()[i]->WaitForSweeperThread();
541 } 542 }
542 SweeperThread::set_sweeping_pending(false); 543 sweeping_pending_ = false;
543 StealMemoryFromSweeperThreads(heap()->paged_space(OLD_DATA_SPACE)); 544 StealMemoryFromSweeperThreads(heap()->paged_space(OLD_DATA_SPACE));
544 StealMemoryFromSweeperThreads(heap()->paged_space(OLD_POINTER_SPACE)); 545 StealMemoryFromSweeperThreads(heap()->paged_space(OLD_POINTER_SPACE));
545 heap()->FreeQueuedChunks(); 546 heap()->FreeQueuedChunks();
546 } 547 }
547 } 548 }
548 549
549 550
550 intptr_t MarkCompactCollector:: 551 intptr_t MarkCompactCollector::
551 StealMemoryFromSweeperThreads(PagedSpace* space) { 552 StealMemoryFromSweeperThreads(PagedSpace* space) {
552 intptr_t freed_bytes = 0; 553 intptr_t freed_bytes = 0;
553 for (int i = 0; i < FLAG_sweeper_threads; i++) { 554 for (int i = 0; i < FLAG_sweeper_threads; i++) {
554 freed_bytes += heap()->isolate()->sweeper_threads()[i]->StealMemory(space); 555 freed_bytes += heap()->isolate()->sweeper_threads()[i]->StealMemory(space);
555 } 556 }
556 return freed_bytes; 557 return freed_bytes;
557 } 558 }
558 559
559 560
560 bool MarkCompactCollector::AreSweeperThreadsActivated() { 561 bool MarkCompactCollector::AreSweeperThreadsActivated() {
561 return heap()->isolate()->sweeper_threads() != NULL; 562 return heap()->isolate()->sweeper_threads() != NULL;
562 } 563 }
563 564
564 565
565 bool MarkCompactCollector::IsConcurrentSweepingInProgress() { 566 bool MarkCompactCollector::IsConcurrentSweepingInProgress() {
566 return SweeperThread::sweeping_pending(); 567 return sweeping_pending_;
567 } 568 }
568 569
569 570
570 void MarkCompactCollector::MarkInParallel() { 571 void MarkCompactCollector::MarkInParallel() {
571 for (int i = 0; i < FLAG_marking_threads; i++) { 572 for (int i = 0; i < FLAG_marking_threads; i++) {
572 heap()->isolate()->marking_threads()[i]->StartMarking(); 573 heap()->isolate()->marking_threads()[i]->StartMarking();
573 } 574 }
574 } 575 }
575 576
576 577
(...skipping 3492 matching lines...) Expand 10 before | Expand all | Expand 10 after
4069 while (buffer != NULL) { 4070 while (buffer != NULL) {
4070 SlotsBuffer* next_buffer = buffer->next(); 4071 SlotsBuffer* next_buffer = buffer->next();
4071 DeallocateBuffer(buffer); 4072 DeallocateBuffer(buffer);
4072 buffer = next_buffer; 4073 buffer = next_buffer;
4073 } 4074 }
4074 *buffer_address = NULL; 4075 *buffer_address = NULL;
4075 } 4076 }
4076 4077
4077 4078
4078 } } // namespace v8::internal 4079 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/mark-compact.h ('k') | src/sweeper-thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698