| 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 1646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1657 MUST_USE_RESULT AllocationResult | 1657 MUST_USE_RESULT AllocationResult |
| 1658 AllocateFixedArray(int length, PretenureFlag pretenure = NOT_TENURED); | 1658 AllocateFixedArray(int length, PretenureFlag pretenure = NOT_TENURED); |
| 1659 | 1659 |
| 1660 static const int kInitialStringTableSize = 2048; | 1660 static const int kInitialStringTableSize = 2048; |
| 1661 static const int kInitialEvalCacheSize = 64; | 1661 static const int kInitialEvalCacheSize = 64; |
| 1662 static const int kInitialNumberStringCacheSize = 256; | 1662 static const int kInitialNumberStringCacheSize = 256; |
| 1663 | 1663 |
| 1664 private: | 1664 private: |
| 1665 Heap(); | 1665 Heap(); |
| 1666 | 1666 |
| 1667 int current_gc_flags() { return current_gc_flags_; } |
| 1668 void set_current_gc_flags(int flags) { |
| 1669 current_gc_flags_ = flags; |
| 1670 DCHECK(!ShouldFinalizeIncrementalMarking() || |
| 1671 !ShouldAbortIncrementalMarking()); |
| 1672 } |
| 1673 |
| 1674 inline bool ShouldReduceMemory() const { |
| 1675 return current_gc_flags_ & kReduceMemoryFootprintMask; |
| 1676 } |
| 1677 |
| 1678 inline bool ShouldAbortIncrementalMarking() const { |
| 1679 return current_gc_flags_ & kAbortIncrementalMarkingMask; |
| 1680 } |
| 1681 |
| 1682 inline bool ShouldFinalizeIncrementalMarking() const { |
| 1683 return current_gc_flags_ & kFinalizeIncrementalMarkingMask; |
| 1684 } |
| 1685 |
| 1667 // The amount of external memory registered through the API kept alive | 1686 // The amount of external memory registered through the API kept alive |
| 1668 // by global handles | 1687 // by global handles |
| 1669 int64_t amount_of_external_allocated_memory_; | 1688 int64_t amount_of_external_allocated_memory_; |
| 1670 | 1689 |
| 1671 // Caches the amount of external memory registered at the last global gc. | 1690 // Caches the amount of external memory registered at the last global gc. |
| 1672 int64_t amount_of_external_allocated_memory_at_last_global_gc_; | 1691 int64_t amount_of_external_allocated_memory_at_last_global_gc_; |
| 1673 | 1692 |
| 1674 // This can be calculated directly from a pointer to the heap; however, it is | 1693 // This can be calculated directly from a pointer to the heap; however, it is |
| 1675 // more expedient to get at the isolate directly from within Heap methods. | 1694 // more expedient to get at the isolate directly from within Heap methods. |
| 1676 Isolate* isolate_; | 1695 Isolate* isolate_; |
| (...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2256 static const int kMaxMarkCompactsInIdleRound = 7; | 2275 static const int kMaxMarkCompactsInIdleRound = 7; |
| 2257 static const int kIdleScavengeThreshold = 5; | 2276 static const int kIdleScavengeThreshold = 5; |
| 2258 | 2277 |
| 2259 // Shared state read by the scavenge collector and set by ScavengeObject. | 2278 // Shared state read by the scavenge collector and set by ScavengeObject. |
| 2260 PromotionQueue promotion_queue_; | 2279 PromotionQueue promotion_queue_; |
| 2261 | 2280 |
| 2262 // Flag is set when the heap has been configured. The heap can be repeatedly | 2281 // Flag is set when the heap has been configured. The heap can be repeatedly |
| 2263 // configured through the API until it is set up. | 2282 // configured through the API until it is set up. |
| 2264 bool configured_; | 2283 bool configured_; |
| 2265 | 2284 |
| 2285 // Currently set GC flags that are respected by all GC components. |
| 2286 int current_gc_flags_; |
| 2287 |
| 2266 ExternalStringTable external_string_table_; | 2288 ExternalStringTable external_string_table_; |
| 2267 | 2289 |
| 2268 VisitorDispatchTable<ScavengingCallback> scavenging_visitors_table_; | 2290 VisitorDispatchTable<ScavengingCallback> scavenging_visitors_table_; |
| 2269 | 2291 |
| 2270 MemoryChunk* chunks_queued_for_free_; | 2292 MemoryChunk* chunks_queued_for_free_; |
| 2271 | 2293 |
| 2272 base::Mutex relocation_mutex_; | 2294 base::Mutex relocation_mutex_; |
| 2273 | 2295 |
| 2274 int gc_callbacks_depth_; | 2296 int gc_callbacks_depth_; |
| 2275 | 2297 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 2299 struct StrongRootsList; | 2321 struct StrongRootsList; |
| 2300 StrongRootsList* strong_roots_list_; | 2322 StrongRootsList* strong_roots_list_; |
| 2301 | 2323 |
| 2302 friend class AlwaysAllocateScope; | 2324 friend class AlwaysAllocateScope; |
| 2303 friend class Bootstrapper; | 2325 friend class Bootstrapper; |
| 2304 friend class Deserializer; | 2326 friend class Deserializer; |
| 2305 friend class Factory; | 2327 friend class Factory; |
| 2306 friend class GCCallbacksScope; | 2328 friend class GCCallbacksScope; |
| 2307 friend class GCTracer; | 2329 friend class GCTracer; |
| 2308 friend class HeapIterator; | 2330 friend class HeapIterator; |
| 2331 friend class IncrementalMarking; |
| 2309 friend class Isolate; | 2332 friend class Isolate; |
| 2310 friend class MarkCompactCollector; | 2333 friend class MarkCompactCollector; |
| 2311 friend class MarkCompactMarkingVisitor; | 2334 friend class MarkCompactMarkingVisitor; |
| 2312 friend class MapCompact; | 2335 friend class MapCompact; |
| 2313 friend class Page; | 2336 friend class Page; |
| 2314 | 2337 |
| 2338 // Used in cctest. |
| 2339 friend class HeapTester; |
| 2340 |
| 2315 DISALLOW_COPY_AND_ASSIGN(Heap); | 2341 DISALLOW_COPY_AND_ASSIGN(Heap); |
| 2316 }; | 2342 }; |
| 2317 | 2343 |
| 2318 | 2344 |
| 2319 class HeapStats { | 2345 class HeapStats { |
| 2320 public: | 2346 public: |
| 2321 static const int kStartMarker = 0xDECADE00; | 2347 static const int kStartMarker = 0xDECADE00; |
| 2322 static const int kEndMarker = 0xDECADE01; | 2348 static const int kEndMarker = 0xDECADE01; |
| 2323 | 2349 |
| 2324 int* start_marker; // 0 | 2350 int* start_marker; // 0 |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2699 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 2725 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
| 2700 | 2726 |
| 2701 private: | 2727 private: |
| 2702 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2728 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
| 2703 }; | 2729 }; |
| 2704 #endif // DEBUG | 2730 #endif // DEBUG |
| 2705 } | 2731 } |
| 2706 } // namespace v8::internal | 2732 } // namespace v8::internal |
| 2707 | 2733 |
| 2708 #endif // V8_HEAP_HEAP_H_ | 2734 #endif // V8_HEAP_HEAP_H_ |
| OLD | NEW |