| 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 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" |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 void RecordTime(int id, int64_t micros) { | 212 void RecordTime(int id, int64_t micros) { |
| 213 ASSERT((id >= 0) && (id < GCStats::kDataEntries)); | 213 ASSERT((id >= 0) && (id < GCStats::kDataEntries)); |
| 214 stats_.times_[id] = micros; | 214 stats_.times_[id] = micros; |
| 215 } | 215 } |
| 216 | 216 |
| 217 void RecordData(int id, intptr_t value) { | 217 void RecordData(int id, intptr_t value) { |
| 218 ASSERT((id >= 0) && (id < GCStats::kDataEntries)); | 218 ASSERT((id >= 0) && (id < GCStats::kDataEntries)); |
| 219 stats_.data_[id] = value; | 219 stats_.data_[id] = value; |
| 220 } | 220 } |
| 221 | 221 |
| 222 bool gc_in_progress() const { return gc_in_progress_; } | 222 bool gc_in_progress(); |
| 223 | 223 |
| 224 static bool IsAllocatableInNewSpace(intptr_t size) { | 224 static bool IsAllocatableInNewSpace(intptr_t size) { |
| 225 return size <= kNewAllocatableSize; | 225 return size <= kNewAllocatableSize; |
| 226 } | 226 } |
| 227 | 227 |
| 228 void PrintToJSONObject(Space space, JSONObject* object) const; | 228 void PrintToJSONObject(Space space, JSONObject* object) const; |
| 229 | 229 |
| 230 // The heap map contains the sizes and class ids for the objects in each page. | 230 // The heap map contains the sizes and class ids for the objects in each page. |
| 231 void PrintHeapMapToJSONStream(Isolate* isolate, JSONStream* stream) { | 231 void PrintHeapMapToJSONStream(Isolate* isolate, JSONStream* stream) { |
| 232 return old_space_.PrintHeapMapToJSONStream(isolate, stream); | 232 return old_space_.PrintHeapMapToJSONStream(isolate, stream); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 // ensure thread-safety. | 290 // ensure thread-safety. |
| 291 bool VerifyGC(MarkExpectation mark_expectation = kForbidMarked) const; | 291 bool VerifyGC(MarkExpectation mark_expectation = kForbidMarked) const; |
| 292 | 292 |
| 293 // GC stats collection. | 293 // GC stats collection. |
| 294 void RecordBeforeGC(Space space, GCReason reason); | 294 void RecordBeforeGC(Space space, GCReason reason); |
| 295 void RecordAfterGC(); | 295 void RecordAfterGC(); |
| 296 void PrintStats(); | 296 void PrintStats(); |
| 297 void UpdateClassHeapStatsBeforeGC(Heap::Space space); | 297 void UpdateClassHeapStatsBeforeGC(Heap::Space space); |
| 298 void UpdatePretenurePolicy(); | 298 void UpdatePretenurePolicy(); |
| 299 | 299 |
| 300 // Updates gc_in_progress. |
| 301 void BeginGC(); |
| 302 void EndGC(); |
| 303 |
| 300 // If this heap is non-empty, updates start and end to the smallest range that | 304 // If this heap is non-empty, updates start and end to the smallest range that |
| 301 // contains both the original [start, end) and the [lowest, highest) addresses | 305 // contains both the original [start, end) and the [lowest, highest) addresses |
| 302 // of this heap. | 306 // of this heap. |
| 303 void GetMergedAddressRange(uword* start, uword* end) const; | 307 void GetMergedAddressRange(uword* start, uword* end) const; |
| 304 | 308 |
| 305 Isolate* isolate_; | 309 Isolate* isolate_; |
| 306 | 310 |
| 307 // The different spaces used for allocation. | 311 // The different spaces used for allocation. |
| 308 Scavenger new_space_; | 312 Scavenger new_space_; |
| 309 PageSpace old_space_; | 313 PageSpace old_space_; |
| 310 | 314 |
| 311 WeakTable* new_weak_tables_[kNumWeakSelectors]; | 315 WeakTable* new_weak_tables_[kNumWeakSelectors]; |
| 312 WeakTable* old_weak_tables_[kNumWeakSelectors]; | 316 WeakTable* old_weak_tables_[kNumWeakSelectors]; |
| 313 | 317 |
| 314 // GC stats collection. | 318 // GC stats collection. |
| 315 GCStats stats_; | 319 GCStats stats_; |
| 316 | 320 |
| 317 // This heap is in read-only mode: No allocation is allowed. | 321 // This heap is in read-only mode: No allocation is allowed. |
| 318 bool read_only_; | 322 bool read_only_; |
| 319 | 323 |
| 320 // GC on the heap is in progress. | 324 // GC on the heap is in progress. |
| 325 Mutex gc_in_progress_mutex_; |
| 321 bool gc_in_progress_; | 326 bool gc_in_progress_; |
| 322 | 327 |
| 323 int pretenure_policy_; | 328 int pretenure_policy_; |
| 324 | 329 |
| 325 friend class ServiceEvent; | 330 friend class ServiceEvent; |
| 326 friend class PageSpace; // VerifyGC | 331 friend class PageSpace; // VerifyGC |
| 327 DISALLOW_COPY_AND_ASSIGN(Heap); | 332 DISALLOW_COPY_AND_ASSIGN(Heap); |
| 328 }; | 333 }; |
| 329 | 334 |
| 330 | 335 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 NoHeapGrowthControlScope(); | 370 NoHeapGrowthControlScope(); |
| 366 ~NoHeapGrowthControlScope(); | 371 ~NoHeapGrowthControlScope(); |
| 367 private: | 372 private: |
| 368 bool current_growth_controller_state_; | 373 bool current_growth_controller_state_; |
| 369 DISALLOW_COPY_AND_ASSIGN(NoHeapGrowthControlScope); | 374 DISALLOW_COPY_AND_ASSIGN(NoHeapGrowthControlScope); |
| 370 }; | 375 }; |
| 371 | 376 |
| 372 } // namespace dart | 377 } // namespace dart |
| 373 | 378 |
| 374 #endif // VM_HEAP_H_ | 379 #endif // VM_HEAP_H_ |
| OLD | NEW |