| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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_PAGES_H_ | 5 #ifndef VM_PAGES_H_ |
| 6 #define VM_PAGES_H_ | 6 #define VM_PAGES_H_ |
| 7 | 7 |
| 8 #include "vm/freelist.h" | 8 #include "vm/freelist.h" |
| 9 #include "vm/globals.h" | 9 #include "vm/globals.h" |
| 10 #include "vm/lockers.h" | 10 #include "vm/lockers.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 return memory_->start() + ObjectStartOffset(); | 45 return memory_->start() + ObjectStartOffset(); |
| 46 } | 46 } |
| 47 uword object_end() const { | 47 uword object_end() const { |
| 48 return object_end_; | 48 return object_end_; |
| 49 } | 49 } |
| 50 | 50 |
| 51 PageType type() const { | 51 PageType type() const { |
| 52 return type_; | 52 return type_; |
| 53 } | 53 } |
| 54 | 54 |
| 55 bool embedder_allocated() const { return memory_->embedder_allocated(); } |
| 56 |
| 55 void VisitObjects(ObjectVisitor* visitor) const; | 57 void VisitObjects(ObjectVisitor* visitor) const; |
| 56 void VisitObjectPointers(ObjectPointerVisitor* visitor) const; | 58 void VisitObjectPointers(ObjectPointerVisitor* visitor) const; |
| 57 | 59 |
| 58 RawObject* FindObject(FindObjectVisitor* visitor) const; | 60 RawObject* FindObject(FindObjectVisitor* visitor) const; |
| 59 | 61 |
| 60 void WriteProtect(bool read_only); | 62 void WriteProtect(bool read_only); |
| 61 | 63 |
| 62 static intptr_t ObjectStartOffset() { | 64 static intptr_t ObjectStartOffset() { |
| 63 return Utils::RoundUp(sizeof(HeapPage), OS::kMaxPreferredCodeAlignment); | 65 return Utils::RoundUp(sizeof(HeapPage), OS::kMaxPreferredCodeAlignment); |
| 64 } | 66 } |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 return usage_; | 249 return usage_; |
| 248 } | 250 } |
| 249 | 251 |
| 250 bool Contains(uword addr) const; | 252 bool Contains(uword addr) const; |
| 251 bool Contains(uword addr, HeapPage::PageType type) const; | 253 bool Contains(uword addr, HeapPage::PageType type) const; |
| 252 bool IsValidAddress(uword addr) const { | 254 bool IsValidAddress(uword addr) const { |
| 253 return Contains(addr); | 255 return Contains(addr); |
| 254 } | 256 } |
| 255 | 257 |
| 256 void VisitObjects(ObjectVisitor* visitor) const; | 258 void VisitObjects(ObjectVisitor* visitor) const; |
| 259 void VisitObjectsNoEmbedderPages(ObjectVisitor* visitor) const; |
| 257 void VisitObjectPointers(ObjectPointerVisitor* visitor) const; | 260 void VisitObjectPointers(ObjectPointerVisitor* visitor) const; |
| 258 | 261 |
| 259 RawObject* FindObject(FindObjectVisitor* visitor, | 262 RawObject* FindObject(FindObjectVisitor* visitor, |
| 260 HeapPage::PageType type) const; | 263 HeapPage::PageType type) const; |
| 261 | 264 |
| 262 // Checks if enough time has elapsed since the last attempt to collect | 265 // Checks if enough time has elapsed since the last attempt to collect |
| 263 // code. | 266 // code. |
| 264 bool ShouldCollectCode(); | 267 bool ShouldCollectCode(); |
| 265 | 268 |
| 266 // Collect the garbage in the page space using mark-sweep. | 269 // Collect the garbage in the page space using mark-sweep. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 285 return page_space_controller_.is_enabled(); | 288 return page_space_controller_.is_enabled(); |
| 286 } | 289 } |
| 287 | 290 |
| 288 bool NeedsExternalGC() const { | 291 bool NeedsExternalGC() const { |
| 289 return (max_external_in_words_ != 0) && | 292 return (max_external_in_words_ != 0) && |
| 290 (ExternalInWords() > max_external_in_words_); | 293 (ExternalInWords() > max_external_in_words_); |
| 291 } | 294 } |
| 292 | 295 |
| 293 // Note: Code pages are made executable/non-executable when 'read_only' is | 296 // Note: Code pages are made executable/non-executable when 'read_only' is |
| 294 // true/false, respectively. | 297 // true/false, respectively. |
| 295 void WriteProtect(bool read_only, bool include_code_pages); | 298 void WriteProtect(bool read_only); |
| 296 void WriteProtectCode(bool read_only); | 299 void WriteProtectCode(bool read_only); |
| 297 | 300 |
| 298 void AddGCTime(int64_t micros) { | 301 void AddGCTime(int64_t micros) { |
| 299 gc_time_micros_ += micros; | 302 gc_time_micros_ += micros; |
| 300 } | 303 } |
| 301 | 304 |
| 302 int64_t gc_time_micros() const { | 305 int64_t gc_time_micros() const { |
| 303 return gc_time_micros_; | 306 return gc_time_micros_; |
| 304 } | 307 } |
| 305 | 308 |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 friend class HeapIterationScope; | 459 friend class HeapIterationScope; |
| 457 friend class PageSpaceController; | 460 friend class PageSpaceController; |
| 458 friend class SweeperTask; | 461 friend class SweeperTask; |
| 459 | 462 |
| 460 DISALLOW_IMPLICIT_CONSTRUCTORS(PageSpace); | 463 DISALLOW_IMPLICIT_CONSTRUCTORS(PageSpace); |
| 461 }; | 464 }; |
| 462 | 465 |
| 463 } // namespace dart | 466 } // namespace dart |
| 464 | 467 |
| 465 #endif // VM_PAGES_H_ | 468 #endif // VM_PAGES_H_ |
| OLD | NEW |