| 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 1359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1370 // Allocation site tracking. ================================================= | 1370 // Allocation site tracking. ================================================= |
| 1371 // =========================================================================== | 1371 // =========================================================================== |
| 1372 | 1372 |
| 1373 // Updates the AllocationSite of a given {object}. If the global prenuring | 1373 // Updates the AllocationSite of a given {object}. If the global prenuring |
| 1374 // storage is passed as {pretenuring_feedback} the memento found count on | 1374 // storage is passed as {pretenuring_feedback} the memento found count on |
| 1375 // the corresponding allocation site is immediately updated and an entry | 1375 // the corresponding allocation site is immediately updated and an entry |
| 1376 // in the hash map is created. Otherwise the entry (including a the count | 1376 // in the hash map is created. Otherwise the entry (including a the count |
| 1377 // value) is cached on the local pretenuring feedback. | 1377 // value) is cached on the local pretenuring feedback. |
| 1378 template <UpdateAllocationSiteMode mode> | 1378 template <UpdateAllocationSiteMode mode> |
| 1379 inline void UpdateAllocationSite(HeapObject* object, | 1379 inline void UpdateAllocationSite(HeapObject* object, |
| 1380 HashMap* pretenuring_feedback); | 1380 base::HashMap* pretenuring_feedback); |
| 1381 | 1381 |
| 1382 // Removes an entry from the global pretenuring storage. | 1382 // Removes an entry from the global pretenuring storage. |
| 1383 inline void RemoveAllocationSitePretenuringFeedback(AllocationSite* site); | 1383 inline void RemoveAllocationSitePretenuringFeedback(AllocationSite* site); |
| 1384 | 1384 |
| 1385 // Merges local pretenuring feedback into the global one. Note that this | 1385 // Merges local pretenuring feedback into the global one. Note that this |
| 1386 // method needs to be called after evacuation, as allocation sites may be | 1386 // method needs to be called after evacuation, as allocation sites may be |
| 1387 // evacuated and this method resolves forward pointers accordingly. | 1387 // evacuated and this method resolves forward pointers accordingly. |
| 1388 void MergeAllocationSitePretenuringFeedback( | 1388 void MergeAllocationSitePretenuringFeedback( |
| 1389 const HashMap& local_pretenuring_feedback); | 1389 const base::HashMap& local_pretenuring_feedback); |
| 1390 | 1390 |
| 1391 // ============================================================================= | 1391 // ============================================================================= |
| 1392 | 1392 |
| 1393 #ifdef VERIFY_HEAP | 1393 #ifdef VERIFY_HEAP |
| 1394 // Verify the heap is in its normal state before or after a GC. | 1394 // Verify the heap is in its normal state before or after a GC. |
| 1395 void Verify(); | 1395 void Verify(); |
| 1396 #endif | 1396 #endif |
| 1397 | 1397 |
| 1398 #ifdef DEBUG | 1398 #ifdef DEBUG |
| 1399 void set_allocation_timeout(int timeout) { allocation_timeout_ = timeout; } | 1399 void set_allocation_timeout(int timeout) { allocation_timeout_ = timeout; } |
| (...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2203 // If the --deopt_every_n_garbage_collections flag is set to a positive value, | 2203 // If the --deopt_every_n_garbage_collections flag is set to a positive value, |
| 2204 // this variable holds the number of garbage collections since the last | 2204 // this variable holds the number of garbage collections since the last |
| 2205 // deoptimization triggered by garbage collection. | 2205 // deoptimization triggered by garbage collection. |
| 2206 int gcs_since_last_deopt_; | 2206 int gcs_since_last_deopt_; |
| 2207 | 2207 |
| 2208 // The feedback storage is used to store allocation sites (keys) and how often | 2208 // The feedback storage is used to store allocation sites (keys) and how often |
| 2209 // they have been visited (values) by finding a memento behind an object. The | 2209 // they have been visited (values) by finding a memento behind an object. The |
| 2210 // storage is only alive temporary during a GC. The invariant is that all | 2210 // storage is only alive temporary during a GC. The invariant is that all |
| 2211 // pointers in this map are already fixed, i.e., they do not point to | 2211 // pointers in this map are already fixed, i.e., they do not point to |
| 2212 // forwarding pointers. | 2212 // forwarding pointers. |
| 2213 HashMap* global_pretenuring_feedback_; | 2213 base::HashMap* global_pretenuring_feedback_; |
| 2214 | 2214 |
| 2215 char trace_ring_buffer_[kTraceRingBufferSize]; | 2215 char trace_ring_buffer_[kTraceRingBufferSize]; |
| 2216 // If it's not full then the data is from 0 to ring_buffer_end_. If it's | 2216 // If it's not full then the data is from 0 to ring_buffer_end_. If it's |
| 2217 // full then the data is from ring_buffer_end_ to the end of the buffer and | 2217 // full then the data is from ring_buffer_end_ to the end of the buffer and |
| 2218 // from 0 to ring_buffer_end_. | 2218 // from 0 to ring_buffer_end_. |
| 2219 bool ring_buffer_full_; | 2219 bool ring_buffer_full_; |
| 2220 size_t ring_buffer_end_; | 2220 size_t ring_buffer_end_; |
| 2221 | 2221 |
| 2222 // Shared state read by the scavenge collector and set by ScavengeObject. | 2222 // Shared state read by the scavenge collector and set by ScavengeObject. |
| 2223 PromotionQueue promotion_queue_; | 2223 PromotionQueue promotion_queue_; |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2668 friend class LargeObjectSpace; | 2668 friend class LargeObjectSpace; |
| 2669 friend class NewSpace; | 2669 friend class NewSpace; |
| 2670 friend class PagedSpace; | 2670 friend class PagedSpace; |
| 2671 DISALLOW_COPY_AND_ASSIGN(AllocationObserver); | 2671 DISALLOW_COPY_AND_ASSIGN(AllocationObserver); |
| 2672 }; | 2672 }; |
| 2673 | 2673 |
| 2674 } // namespace internal | 2674 } // namespace internal |
| 2675 } // namespace v8 | 2675 } // namespace v8 |
| 2676 | 2676 |
| 2677 #endif // V8_HEAP_HEAP_H_ | 2677 #endif // V8_HEAP_HEAP_H_ |
| OLD | NEW |