OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1808 matching lines...) Loading... |
1819 } else if (type == FIXED_ARRAY_TYPE) { | 1819 } else if (type == FIXED_ARRAY_TYPE) { |
1820 ASSERT(sub_type <= LAST_FIXED_ARRAY_SUB_TYPE); | 1820 ASSERT(sub_type <= LAST_FIXED_ARRAY_SUB_TYPE); |
1821 object_counts_[FIRST_FIXED_ARRAY_SUB_TYPE + sub_type]++; | 1821 object_counts_[FIRST_FIXED_ARRAY_SUB_TYPE + sub_type]++; |
1822 object_sizes_[FIRST_FIXED_ARRAY_SUB_TYPE + sub_type] += size; | 1822 object_sizes_[FIRST_FIXED_ARRAY_SUB_TYPE + sub_type] += size; |
1823 } | 1823 } |
1824 } | 1824 } |
1825 } | 1825 } |
1826 | 1826 |
1827 void CheckpointObjectStats(); | 1827 void CheckpointObjectStats(); |
1828 | 1828 |
1829 // We don't use a ScopedLock here since we want to lock the heap | |
1830 // only when FLAG_parallel_recompilation is true. | |
1831 class RelocationLock { | |
1832 public: | |
1833 explicit RelocationLock(Heap* heap) : heap_(heap) { | |
1834 if (FLAG_parallel_recompilation) { | |
1835 heap_->relocation_mutex_->Lock(); | |
1836 #ifdef DEBUG | |
1837 heap_->relocation_mutex_locked_ = true; | |
1838 #endif // DEBUG | |
1839 } | |
1840 } | |
1841 | |
1842 ~RelocationLock() { | |
1843 if (FLAG_parallel_recompilation) { | |
1844 #ifdef DEBUG | |
1845 heap_->relocation_mutex_locked_ = false; | |
1846 #endif // DEBUG | |
1847 heap_->relocation_mutex_->Unlock(); | |
1848 } | |
1849 } | |
1850 | |
1851 #ifdef DEBUG | |
1852 static bool IsLocked(Heap* heap) { | |
1853 return heap->relocation_mutex_locked_; | |
1854 } | |
1855 #endif // DEBUG | |
1856 | |
1857 private: | |
1858 Heap* heap_; | |
1859 }; | |
1860 | |
1861 private: | 1829 private: |
1862 Heap(); | 1830 Heap(); |
1863 | 1831 |
1864 // This can be calculated directly from a pointer to the heap; however, it is | 1832 // This can be calculated directly from a pointer to the heap; however, it is |
1865 // more expedient to get at the isolate directly from within Heap methods. | 1833 // more expedient to get at the isolate directly from within Heap methods. |
1866 Isolate* isolate_; | 1834 Isolate* isolate_; |
1867 | 1835 |
1868 Object* roots_[kRootListLength]; | 1836 Object* roots_[kRootListLength]; |
1869 | 1837 |
1870 intptr_t code_range_size_; | 1838 intptr_t code_range_size_; |
(...skipping 449 matching lines...) Loading... |
2320 bool configured_; | 2288 bool configured_; |
2321 | 2289 |
2322 ExternalStringTable external_string_table_; | 2290 ExternalStringTable external_string_table_; |
2323 | 2291 |
2324 ErrorObjectList error_object_list_; | 2292 ErrorObjectList error_object_list_; |
2325 | 2293 |
2326 VisitorDispatchTable<ScavengingCallback> scavenging_visitors_table_; | 2294 VisitorDispatchTable<ScavengingCallback> scavenging_visitors_table_; |
2327 | 2295 |
2328 MemoryChunk* chunks_queued_for_free_; | 2296 MemoryChunk* chunks_queued_for_free_; |
2329 | 2297 |
2330 Mutex* relocation_mutex_; | |
2331 #ifdef DEBUG | |
2332 bool relocation_mutex_locked_; | |
2333 #endif // DEBUG; | |
2334 | |
2335 friend class Factory; | 2298 friend class Factory; |
2336 friend class GCTracer; | 2299 friend class GCTracer; |
2337 friend class DisallowAllocationFailure; | 2300 friend class DisallowAllocationFailure; |
2338 friend class AlwaysAllocateScope; | 2301 friend class AlwaysAllocateScope; |
2339 friend class Page; | 2302 friend class Page; |
2340 friend class Isolate; | 2303 friend class Isolate; |
2341 friend class MarkCompactCollector; | 2304 friend class MarkCompactCollector; |
2342 friend class MarkCompactMarkingVisitor; | 2305 friend class MarkCompactMarkingVisitor; |
2343 friend class MapCompact; | 2306 friend class MapCompact; |
2344 #ifdef VERIFY_HEAP | 2307 #ifdef VERIFY_HEAP |
(...skipping 685 matching lines...) Loading... |
3030 AssertNoAllocation no_alloc; // i.e. no gc allowed. | 2993 AssertNoAllocation no_alloc; // i.e. no gc allowed. |
3031 | 2994 |
3032 private: | 2995 private: |
3033 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2996 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
3034 }; | 2997 }; |
3035 #endif // DEBUG | 2998 #endif // DEBUG |
3036 | 2999 |
3037 } } // namespace v8::internal | 3000 } } // namespace v8::internal |
3038 | 3001 |
3039 #endif // V8_HEAP_H_ | 3002 #endif // V8_HEAP_H_ |
OLD | NEW |