| 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 1653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1664 MUST_USE_RESULT AllocationResult | 1664 MUST_USE_RESULT AllocationResult |
| 1665 AllocateFixedArray(int length, PretenureFlag pretenure = NOT_TENURED); | 1665 AllocateFixedArray(int length, PretenureFlag pretenure = NOT_TENURED); |
| 1666 | 1666 |
| 1667 static const int kInitialStringTableSize = 2048; | 1667 static const int kInitialStringTableSize = 2048; |
| 1668 static const int kInitialEvalCacheSize = 64; | 1668 static const int kInitialEvalCacheSize = 64; |
| 1669 static const int kInitialNumberStringCacheSize = 256; | 1669 static const int kInitialNumberStringCacheSize = 256; |
| 1670 | 1670 |
| 1671 private: | 1671 private: |
| 1672 Heap(); | 1672 Heap(); |
| 1673 | 1673 |
| 1674 int current_gc_flags() { return current_gc_flags_; } |
| 1675 void set_current_gc_flags(int flags) { |
| 1676 current_gc_flags_ = flags; |
| 1677 DCHECK(!ShouldFinalizeIncrementalMarking() || |
| 1678 !ShouldAbortIncrementalMarking()); |
| 1679 } |
| 1680 |
| 1681 inline bool ShouldReduceMemory() const { |
| 1682 return current_gc_flags_ & kReduceMemoryFootprintMask; |
| 1683 } |
| 1684 |
| 1685 inline bool ShouldAbortIncrementalMarking() const { |
| 1686 return current_gc_flags_ & kAbortIncrementalMarkingMask; |
| 1687 } |
| 1688 |
| 1689 inline bool ShouldFinalizeIncrementalMarking() const { |
| 1690 return current_gc_flags_ & kFinalizeIncrementalMarkingMask; |
| 1691 } |
| 1692 |
| 1674 // The amount of external memory registered through the API kept alive | 1693 // The amount of external memory registered through the API kept alive |
| 1675 // by global handles | 1694 // by global handles |
| 1676 int64_t amount_of_external_allocated_memory_; | 1695 int64_t amount_of_external_allocated_memory_; |
| 1677 | 1696 |
| 1678 // Caches the amount of external memory registered at the last global gc. | 1697 // Caches the amount of external memory registered at the last global gc. |
| 1679 int64_t amount_of_external_allocated_memory_at_last_global_gc_; | 1698 int64_t amount_of_external_allocated_memory_at_last_global_gc_; |
| 1680 | 1699 |
| 1681 // This can be calculated directly from a pointer to the heap; however, it is | 1700 // This can be calculated directly from a pointer to the heap; however, it is |
| 1682 // more expedient to get at the isolate directly from within Heap methods. | 1701 // more expedient to get at the isolate directly from within Heap methods. |
| 1683 Isolate* isolate_; | 1702 Isolate* isolate_; |
| (...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2266 static const int kMaxMarkCompactsInIdleRound = 7; | 2285 static const int kMaxMarkCompactsInIdleRound = 7; |
| 2267 static const int kIdleScavengeThreshold = 5; | 2286 static const int kIdleScavengeThreshold = 5; |
| 2268 | 2287 |
| 2269 // Shared state read by the scavenge collector and set by ScavengeObject. | 2288 // Shared state read by the scavenge collector and set by ScavengeObject. |
| 2270 PromotionQueue promotion_queue_; | 2289 PromotionQueue promotion_queue_; |
| 2271 | 2290 |
| 2272 // Flag is set when the heap has been configured. The heap can be repeatedly | 2291 // Flag is set when the heap has been configured. The heap can be repeatedly |
| 2273 // configured through the API until it is set up. | 2292 // configured through the API until it is set up. |
| 2274 bool configured_; | 2293 bool configured_; |
| 2275 | 2294 |
| 2295 // Currently set GC flags that are respected by all GC components. |
| 2296 int current_gc_flags_; |
| 2297 |
| 2276 ExternalStringTable external_string_table_; | 2298 ExternalStringTable external_string_table_; |
| 2277 | 2299 |
| 2278 VisitorDispatchTable<ScavengingCallback> scavenging_visitors_table_; | 2300 VisitorDispatchTable<ScavengingCallback> scavenging_visitors_table_; |
| 2279 | 2301 |
| 2280 MemoryChunk* chunks_queued_for_free_; | 2302 MemoryChunk* chunks_queued_for_free_; |
| 2281 | 2303 |
| 2282 base::Mutex relocation_mutex_; | 2304 base::Mutex relocation_mutex_; |
| 2283 | 2305 |
| 2284 int gc_callbacks_depth_; | 2306 int gc_callbacks_depth_; |
| 2285 | 2307 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 2309 struct StrongRootsList; | 2331 struct StrongRootsList; |
| 2310 StrongRootsList* strong_roots_list_; | 2332 StrongRootsList* strong_roots_list_; |
| 2311 | 2333 |
| 2312 friend class AlwaysAllocateScope; | 2334 friend class AlwaysAllocateScope; |
| 2313 friend class Bootstrapper; | 2335 friend class Bootstrapper; |
| 2314 friend class Deserializer; | 2336 friend class Deserializer; |
| 2315 friend class Factory; | 2337 friend class Factory; |
| 2316 friend class GCCallbacksScope; | 2338 friend class GCCallbacksScope; |
| 2317 friend class GCTracer; | 2339 friend class GCTracer; |
| 2318 friend class HeapIterator; | 2340 friend class HeapIterator; |
| 2341 friend class IncrementalMarking; |
| 2319 friend class Isolate; | 2342 friend class Isolate; |
| 2320 friend class MarkCompactCollector; | 2343 friend class MarkCompactCollector; |
| 2321 friend class MarkCompactMarkingVisitor; | 2344 friend class MarkCompactMarkingVisitor; |
| 2322 friend class MapCompact; | 2345 friend class MapCompact; |
| 2323 friend class Page; | 2346 friend class Page; |
| 2324 | 2347 |
| 2348 // Used in cctest. |
| 2349 friend class HeapTester; |
| 2350 |
| 2325 DISALLOW_COPY_AND_ASSIGN(Heap); | 2351 DISALLOW_COPY_AND_ASSIGN(Heap); |
| 2326 }; | 2352 }; |
| 2327 | 2353 |
| 2328 | 2354 |
| 2329 class HeapStats { | 2355 class HeapStats { |
| 2330 public: | 2356 public: |
| 2331 static const int kStartMarker = 0xDECADE00; | 2357 static const int kStartMarker = 0xDECADE00; |
| 2332 static const int kEndMarker = 0xDECADE01; | 2358 static const int kEndMarker = 0xDECADE01; |
| 2333 | 2359 |
| 2334 int* start_marker; // 0 | 2360 int* start_marker; // 0 |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2709 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 2735 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
| 2710 | 2736 |
| 2711 private: | 2737 private: |
| 2712 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2738 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
| 2713 }; | 2739 }; |
| 2714 #endif // DEBUG | 2740 #endif // DEBUG |
| 2715 } | 2741 } |
| 2716 } // namespace v8::internal | 2742 } // namespace v8::internal |
| 2717 | 2743 |
| 2718 #endif // V8_HEAP_HEAP_H_ | 2744 #endif // V8_HEAP_HEAP_H_ |
| OLD | NEW |