Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(430)

Side by Side Diff: runtime/vm/heap.h

Issue 2012973002: Background finalization. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 VM_HEAP_H_ 5 #ifndef VM_HEAP_H_
6 #define VM_HEAP_H_ 6 #define 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"
11 #include "vm/globals.h" 11 #include "vm/globals.h"
12 #include "vm/pages.h" 12 #include "vm/pages.h"
13 #include "vm/scavenger.h" 13 #include "vm/scavenger.h"
14 #include "vm/spaces.h" 14 #include "vm/spaces.h"
15 #include "vm/verifier.h" 15 #include "vm/verifier.h"
16 #include "vm/weak_table.h" 16 #include "vm/weak_table.h"
17 #include "vm/thread_pool.h"
siva 2016/06/02 20:18:05 Why is thread_pool.h included here?
rmacnak 2016/06/03 01:08:31 Leftover, removed.
17 18
18 namespace dart { 19 namespace dart {
19 20
20 // Forward declarations. 21 // Forward declarations.
21 class Isolate; 22 class Isolate;
22 class ObjectPointerVisitor; 23 class ObjectPointerVisitor;
23 class ObjectSet; 24 class ObjectSet;
24 class ServiceEvent; 25 class ServiceEvent;
25 class TimelineEventScope; 26 class TimelineEventScope;
26 class VirtualMemory; 27 class VirtualMemory;
28 class FinalizablePersistentHandle;
siva 2016/06/02 20:18:05 Is this forward declaration necessary
29
27 30
28 class Heap { 31 class Heap {
29 public: 32 public:
30 enum Space { 33 enum Space {
31 kNew, 34 kNew,
32 kOld, 35 kOld,
33 kCode, 36 kCode,
34 // TODO(koda): Harmonize all old-space allocation and get rid of this. 37 // TODO(koda): Harmonize all old-space allocation and get rid of this.
35 kPretenured, 38 kPretenured,
36 }; 39 };
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 // The heap map contains the sizes and class ids for the objects in each page. 252 // The heap map contains the sizes and class ids for the objects in each page.
250 void PrintHeapMapToJSONStream(Isolate* isolate, JSONStream* stream) { 253 void PrintHeapMapToJSONStream(Isolate* isolate, JSONStream* stream) {
251 return old_space_.PrintHeapMapToJSONStream(isolate, stream); 254 return old_space_.PrintHeapMapToJSONStream(isolate, stream);
252 } 255 }
253 256
254 Isolate* isolate() const { return isolate_; } 257 Isolate* isolate() const { return isolate_; }
255 258
256 Monitor* barrier() const { return barrier_; } 259 Monitor* barrier() const { return barrier_; }
257 Monitor* barrier_done() const { return barrier_done_; } 260 Monitor* barrier_done() const { return barrier_done_; }
258 261
262 Monitor* finalization_tasks_lock() const { return finalization_tasks_lock_; }
263 intptr_t finalization_tasks() const { return finalization_tasks_; }
264 void set_finalization_tasks(intptr_t count) { finalization_tasks_ = count; }
265
259 bool ShouldPretenure(intptr_t class_id) const; 266 bool ShouldPretenure(intptr_t class_id) const;
260 267
261 void SetupExternalPage(void* pointer, uword size, bool is_executable) { 268 void SetupExternalPage(void* pointer, uword size, bool is_executable) {
262 old_space_.SetupExternalPage(pointer, size, is_executable); 269 old_space_.SetupExternalPage(pointer, size, is_executable);
263 } 270 }
264 271
265 private: 272 private:
266 class GCStats : public ValueObject { 273 class GCStats : public ValueObject {
267 public: 274 public:
268 GCStats() {} 275 GCStats() {}
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 // The different spaces used for allocation. 353 // The different spaces used for allocation.
347 ALIGN8 Scavenger new_space_; 354 ALIGN8 Scavenger new_space_;
348 PageSpace old_space_; 355 PageSpace old_space_;
349 356
350 WeakTable* new_weak_tables_[kNumWeakSelectors]; 357 WeakTable* new_weak_tables_[kNumWeakSelectors];
351 WeakTable* old_weak_tables_[kNumWeakSelectors]; 358 WeakTable* old_weak_tables_[kNumWeakSelectors];
352 359
353 Monitor* barrier_; 360 Monitor* barrier_;
354 Monitor* barrier_done_; 361 Monitor* barrier_done_;
355 362
363 Monitor* finalization_tasks_lock_;
364 intptr_t finalization_tasks_;
365
356 // GC stats collection. 366 // GC stats collection.
357 GCStats stats_; 367 GCStats stats_;
358 368
359 // This heap is in read-only mode: No allocation is allowed. 369 // This heap is in read-only mode: No allocation is allowed.
360 bool read_only_; 370 bool read_only_;
361 371
362 // GC on the heap is in progress. 372 // GC on the heap is in progress.
363 Monitor gc_in_progress_monitor_; 373 Monitor gc_in_progress_monitor_;
364 bool gc_new_space_in_progress_; 374 bool gc_new_space_in_progress_;
365 bool gc_old_space_in_progress_; 375 bool gc_old_space_in_progress_;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 // Note: During this scope, the code pages are non-executable. 410 // Note: During this scope, the code pages are non-executable.
401 class WritableVMIsolateScope : StackResource { 411 class WritableVMIsolateScope : StackResource {
402 public: 412 public:
403 explicit WritableVMIsolateScope(Thread* thread); 413 explicit WritableVMIsolateScope(Thread* thread);
404 ~WritableVMIsolateScope(); 414 ~WritableVMIsolateScope();
405 }; 415 };
406 416
407 } // namespace dart 417 } // namespace dart
408 418
409 #endif // VM_HEAP_H_ 419 #endif // VM_HEAP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698