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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 static intptr_t ObjectStartOffset() { | 62 static intptr_t ObjectStartOffset() { |
63 return Utils::RoundUp(sizeof(HeapPage), OS::kMaxPreferredCodeAlignment); | 63 return Utils::RoundUp(sizeof(HeapPage), OS::kMaxPreferredCodeAlignment); |
64 } | 64 } |
65 | 65 |
66 private: | 66 private: |
67 void set_object_end(uword val) { | 67 void set_object_end(uword val) { |
68 ASSERT((val & kObjectAlignmentMask) == kOldObjectAlignmentOffset); | 68 ASSERT((val & kObjectAlignmentMask) == kOldObjectAlignmentOffset); |
69 object_end_ = val; | 69 object_end_ = val; |
70 } | 70 } |
71 | 71 |
| 72 // These return NULL on OOM. |
72 static HeapPage* Initialize(VirtualMemory* memory, PageType type); | 73 static HeapPage* Initialize(VirtualMemory* memory, PageType type); |
73 static HeapPage* Allocate(intptr_t size_in_words, PageType type); | 74 static HeapPage* Allocate(intptr_t size_in_words, PageType type); |
74 | 75 |
75 // Deallocate the virtual memory backing this page. The page pointer to this | 76 // Deallocate the virtual memory backing this page. The page pointer to this |
76 // page becomes immediately inaccessible. | 77 // page becomes immediately inaccessible. |
77 void Deallocate(); | 78 void Deallocate(); |
78 | 79 |
79 VirtualMemory* memory_; | 80 VirtualMemory* memory_; |
80 HeapPage* next_; | 81 HeapPage* next_; |
81 uword object_end_; | 82 uword object_end_; |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 friend class ExclusiveLargePageIterator; | 435 friend class ExclusiveLargePageIterator; |
435 friend class PageSpaceController; | 436 friend class PageSpaceController; |
436 friend class SweeperTask; | 437 friend class SweeperTask; |
437 | 438 |
438 DISALLOW_IMPLICIT_CONSTRUCTORS(PageSpace); | 439 DISALLOW_IMPLICIT_CONSTRUCTORS(PageSpace); |
439 }; | 440 }; |
440 | 441 |
441 } // namespace dart | 442 } // namespace dart |
442 | 443 |
443 #endif // VM_PAGES_H_ | 444 #endif // VM_PAGES_H_ |
OLD | NEW |