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 2095 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2106 MUST_USE_RESULT AllocationResult | 2106 MUST_USE_RESULT AllocationResult |
2107 AllocateForeign(Address address, PretenureFlag pretenure = NOT_TENURED); | 2107 AllocateForeign(Address address, PretenureFlag pretenure = NOT_TENURED); |
2108 | 2108 |
2109 MUST_USE_RESULT AllocationResult | 2109 MUST_USE_RESULT AllocationResult |
2110 AllocateCode(int object_size, bool immovable); | 2110 AllocateCode(int object_size, bool immovable); |
2111 | 2111 |
2112 MUST_USE_RESULT AllocationResult InternalizeStringWithKey(HashTableKey* key); | 2112 MUST_USE_RESULT AllocationResult InternalizeStringWithKey(HashTableKey* key); |
2113 | 2113 |
2114 MUST_USE_RESULT AllocationResult InternalizeString(String* str); | 2114 MUST_USE_RESULT AllocationResult InternalizeString(String* str); |
2115 | 2115 |
| 2116 void set_force_oom(bool value) { force_oom_ = value; } |
| 2117 bool force_oom() { return force_oom_; } |
| 2118 |
2116 // The amount of external memory registered through the API kept alive | 2119 // The amount of external memory registered through the API kept alive |
2117 // by global handles | 2120 // by global handles |
2118 int64_t amount_of_external_allocated_memory_; | 2121 int64_t amount_of_external_allocated_memory_; |
2119 | 2122 |
2120 // Caches the amount of external memory registered at the last global gc. | 2123 // Caches the amount of external memory registered at the last global gc. |
2121 int64_t amount_of_external_allocated_memory_at_last_global_gc_; | 2124 int64_t amount_of_external_allocated_memory_at_last_global_gc_; |
2122 | 2125 |
2123 // This can be calculated directly from a pointer to the heap; however, it is | 2126 // 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. | 2127 // more expedient to get at the isolate directly from within Heap methods. |
2125 Isolate* isolate_; | 2128 Isolate* isolate_; |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2356 int gc_callbacks_depth_; | 2359 int gc_callbacks_depth_; |
2357 | 2360 |
2358 bool deserialization_complete_; | 2361 bool deserialization_complete_; |
2359 | 2362 |
2360 bool concurrent_sweeping_enabled_; | 2363 bool concurrent_sweeping_enabled_; |
2361 | 2364 |
2362 StrongRootsList* strong_roots_list_; | 2365 StrongRootsList* strong_roots_list_; |
2363 | 2366 |
2364 ArrayBufferTracker* array_buffer_tracker_; | 2367 ArrayBufferTracker* array_buffer_tracker_; |
2365 | 2368 |
| 2369 // Used for testing purposes. |
| 2370 bool force_oom_; |
| 2371 |
2366 // Classes in "heap" can be friends. | 2372 // Classes in "heap" can be friends. |
2367 friend class AlwaysAllocateScope; | 2373 friend class AlwaysAllocateScope; |
2368 friend class GCCallbacksScope; | 2374 friend class GCCallbacksScope; |
2369 friend class GCTracer; | 2375 friend class GCTracer; |
2370 friend class HeapIterator; | 2376 friend class HeapIterator; |
2371 friend class IdleScavengeObserver; | 2377 friend class IdleScavengeObserver; |
2372 friend class IncrementalMarking; | 2378 friend class IncrementalMarking; |
2373 friend class IteratePointersToFromSpaceVisitor; | 2379 friend class IteratePointersToFromSpaceVisitor; |
2374 friend class MarkCompactCollector; | 2380 friend class MarkCompactCollector; |
2375 friend class MarkCompactMarkingVisitor; | 2381 friend class MarkCompactMarkingVisitor; |
2376 friend class NewSpace; | 2382 friend class NewSpace; |
2377 friend class ObjectStatsVisitor; | 2383 friend class ObjectStatsVisitor; |
2378 friend class Page; | 2384 friend class Page; |
| 2385 friend class PagedSpace; |
2379 friend class Scavenger; | 2386 friend class Scavenger; |
2380 friend class StoreBuffer; | 2387 friend class StoreBuffer; |
2381 | 2388 |
2382 // The allocator interface. | 2389 // The allocator interface. |
2383 friend class Factory; | 2390 friend class Factory; |
2384 | 2391 |
2385 // The Isolate constructs us. | 2392 // The Isolate constructs us. |
2386 friend class Isolate; | 2393 friend class Isolate; |
2387 | 2394 |
2388 // Used in cctest. | 2395 // Used in cctest. |
(...skipping 346 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 |