Index: src/heap.cc |
diff --git a/src/heap.cc b/src/heap.cc |
index 7976cf8aa7f1a4965dc844c21d4254f07580a8df..f2f0b9bac7421f2441a0aa8787d0babeffea83ac 100644 |
--- a/src/heap.cc |
+++ b/src/heap.cc |
@@ -1300,6 +1300,8 @@ class ScavengeWeakObjectRetainer : public WeakObjectRetainer { |
void Heap::Scavenge() { |
+ RelocationLock relocation_lock(this); |
+ |
#ifdef VERIFY_HEAP |
if (FLAG_verify_heap) VerifyNonPointerSpacePointers(); |
#endif |
@@ -6635,6 +6637,11 @@ bool Heap::SetUp() { |
store_buffer()->SetUp(); |
+ if (FLAG_parallel_recompilation) relocation_mutex_ = OS::CreateMutex(); |
+#ifdef DEBUG |
+ relocation_mutex_locked_by_optimizer_thread_ = false; |
+#endif // DEBUG |
+ |
return true; |
} |
@@ -6737,6 +6744,8 @@ void Heap::TearDown() { |
incremental_marking()->TearDown(); |
isolate_->memory_allocator()->TearDown(); |
+ |
+ delete relocation_mutex_; |
} |
@@ -7866,4 +7875,15 @@ void Heap::CheckpointObjectStats() { |
ClearObjectStats(); |
} |
+ |
+Heap::RelocationLock::RelocationLock(Heap* heap) : heap_(heap) { |
+ if (FLAG_parallel_recompilation) { |
+ heap_->relocation_mutex_->Lock(); |
+#ifdef DEBUG |
+ heap_->relocation_mutex_locked_by_optimizer_thread_ = |
+ heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread(); |
+#endif // DEBUG |
+ } |
+} |
+ |
} } // namespace v8::internal |