Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_HEAP_HEAP_H_ | 5 #ifndef V8_HEAP_HEAP_H_ |
| 6 #define V8_HEAP_HEAP_H_ | 6 #define V8_HEAP_HEAP_H_ |
| 7 | 7 |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <map> | 9 #include <map> |
| 10 | 10 |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 435 kStringTableRootIndex, | 435 kStringTableRootIndex, |
| 436 | 436 |
| 437 #define ROOT_INDEX_DECLARATION(type, name, camel_name) k##camel_name##RootIndex, | 437 #define ROOT_INDEX_DECLARATION(type, name, camel_name) k##camel_name##RootIndex, |
| 438 SMI_ROOT_LIST(ROOT_INDEX_DECLARATION) | 438 SMI_ROOT_LIST(ROOT_INDEX_DECLARATION) |
| 439 #undef ROOT_INDEX_DECLARATION | 439 #undef ROOT_INDEX_DECLARATION |
| 440 kRootListLength, | 440 kRootListLength, |
| 441 kStrongRootListLength = kStringTableRootIndex, | 441 kStrongRootListLength = kStringTableRootIndex, |
| 442 kSmiRootsStart = kStringTableRootIndex + 1 | 442 kSmiRootsStart = kStringTableRootIndex + 1 |
| 443 }; | 443 }; |
| 444 | 444 |
| 445 enum FindMementoMode { kForRuntime, kForGC }; | |
| 446 | |
| 447 enum HeapState { NOT_IN_GC, SCAVENGE, MARK_COMPACT }; | |
| 448 | |
| 445 // Indicates whether live bytes adjustment is triggered | 449 // Indicates whether live bytes adjustment is triggered |
| 446 // - from within the GC code before sweeping started (SEQUENTIAL_TO_SWEEPER), | 450 // - from within the GC code before sweeping started (SEQUENTIAL_TO_SWEEPER), |
| 447 // - or from within GC (CONCURRENT_TO_SWEEPER), | 451 // - or from within GC (CONCURRENT_TO_SWEEPER), |
| 448 // - or mutator code (CONCURRENT_TO_SWEEPER). | 452 // - or mutator code (CONCURRENT_TO_SWEEPER). |
| 449 enum InvocationMode { SEQUENTIAL_TO_SWEEPER, CONCURRENT_TO_SWEEPER }; | 453 enum InvocationMode { SEQUENTIAL_TO_SWEEPER, CONCURRENT_TO_SWEEPER }; |
| 450 | 454 |
| 451 enum PretenuringFeedbackInsertionMode { kCached, kGlobal }; | 455 enum UpdateAllocationSiteMode { kGlobal, kCached }; |
|
Michael Lippautz
2016/02/02 09:15:35
We already had an enum (dead code) for that purpos
| |
| 452 | |
| 453 enum FindMementoMode { kForRuntime, kForGC }; | |
| 454 | |
| 455 enum HeapState { NOT_IN_GC, SCAVENGE, MARK_COMPACT }; | |
| 456 | 456 |
| 457 // Taking this lock prevents the GC from entering a phase that relocates | 457 // Taking this lock prevents the GC from entering a phase that relocates |
| 458 // object references. | 458 // object references. |
| 459 class RelocationLock { | 459 class RelocationLock { |
| 460 public: | 460 public: |
| 461 explicit RelocationLock(Heap* heap) : heap_(heap) { | 461 explicit RelocationLock(Heap* heap) : heap_(heap) { |
| 462 heap_->relocation_mutex_.Lock(); | 462 heap_->relocation_mutex_.Lock(); |
| 463 } | 463 } |
| 464 | 464 |
| 465 ~RelocationLock() { heap_->relocation_mutex_.Unlock(); } | 465 ~RelocationLock() { heap_->relocation_mutex_.Unlock(); } |
| (...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1354 | 1354 |
| 1355 // =========================================================================== | 1355 // =========================================================================== |
| 1356 // Allocation site tracking. ================================================= | 1356 // Allocation site tracking. ================================================= |
| 1357 // =========================================================================== | 1357 // =========================================================================== |
| 1358 | 1358 |
| 1359 // Updates the AllocationSite of a given {object}. If the global prenuring | 1359 // Updates the AllocationSite of a given {object}. If the global prenuring |
| 1360 // storage is passed as {pretenuring_feedback} the memento found count on | 1360 // storage is passed as {pretenuring_feedback} the memento found count on |
| 1361 // the corresponding allocation site is immediately updated and an entry | 1361 // the corresponding allocation site is immediately updated and an entry |
| 1362 // in the hash map is created. Otherwise the entry (including a the count | 1362 // in the hash map is created. Otherwise the entry (including a the count |
| 1363 // value) is cached on the local pretenuring feedback. | 1363 // value) is cached on the local pretenuring feedback. |
| 1364 template <UpdateAllocationSiteMode mode> | |
| 1364 inline void UpdateAllocationSite(HeapObject* object, | 1365 inline void UpdateAllocationSite(HeapObject* object, |
| 1365 HashMap* pretenuring_feedback); | 1366 HashMap* pretenuring_feedback); |
| 1366 | 1367 |
| 1367 // Removes an entry from the global pretenuring storage. | 1368 // Removes an entry from the global pretenuring storage. |
| 1368 inline void RemoveAllocationSitePretenuringFeedback(AllocationSite* site); | 1369 inline void RemoveAllocationSitePretenuringFeedback(AllocationSite* site); |
| 1369 | 1370 |
| 1370 // Merges local pretenuring feedback into the global one. Note that this | 1371 // Merges local pretenuring feedback into the global one. Note that this |
| 1371 // method needs to be called after evacuation, as allocation sites may be | 1372 // method needs to be called after evacuation, as allocation sites may be |
| 1372 // evacuated and this method resolves forward pointers accordingly. | 1373 // evacuated and this method resolves forward pointers accordingly. |
| 1373 void MergeAllocationSitePretenuringFeedback( | 1374 void MergeAllocationSitePretenuringFeedback( |
| (...skipping 1281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2655 | 2656 |
| 2656 private: | 2657 private: |
| 2657 friend class NewSpace; | 2658 friend class NewSpace; |
| 2658 DISALLOW_COPY_AND_ASSIGN(InlineAllocationObserver); | 2659 DISALLOW_COPY_AND_ASSIGN(InlineAllocationObserver); |
| 2659 }; | 2660 }; |
| 2660 | 2661 |
| 2661 } // namespace internal | 2662 } // namespace internal |
| 2662 } // namespace v8 | 2663 } // namespace v8 |
| 2663 | 2664 |
| 2664 #endif // V8_HEAP_HEAP_H_ | 2665 #endif // V8_HEAP_HEAP_H_ |
| OLD | NEW |