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

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

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 #include "vm/heap.h" 5 #include "vm/heap.h"
6 6
7 #include "platform/assert.h" 7 #include "platform/assert.h"
8 #include "platform/utils.h" 8 #include "platform/utils.h"
9 #include "vm/flags.h" 9 #include "vm/flags.h"
10 #include "vm/isolate.h" 10 #include "vm/isolate.h"
11 #include "vm/lockers.h" 11 #include "vm/lockers.h"
12 #include "vm/object.h" 12 #include "vm/object.h"
13 #include "vm/object_set.h" 13 #include "vm/object_set.h"
14 #include "vm/os.h" 14 #include "vm/os.h"
15 #include "vm/pages.h" 15 #include "vm/pages.h"
16 #include "vm/raw_object.h" 16 #include "vm/raw_object.h"
17 #include "vm/scavenger.h" 17 #include "vm/scavenger.h"
18 #include "vm/service.h" 18 #include "vm/service.h"
19 #include "vm/service_event.h" 19 #include "vm/service_event.h"
20 #include "vm/stack_frame.h" 20 #include "vm/stack_frame.h"
21 #include "vm/tags.h" 21 #include "vm/tags.h"
22 #include "vm/timeline.h" 22 #include "vm/timeline.h"
23 #include "vm/verifier.h" 23 #include "vm/verifier.h"
24 #include "vm/virtual_memory.h" 24 #include "vm/virtual_memory.h"
25 #include "vm/weak_table.h" 25 #include "vm/weak_table.h"
26 #include "vm/dart_api_state.h"
siva 2016/06/02 20:18:05 Why is 'dart_api_state.h' included here?
rmacnak 2016/06/03 01:08:31 I started with BackgroundFinalizer in this file. R
26 27
27 namespace dart { 28 namespace dart {
28 29
29 Heap::Heap(Isolate* isolate, 30 Heap::Heap(Isolate* isolate,
30 intptr_t max_new_gen_semi_words, 31 intptr_t max_new_gen_semi_words,
31 intptr_t max_old_gen_words, 32 intptr_t max_old_gen_words,
32 intptr_t max_external_words) 33 intptr_t max_external_words)
33 : isolate_(isolate), 34 : isolate_(isolate),
34 new_space_(this, max_new_gen_semi_words, kNewObjectAlignmentOffset), 35 new_space_(this, max_new_gen_semi_words, kNewObjectAlignmentOffset),
35 old_space_(this, max_old_gen_words, max_external_words), 36 old_space_(this, max_old_gen_words, max_external_words),
36 barrier_(new Monitor()), 37 barrier_(new Monitor()),
37 barrier_done_(new Monitor()), 38 barrier_done_(new Monitor()),
39 finalization_tasks_lock_(new Monitor()),
40 finalization_tasks_(0),
38 read_only_(false), 41 read_only_(false),
39 gc_new_space_in_progress_(false), 42 gc_new_space_in_progress_(false),
40 gc_old_space_in_progress_(false), 43 gc_old_space_in_progress_(false),
41 pretenure_policy_(0) { 44 pretenure_policy_(0) {
42 for (int sel = 0; 45 for (int sel = 0;
43 sel < kNumWeakSelectors; 46 sel < kNumWeakSelectors;
44 sel++) { 47 sel++) {
45 new_weak_tables_[sel] = new WeakTable(); 48 new_weak_tables_[sel] = new WeakTable();
46 old_weak_tables_[sel] = new WeakTable(); 49 old_weak_tables_[sel] = new WeakTable();
47 } 50 }
(...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after
915 Dart::vm_isolate()->heap()->WriteProtect(false); 918 Dart::vm_isolate()->heap()->WriteProtect(false);
916 } 919 }
917 920
918 921
919 WritableVMIsolateScope::~WritableVMIsolateScope() { 922 WritableVMIsolateScope::~WritableVMIsolateScope() {
920 ASSERT(Dart::vm_isolate()->heap()->UsedInWords(Heap::kNew) == 0); 923 ASSERT(Dart::vm_isolate()->heap()->UsedInWords(Heap::kNew) == 0);
921 Dart::vm_isolate()->heap()->WriteProtect(true); 924 Dart::vm_isolate()->heap()->WriteProtect(true);
922 } 925 }
923 926
924 } // namespace dart 927 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698