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 795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
806 Address* OldSpaceAllocationTopAddress() { | 806 Address* OldSpaceAllocationTopAddress() { |
807 return old_space_->allocation_top_address(); | 807 return old_space_->allocation_top_address(); |
808 } | 808 } |
809 Address* OldSpaceAllocationLimitAddress() { | 809 Address* OldSpaceAllocationLimitAddress() { |
810 return old_space_->allocation_limit_address(); | 810 return old_space_->allocation_limit_address(); |
811 } | 811 } |
812 | 812 |
813 // TODO(hpayer): There is still a missmatch between capacity and actual | 813 // TODO(hpayer): There is still a missmatch between capacity and actual |
814 // committed memory size. | 814 // committed memory size. |
815 bool CanExpandOldGeneration(int size) { | 815 bool CanExpandOldGeneration(int size) { |
816 if (force_oom()) return false; | |
816 return (CommittedOldGenerationMemory() + size) < MaxOldGenerationSize(); | 817 return (CommittedOldGenerationMemory() + size) < MaxOldGenerationSize(); |
817 } | 818 } |
818 | 819 |
819 // Clear the Instanceof cache (used when a prototype changes). | 820 // Clear the Instanceof cache (used when a prototype changes). |
820 inline void ClearInstanceofCache(); | 821 inline void ClearInstanceofCache(); |
821 | 822 |
822 // FreeSpace objects have a null map after deserialization. Update the map. | 823 // FreeSpace objects have a null map after deserialization. Update the map. |
823 void RepairFreeListsAfterDeserialization(); | 824 void RepairFreeListsAfterDeserialization(); |
824 | 825 |
825 // Move len elements within a given array from src_index index to dst_index | 826 // Move len elements within a given array from src_index index to dst_index |
(...skipping 1280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2106 MUST_USE_RESULT AllocationResult | 2107 MUST_USE_RESULT AllocationResult |
2107 AllocateForeign(Address address, PretenureFlag pretenure = NOT_TENURED); | 2108 AllocateForeign(Address address, PretenureFlag pretenure = NOT_TENURED); |
2108 | 2109 |
2109 MUST_USE_RESULT AllocationResult | 2110 MUST_USE_RESULT AllocationResult |
2110 AllocateCode(int object_size, bool immovable); | 2111 AllocateCode(int object_size, bool immovable); |
2111 | 2112 |
2112 MUST_USE_RESULT AllocationResult InternalizeStringWithKey(HashTableKey* key); | 2113 MUST_USE_RESULT AllocationResult InternalizeStringWithKey(HashTableKey* key); |
2113 | 2114 |
2114 MUST_USE_RESULT AllocationResult InternalizeString(String* str); | 2115 MUST_USE_RESULT AllocationResult InternalizeString(String* str); |
2115 | 2116 |
2117 void set_force_oom(bool value) { force_oom_ = value; } | |
2118 bool force_oom() { return force_oom_; } | |
Hannes Payer (out of office)
2015/12/10 18:32:06
you can remove the getter since it is just used in
Michael Lippautz
2015/12/10 18:34:55
Done.
| |
2119 | |
2116 // The amount of external memory registered through the API kept alive | 2120 // The amount of external memory registered through the API kept alive |
2117 // by global handles | 2121 // by global handles |
2118 int64_t amount_of_external_allocated_memory_; | 2122 int64_t amount_of_external_allocated_memory_; |
2119 | 2123 |
2120 // Caches the amount of external memory registered at the last global gc. | 2124 // Caches the amount of external memory registered at the last global gc. |
2121 int64_t amount_of_external_allocated_memory_at_last_global_gc_; | 2125 int64_t amount_of_external_allocated_memory_at_last_global_gc_; |
2122 | 2126 |
2123 // This can be calculated directly from a pointer to the heap; however, it is | 2127 // This can be calculated directly from a pointer to the heap; however, it is |
2124 // more expedient to get at the isolate directly from within Heap methods. | 2128 // more expedient to get at the isolate directly from within Heap methods. |
2125 Isolate* isolate_; | 2129 Isolate* isolate_; |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2356 int gc_callbacks_depth_; | 2360 int gc_callbacks_depth_; |
2357 | 2361 |
2358 bool deserialization_complete_; | 2362 bool deserialization_complete_; |
2359 | 2363 |
2360 bool concurrent_sweeping_enabled_; | 2364 bool concurrent_sweeping_enabled_; |
2361 | 2365 |
2362 StrongRootsList* strong_roots_list_; | 2366 StrongRootsList* strong_roots_list_; |
2363 | 2367 |
2364 ArrayBufferTracker* array_buffer_tracker_; | 2368 ArrayBufferTracker* array_buffer_tracker_; |
2365 | 2369 |
2370 // Used for testing purposes. | |
2371 bool force_oom_; | |
2372 | |
2366 // Classes in "heap" can be friends. | 2373 // Classes in "heap" can be friends. |
2367 friend class AlwaysAllocateScope; | 2374 friend class AlwaysAllocateScope; |
2368 friend class GCCallbacksScope; | 2375 friend class GCCallbacksScope; |
2369 friend class GCTracer; | 2376 friend class GCTracer; |
2370 friend class HeapIterator; | 2377 friend class HeapIterator; |
2371 friend class IdleScavengeObserver; | 2378 friend class IdleScavengeObserver; |
2372 friend class IncrementalMarking; | 2379 friend class IncrementalMarking; |
2373 friend class IteratePointersToFromSpaceVisitor; | 2380 friend class IteratePointersToFromSpaceVisitor; |
2374 friend class MarkCompactCollector; | 2381 friend class MarkCompactCollector; |
2375 friend class MarkCompactMarkingVisitor; | 2382 friend class MarkCompactMarkingVisitor; |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2735 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 2742 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
2736 | 2743 |
2737 private: | 2744 private: |
2738 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2745 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
2739 }; | 2746 }; |
2740 #endif // DEBUG | 2747 #endif // DEBUG |
2741 } // namespace internal | 2748 } // namespace internal |
2742 } // namespace v8 | 2749 } // namespace v8 |
2743 | 2750 |
2744 #endif // V8_HEAP_HEAP_H_ | 2751 #endif // V8_HEAP_HEAP_H_ |
OLD | NEW |