 Chromium Code Reviews
 Chromium Code Reviews Issue 13982023:
  Do not dereference handles during relocation.  (Closed) 
  Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
    
  
    Issue 13982023:
  Do not dereference handles during relocation.  (Closed) 
  Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge| Index: src/heap.h | 
| diff --git a/src/heap.h b/src/heap.h | 
| index 5b8610f945423b0c282e70c1a76d8bd820624ea2..f3a5b776e9f1d98122455e8c621ccf72a743ba83 100644 | 
| --- a/src/heap.h | 
| +++ b/src/heap.h | 
| @@ -1856,6 +1856,31 @@ class Heap { | 
| 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; | 
| 
Hannes Payer (out of office)
2013/04/26 07:27:47
Just set it to false if the destructor is called b
 | 
| +#endif // DEBUG | 
| + heap_->relocation_mutex_->Unlock(); | 
| + } | 
| + } | 
| + | 
| +#ifdef DEBUG | 
| + static bool IsLockedByOptimizerThread(Heap* heap) { | 
| 
Hannes Payer (out of office)
2013/04/26 07:27:47
I think you may want to avoid static methods since
 | 
| + return heap->relocation_mutex_locked_by_optimizer_thread_; | 
| + } | 
| +#endif // DEBUG | 
| + | 
| + private: | 
| + Heap* heap_; | 
| + }; | 
| + | 
| private: | 
| Heap(); | 
| @@ -2330,6 +2355,11 @@ class Heap { | 
| 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; |