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_SCAVENGER_H_ | 5 #ifndef VM_SCAVENGER_H_ |
6 #define VM_SCAVENGER_H_ | 6 #define VM_SCAVENGER_H_ |
7 | 7 |
8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "platform/utils.h" | 9 #include "platform/utils.h" |
10 #include "vm/dart.h" | 10 #include "vm/dart.h" |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 Scavenge(); | 157 Scavenge(); |
158 ASSERT(UsedInWords() == 0); | 158 ASSERT(UsedInWords() == 0); |
159 } | 159 } |
160 | 160 |
161 // Accessors to generate code for inlined allocation. | 161 // Accessors to generate code for inlined allocation. |
162 uword* TopAddress() { return &top_; } | 162 uword* TopAddress() { return &top_; } |
163 uword* EndAddress() { return &end_; } | 163 uword* EndAddress() { return &end_; } |
164 static intptr_t top_offset() { return OFFSET_OF(Scavenger, top_); } | 164 static intptr_t top_offset() { return OFFSET_OF(Scavenger, top_); } |
165 static intptr_t end_offset() { return OFFSET_OF(Scavenger, end_); } | 165 static intptr_t end_offset() { return OFFSET_OF(Scavenger, end_); } |
166 | 166 |
167 intptr_t UsedInWords() const { | 167 int64_t UsedInWords() const { |
168 return (top_ - FirstObjectStart()) >> kWordSizeLog2; | 168 return (top_ - FirstObjectStart()) >> kWordSizeLog2; |
169 } | 169 } |
170 intptr_t CapacityInWords() const { | 170 int64_t CapacityInWords() const { |
171 return to_->size_in_words(); | 171 return to_->size_in_words(); |
172 } | 172 } |
173 intptr_t ExternalInWords() const { | 173 int64_t ExternalInWords() const { |
174 return external_size_ >> kWordSizeLog2; | 174 return external_size_ >> kWordSizeLog2; |
175 } | 175 } |
176 SpaceUsage GetCurrentUsage() const { | 176 SpaceUsage GetCurrentUsage() const { |
177 SpaceUsage usage; | 177 SpaceUsage usage; |
178 usage.used_in_words = UsedInWords(); | 178 usage.used_in_words = UsedInWords(); |
179 usage.capacity_in_words = CapacityInWords(); | 179 usage.capacity_in_words = CapacityInWords(); |
180 usage.external_in_words = ExternalInWords(); | 180 usage.external_in_words = ExternalInWords(); |
181 return usage; | 181 return usage; |
182 } | 182 } |
183 | 183 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 end_ += sizeof(result); | 262 end_ += sizeof(result); |
263 ASSERT(end_ <= to_->end()); | 263 ASSERT(end_ <= to_->end()); |
264 return result; | 264 return result; |
265 } | 265 } |
266 bool PromotedStackHasMore() const { | 266 bool PromotedStackHasMore() const { |
267 ASSERT(scavenging_); | 267 ASSERT(scavenging_); |
268 return end_ < to_->end(); | 268 return end_ < to_->end(); |
269 } | 269 } |
270 | 270 |
271 void UpdateMaxHeapCapacity(); | 271 void UpdateMaxHeapCapacity(); |
| 272 void UpdateMaxHeapUsage(); |
272 | 273 |
273 void ProcessWeakTables(); | 274 void ProcessWeakTables(); |
274 | 275 |
275 intptr_t NewSizeInWords(intptr_t old_size_in_words) const; | 276 intptr_t NewSizeInWords(intptr_t old_size_in_words) const; |
276 | 277 |
277 // Current allocation top and end. These values are being accessed directly | 278 // Current allocation top and end. These values are being accessed directly |
278 // from generated code. | 279 // from generated code. |
279 uword top_; | 280 uword top_; |
280 uword end_; | 281 uword end_; |
281 | 282 |
(...skipping 26 matching lines...) Expand all Loading... |
308 | 309 |
309 friend class ScavengerVisitor; | 310 friend class ScavengerVisitor; |
310 friend class ScavengerWeakVisitor; | 311 friend class ScavengerWeakVisitor; |
311 | 312 |
312 DISALLOW_COPY_AND_ASSIGN(Scavenger); | 313 DISALLOW_COPY_AND_ASSIGN(Scavenger); |
313 }; | 314 }; |
314 | 315 |
315 } // namespace dart | 316 } // namespace dart |
316 | 317 |
317 #endif // VM_SCAVENGER_H_ | 318 #endif // VM_SCAVENGER_H_ |
OLD | NEW |