Revision: 13830
Author: [email protected]
Date: Tue Mar 5 09:32:02 2013
Log: Wait for sweeper threads in EnsureSweeperProgress() only if the
main thread finished its sweeping phase.
BUG=
Review URL: https://codereview.chromium.org/12462002
http://code.google.com/p/v8/source/detail?r=13830
Modified:
/branches/bleeding_edge/src/mark-compact.cc
/branches/bleeding_edge/src/mark-compact.h
/branches/bleeding_edge/src/spaces.cc
/branches/bleeding_edge/src/spaces.h
=======================================
--- /branches/bleeding_edge/src/mark-compact.cc Tue Mar 5 08:08:11 2013
+++ /branches/bleeding_edge/src/mark-compact.cc Tue Mar 5 09:32:02 2013
@@ -67,6 +67,7 @@
compacting_(false),
was_marked_incrementally_(false),
sweeping_pending_(false),
+ sequential_sweeping_(false),
tracer_(NULL),
migration_slots_buffer_(NULL),
heap_(NULL),
@@ -3885,7 +3886,7 @@
// the map space last because freeing non-live maps overwrites them and
// the other spaces rely on possibly non-live maps to get the sizes for
// non-live objects.
-
+ SequentialSweepingScope scope(this);
SweepSpace(heap()->old_pointer_space(), how_to_sweep);
SweepSpace(heap()->old_data_space(), how_to_sweep);
=======================================
--- /branches/bleeding_edge/src/mark-compact.h Tue Mar 5 08:08:11 2013
+++ /branches/bleeding_edge/src/mark-compact.h Tue Mar 5 09:32:02 2013
@@ -692,6 +692,14 @@
void FinalizeSweeping();
+ void set_sequential_sweeping(bool sequential_sweeping) {
+ sequential_sweeping_ = sequential_sweeping;
+ }
+
+ bool sequential_sweeping() const {
+ return sequential_sweeping_;
+ }
+
// Parallel marking support.
void MarkInParallel();
@@ -743,6 +751,8 @@
// True if concurrent or parallel sweeping is currently in progress.
bool sweeping_pending_;
+ bool sequential_sweeping_;
+
// A pointer to the current stack-allocated GC tracer object during a
full
// collection (NULL before and after).
GCTracer* tracer_;
@@ -898,6 +908,22 @@
};
+class SequentialSweepingScope BASE_EMBEDDED {
+ public:
+ explicit SequentialSweepingScope(MarkCompactCollector *collector) :
+ collector_(collector) {
+ collector_->set_sequential_sweeping(true);
+ }
+
+ ~SequentialSweepingScope() {
+ collector_->set_sequential_sweeping(false);
+ }
+
+ private:
+ MarkCompactCollector* collector_;
+};
+
+
const char* AllocationSpaceName(AllocationSpace space);
} } // namespace v8::internal
=======================================
--- /branches/bleeding_edge/src/spaces.cc Mon Mar 4 07:47:59 2013
+++ /branches/bleeding_edge/src/spaces.cc Tue Mar 5 09:32:02 2013
@@ -2553,9 +2553,11 @@
if (collector->AreSweeperThreadsActivated()) {
if (collector->IsConcurrentSweepingInProgress()) {
if (collector->StealMemoryFromSweeperThreads(this) < size_in_bytes) {
- collector->WaitUntilSweepingCompleted();
- collector->FinalizeSweeping();
- return true;
+ if (!collector->sequential_sweeping()) {
+ collector->WaitUntilSweepingCompleted();
+ collector->FinalizeSweeping();
+ return true;
+ }
}
return false;
}
=======================================
--- /branches/bleeding_edge/src/spaces.h Mon Mar 4 07:47:59 2013
+++ /branches/bleeding_edge/src/spaces.h Tue Mar 5 09:32:02 2013
@@ -1765,9 +1765,9 @@
bool AdvanceSweeper(intptr_t bytes_to_sweep);
- // When parallel sweeper threads are active this function waits
- // for them to complete, otherwise AdvanceSweeper with size_in_bytes
- // is called.
+ // When parallel sweeper threads are active and the main thread finished
+ // its sweeping phase, this function waits for them to complete,
otherwise
+ // AdvanceSweeper with size_in_bytes is called.
bool EnsureSweeperProgress(intptr_t size_in_bytes);
bool IsLazySweepingComplete() {
--
--
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.