Revision: 14445
Author: [email protected]
Date: Fri Apr 26 00:35:07 2013
Log: Do not dereference handles during relocation.
[email protected]
BUG=
Review URL: https://chromiumcodereview.appspot.com/13982023
http://code.google.com/p/v8/source/detail?r=14445
Modified:
/branches/bleeding_edge/src/handles-inl.h
/branches/bleeding_edge/src/heap-inl.h
/branches/bleeding_edge/src/heap.cc
/branches/bleeding_edge/src/heap.h
/branches/bleeding_edge/src/hydrogen.cc
/branches/bleeding_edge/src/mark-compact.cc
/branches/bleeding_edge/src/optimizing-compiler-thread.cc
=======================================
--- /branches/bleeding_edge/src/handles-inl.h Tue Apr 23 02:23:07 2013
+++ /branches/bleeding_edge/src/handles-inl.h Fri Apr 26 00:35:07 2013
@@ -91,6 +91,10 @@
handle < roots_array_start + Heap::kStrongRootListLength) {
return true;
}
+ if (isolate->optimizing_compiler_thread()->IsOptimizerThread() &&
+ !Heap::RelocationLock::IsLockedByOptimizerThread(isolate->heap())) {
+ return false;
+ }
switch (isolate->HandleDereferenceGuardState()) {
case HandleDereferenceGuard::ALLOW:
return true;
=======================================
--- /branches/bleeding_edge/src/heap-inl.h Fri Apr 19 08:55:34 2013
+++ /branches/bleeding_edge/src/heap-inl.h Fri Apr 26 00:35:07 2013
@@ -211,6 +211,7 @@
MaybeObject* Heap::AllocateRaw(int size_in_bytes,
AllocationSpace space,
AllocationSpace retry_space) {
+
SLOW_ASSERT(!isolate_->optimizing_compiler_thread()->IsOptimizerThread());
ASSERT(allocation_allowed_ && gc_state_ == NOT_IN_GC);
ASSERT(space != NEW_SPACE ||
retry_space == OLD_POINTER_SPACE ||
=======================================
--- /branches/bleeding_edge/src/heap.cc Thu Apr 25 05:08:10 2013
+++ /branches/bleeding_edge/src/heap.cc Fri Apr 26 00:35:07 2013
@@ -1300,6 +1300,8 @@
void Heap::Scavenge() {
+ RelocationLock relocation_lock(this);
+
#ifdef VERIFY_HEAP
if (FLAG_verify_heap) VerifyNonPointerSpacePointers();
#endif
@@ -6635,6 +6637,11 @@
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 @@
incremental_marking()->TearDown();
isolate_->memory_allocator()->TearDown();
+
+ delete relocation_mutex_;
}
@@ -7865,5 +7874,16 @@
OS::MemCopy(object_sizes_last_time_, object_sizes_,
sizeof(object_sizes_));
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
=======================================
--- /branches/bleeding_edge/src/heap.h Thu Apr 25 09:00:32 2013
+++ /branches/bleeding_edge/src/heap.h Fri Apr 26 00:35:07 2013
@@ -1858,6 +1858,31 @@
void CheckpointObjectStats();
+ // We don't use a ScopedLock here since we want to lock the heap
+ // only when FLAG_parallel_recompilation is true.
+ class RelocationLock {
+ public:
+ explicit RelocationLock(Heap* heap);
+
+ ~RelocationLock() {
+ if (FLAG_parallel_recompilation) {
+#ifdef DEBUG
+ heap_->relocation_mutex_locked_by_optimizer_thread_ = false;
+#endif // DEBUG
+ heap_->relocation_mutex_->Unlock();
+ }
+ }
+
+#ifdef DEBUG
+ static bool IsLockedByOptimizerThread(Heap* heap) {
+ return heap->relocation_mutex_locked_by_optimizer_thread_;
+ }
+#endif // DEBUG
+
+ private:
+ Heap* heap_;
+ };
+
private:
Heap();
@@ -2332,6 +2357,11 @@
MemoryChunk* chunks_queued_for_free_;
+ Mutex* relocation_mutex_;
+#ifdef DEBUG
+ bool relocation_mutex_locked_by_optimizer_thread_;
+#endif // DEBUG;
+
friend class Factory;
friend class GCTracer;
friend class DisallowAllocationFailure;
=======================================
--- /branches/bleeding_edge/src/hydrogen.cc Thu Apr 25 09:00:32 2013
+++ /branches/bleeding_edge/src/hydrogen.cc Fri Apr 26 00:35:07 2013
@@ -511,6 +511,7 @@
void HGraph::Verify(bool do_full_verify) const {
+ Heap::RelocationLock(isolate()->heap());
ALLOW_HANDLE_DEREF(isolate(), "debug mode verification");
for (int i = 0; i < blocks_.length(); i++) {
HBasicBlock* block = blocks_.at(i);
=======================================
--- /branches/bleeding_edge/src/mark-compact.cc Wed Apr 24 08:59:23 2013
+++ /branches/bleeding_edge/src/mark-compact.cc Fri Apr 26 00:35:07 2013
@@ -3125,6 +3125,8 @@
void MarkCompactCollector::EvacuateNewSpaceAndCandidates() {
+ Heap::RelocationLock relocation_lock(heap());
+
bool code_slots_filtering_required;
{ GCTracer::Scope gc_scope(tracer_, GCTracer::Scope::MC_SWEEP_NEWSPACE);
code_slots_filtering_required = MarkInvalidatedCode();
=======================================
--- /branches/bleeding_edge/src/optimizing-compiler-thread.cc Thu Mar 14
09:35:32 2013
+++ /branches/bleeding_edge/src/optimizing-compiler-thread.cc Fri Apr 26
00:35:07 2013
@@ -88,7 +88,9 @@
// The function may have already been optimized by OSR. Simply continue.
// Mark it for installing before queuing so that we can be sure of the
write
// order: marking first and (after being queued) installing code second.
-
optimizing_compiler->info()->closure()->MarkForInstallingRecompiledCode();
+ { Heap::RelocationLock relocation_lock(isolate_->heap());
+
optimizing_compiler->info()->closure()->MarkForInstallingRecompiledCode();
+ }
output_queue_.Enqueue(optimizing_compiler);
}
--
--
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.