| 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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 void RecordTime(int id, int64_t micros) { | 181 void RecordTime(int id, int64_t micros) { |
| 182 ASSERT((id >= 0) && (id < GCStats::kDataEntries)); | 182 ASSERT((id >= 0) && (id < GCStats::kDataEntries)); |
| 183 stats_.times_[id] = micros; | 183 stats_.times_[id] = micros; |
| 184 } | 184 } |
| 185 | 185 |
| 186 void RecordData(int id, intptr_t value) { | 186 void RecordData(int id, intptr_t value) { |
| 187 ASSERT((id >= 0) && (id < GCStats::kDataEntries)); | 187 ASSERT((id >= 0) && (id < GCStats::kDataEntries)); |
| 188 stats_.data_[id] = value; | 188 stats_.data_[id] = value; |
| 189 } | 189 } |
| 190 | 190 |
| 191 bool gc_in_progress() const { return gc_in_progress_; } |
| 192 |
| 191 private: | 193 private: |
| 192 class GCStats : public ValueObject { | 194 class GCStats : public ValueObject { |
| 193 public: | 195 public: |
| 194 GCStats() {} | 196 GCStats() {} |
| 195 intptr_t num_; | 197 intptr_t num_; |
| 196 Heap::Space space_; | 198 Heap::Space space_; |
| 197 Heap::GCReason reason_; | 199 Heap::GCReason reason_; |
| 198 | 200 |
| 199 class Data : public ValueObject { | 201 class Data : public ValueObject { |
| 200 public: | 202 public: |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 | 238 |
| 237 // GC stats collection. | 239 // GC stats collection. |
| 238 GCStats stats_; | 240 GCStats stats_; |
| 239 | 241 |
| 240 // The active heap trace. | 242 // The active heap trace. |
| 241 HeapTrace* heap_trace_; | 243 HeapTrace* heap_trace_; |
| 242 | 244 |
| 243 // This heap is in read-only mode: No allocation is allowed. | 245 // This heap is in read-only mode: No allocation is allowed. |
| 244 bool read_only_; | 246 bool read_only_; |
| 245 | 247 |
| 248 // GC on the heap is in progress. |
| 249 bool gc_in_progress_; |
| 250 |
| 246 friend class GCTestHelper; | 251 friend class GCTestHelper; |
| 247 DISALLOW_COPY_AND_ASSIGN(Heap); | 252 DISALLOW_COPY_AND_ASSIGN(Heap); |
| 248 }; | 253 }; |
| 249 | 254 |
| 250 | 255 |
| 251 #if defined(DEBUG) | 256 #if defined(DEBUG) |
| 252 class NoGCScope : public StackResource { | 257 class NoGCScope : public StackResource { |
| 253 public: | 258 public: |
| 254 NoGCScope(); | 259 NoGCScope(); |
| 255 ~NoGCScope(); | 260 ~NoGCScope(); |
| 256 private: | 261 private: |
| 257 DISALLOW_COPY_AND_ASSIGN(NoGCScope); | 262 DISALLOW_COPY_AND_ASSIGN(NoGCScope); |
| 258 }; | 263 }; |
| 259 #else // defined(DEBUG) | 264 #else // defined(DEBUG) |
| 260 class NoGCScope : public ValueObject { | 265 class NoGCScope : public ValueObject { |
| 261 public: | 266 public: |
| 262 NoGCScope() {} | 267 NoGCScope() {} |
| 263 private: | 268 private: |
| 264 DISALLOW_COPY_AND_ASSIGN(NoGCScope); | 269 DISALLOW_COPY_AND_ASSIGN(NoGCScope); |
| 265 }; | 270 }; |
| 266 #endif // defined(DEBUG) | 271 #endif // defined(DEBUG) |
| 267 | 272 |
| 268 } // namespace dart | 273 } // namespace dart |
| 269 | 274 |
| 270 #endif // VM_HEAP_H_ | 275 #endif // VM_HEAP_H_ |
| OLD | NEW |