| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef RUNTIME_VM_HEAP_H_ | 5 #ifndef RUNTIME_VM_HEAP_H_ |
| 6 #define RUNTIME_VM_HEAP_H_ | 6 #define RUNTIME_VM_HEAP_H_ |
| 7 | 7 |
| 8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
| 9 #include "vm/allocation.h" | 9 #include "vm/allocation.h" |
| 10 #include "vm/flags.h" | 10 #include "vm/flags.h" |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 // Visit all objects, including FreeListElement "objects". Caller must ensure | 308 // Visit all objects, including FreeListElement "objects". Caller must ensure |
| 309 // concurrent sweeper is not running, and the visitor must not allocate. | 309 // concurrent sweeper is not running, and the visitor must not allocate. |
| 310 void VisitObjects(ObjectVisitor* visitor) const; | 310 void VisitObjects(ObjectVisitor* visitor) const; |
| 311 void VisitObjectsNoImagePages(ObjectVisitor* visitor) const; | 311 void VisitObjectsNoImagePages(ObjectVisitor* visitor) const; |
| 312 void VisitObjectsImagePages(ObjectVisitor* visitor) const; | 312 void VisitObjectsImagePages(ObjectVisitor* visitor) const; |
| 313 | 313 |
| 314 // Like Verify, but does not wait for concurrent sweeper, so caller must | 314 // Like Verify, but does not wait for concurrent sweeper, so caller must |
| 315 // ensure thread-safety. | 315 // ensure thread-safety. |
| 316 bool VerifyGC(MarkExpectation mark_expectation = kForbidMarked) const; | 316 bool VerifyGC(MarkExpectation mark_expectation = kForbidMarked) const; |
| 317 | 317 |
| 318 | |
| 319 // Helper functions for garbage collection. | 318 // Helper functions for garbage collection. |
| 320 void CollectNewSpaceGarbage(Thread* thread, | 319 void CollectNewSpaceGarbage(Thread* thread, |
| 321 ApiCallbacks api_callbacks, | 320 ApiCallbacks api_callbacks, |
| 322 GCReason reason); | 321 GCReason reason); |
| 323 void CollectOldSpaceGarbage(Thread* thread, | 322 void CollectOldSpaceGarbage(Thread* thread, |
| 324 ApiCallbacks api_callbacks, | 323 ApiCallbacks api_callbacks, |
| 325 GCReason reason); | 324 GCReason reason); |
| 326 void EvacuateNewSpace(Thread* thread, GCReason reason); | 325 void EvacuateNewSpace(Thread* thread, GCReason reason); |
| 327 | 326 |
| 328 // GC stats collection. | 327 // GC stats collection. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 friend class ObjectGraph; // VisitObjects | 367 friend class ObjectGraph; // VisitObjects |
| 369 friend class Unmarker; // VisitObjects | 368 friend class Unmarker; // VisitObjects |
| 370 friend class ServiceEvent; | 369 friend class ServiceEvent; |
| 371 friend class PageSpace; // VerifyGC | 370 friend class PageSpace; // VerifyGC |
| 372 friend class IsolateReloadContext; // VisitObjects | 371 friend class IsolateReloadContext; // VisitObjects |
| 373 friend class ClassFinalizer; // VisitObjects | 372 friend class ClassFinalizer; // VisitObjects |
| 374 | 373 |
| 375 DISALLOW_COPY_AND_ASSIGN(Heap); | 374 DISALLOW_COPY_AND_ASSIGN(Heap); |
| 376 }; | 375 }; |
| 377 | 376 |
| 378 | |
| 379 class HeapIterationScope : public StackResource { | 377 class HeapIterationScope : public StackResource { |
| 380 public: | 378 public: |
| 381 explicit HeapIterationScope(bool writable = false); | 379 explicit HeapIterationScope(bool writable = false); |
| 382 ~HeapIterationScope(); | 380 ~HeapIterationScope(); |
| 383 | 381 |
| 384 private: | 382 private: |
| 385 NoSafepointScope no_safepoint_scope_; | 383 NoSafepointScope no_safepoint_scope_; |
| 386 PageSpace* old_space_; | 384 PageSpace* old_space_; |
| 387 bool writable_; | 385 bool writable_; |
| 388 | 386 |
| 389 DISALLOW_COPY_AND_ASSIGN(HeapIterationScope); | 387 DISALLOW_COPY_AND_ASSIGN(HeapIterationScope); |
| 390 }; | 388 }; |
| 391 | 389 |
| 392 | |
| 393 class NoHeapGrowthControlScope : public StackResource { | 390 class NoHeapGrowthControlScope : public StackResource { |
| 394 public: | 391 public: |
| 395 NoHeapGrowthControlScope(); | 392 NoHeapGrowthControlScope(); |
| 396 ~NoHeapGrowthControlScope(); | 393 ~NoHeapGrowthControlScope(); |
| 397 | 394 |
| 398 private: | 395 private: |
| 399 bool current_growth_controller_state_; | 396 bool current_growth_controller_state_; |
| 400 DISALLOW_COPY_AND_ASSIGN(NoHeapGrowthControlScope); | 397 DISALLOW_COPY_AND_ASSIGN(NoHeapGrowthControlScope); |
| 401 }; | 398 }; |
| 402 | 399 |
| 403 | |
| 404 // Note: During this scope, the code pages are non-executable. | 400 // Note: During this scope, the code pages are non-executable. |
| 405 class WritableVMIsolateScope : StackResource { | 401 class WritableVMIsolateScope : StackResource { |
| 406 public: | 402 public: |
| 407 explicit WritableVMIsolateScope(Thread* thread); | 403 explicit WritableVMIsolateScope(Thread* thread); |
| 408 ~WritableVMIsolateScope(); | 404 ~WritableVMIsolateScope(); |
| 409 }; | 405 }; |
| 410 | 406 |
| 411 } // namespace dart | 407 } // namespace dart |
| 412 | 408 |
| 413 #endif // RUNTIME_VM_HEAP_H_ | 409 #endif // RUNTIME_VM_HEAP_H_ |
| OLD | NEW |