Revision: 13810
Author:   [email protected]
Date:     Mon Mar  4 06:56:20 2013
Log: Wait for sweeper threads and finalize sweeping only if parallel/concurrent sweeping was in progress.

BUG=

Review URL: https://codereview.chromium.org/12386084
http://code.google.com/p/v8/source/detail?r=13810

Modified:
 /branches/bleeding_edge/src/mark-compact.cc
 /branches/bleeding_edge/src/spaces.cc

=======================================
--- /branches/bleeding_edge/src/mark-compact.cc Thu Feb 28 09:03:34 2013
+++ /branches/bleeding_edge/src/mark-compact.cc Mon Mar  4 06:56:20 2013
@@ -550,16 +550,15 @@


 void MarkCompactCollector::WaitUntilSweepingCompleted() {
-  if (sweeping_pending_) {
-    for (int i = 0; i < FLAG_sweeper_threads; i++) {
-      heap()->isolate()->sweeper_threads()[i]->WaitForSweeperThread();
-    }
-    sweeping_pending_ = false;
-    StealMemoryFromSweeperThreads(heap()->paged_space(OLD_DATA_SPACE));
-    StealMemoryFromSweeperThreads(heap()->paged_space(OLD_POINTER_SPACE));
-    heap()->paged_space(OLD_DATA_SPACE)->ResetUnsweptFreeBytes();
-    heap()->paged_space(OLD_POINTER_SPACE)->ResetUnsweptFreeBytes();
+  ASSERT(sweeping_pending_ == true);
+  for (int i = 0; i < FLAG_sweeper_threads; i++) {
+    heap()->isolate()->sweeper_threads()[i]->WaitForSweeperThread();
   }
+  sweeping_pending_ = false;
+  StealMemoryFromSweeperThreads(heap()->paged_space(OLD_DATA_SPACE));
+  StealMemoryFromSweeperThreads(heap()->paged_space(OLD_POINTER_SPACE));
+  heap()->paged_space(OLD_DATA_SPACE)->ResetUnsweptFreeBytes();
+  heap()->paged_space(OLD_POINTER_SPACE)->ResetUnsweptFreeBytes();
 }


@@ -908,7 +907,7 @@

   ASSERT(!FLAG_never_compact || !FLAG_always_compact);

-  if (AreSweeperThreadsActivated() && FLAG_concurrent_sweeping) {
+  if (IsConcurrentSweepingInProgress()) {
     // Instead of waiting we could also abort the sweeper threads here.
     WaitUntilSweepingCompleted();
     FinalizeSweeping();
=======================================
--- /branches/bleeding_edge/src/spaces.cc       Wed Feb 27 04:59:52 2013
+++ /branches/bleeding_edge/src/spaces.cc       Mon Mar  4 06:56:20 2013
@@ -2545,7 +2545,7 @@
 bool PagedSpace::EnsureSweeperProgress(intptr_t size_in_bytes) {
   MarkCompactCollector* collector = heap()->mark_compact_collector();
   if (collector->AreSweeperThreadsActivated()) {
-    if (FLAG_concurrent_sweeping) {
+    if (collector->IsConcurrentSweepingInProgress()) {
       if (collector->StealMemoryFromSweeperThreads(this) < size_in_bytes) {
         collector->WaitUntilSweepingCompleted();
         collector->FinalizeSweeping();

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to