Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(459)

Side by Side Diff: vm/pages.h

Issue 10057001: - Use the unused top of old-space pages when allocating. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | vm/pages.cc » ('j') | vm/pages.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/virtual_memory.h" 10 #include "vm/virtual_memory.h"
(...skipping 24 matching lines...) Expand all
35 uword first_object_start() const { 35 uword first_object_start() const {
36 return (reinterpret_cast<uword>(this) + sizeof(HeapPage)); 36 return (reinterpret_cast<uword>(this) + sizeof(HeapPage));
37 } 37 }
38 38
39 void set_used(uword used) { used_ = used; } 39 void set_used(uword used) { used_ = used; }
40 uword used() const { return used_; } 40 uword used() const { return used_; }
41 void AddUsed(uword size) { 41 void AddUsed(uword size) {
42 used_ += size; 42 used_ += size;
43 } 43 }
44 44
45 uword TryBumpAllocate(intptr_t size) {
46 uword result = top();
47 intptr_t remaining_space = end() - result;
48 if (remaining_space < size) {
49 return 0;
50 }
51 set_top(result + size);
52 return result;
53 }
54
45 void VisitObjectPointers(ObjectPointerVisitor* visitor) const; 55 void VisitObjectPointers(ObjectPointerVisitor* visitor) const;
46 56
47 RawObject* FindObject(FindObjectVisitor* visitor) const; 57 RawObject* FindObject(FindObjectVisitor* visitor) const;
48 58
49 private: 59 private:
50 static HeapPage* Initialize(VirtualMemory* memory, bool is_executable); 60 static HeapPage* Initialize(VirtualMemory* memory, bool is_executable);
51 static HeapPage* Allocate(intptr_t size, bool is_executable); 61 static HeapPage* Allocate(intptr_t size, bool is_executable);
52 62
53 // Deallocate the virtual memory backing this page. The page pointer to this 63 // Deallocate the virtual memory backing this page. The page pointer to this
54 // page becomes immediately inaccessible. 64 // page becomes immediately inaccessible.
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 uword TryBumpAllocate(intptr_t size); 125 uword TryBumpAllocate(intptr_t size);
116 126
117 FreeList freelist_; 127 FreeList freelist_;
118 128
119 Heap* heap_; 129 Heap* heap_;
120 130
121 HeapPage* pages_; 131 HeapPage* pages_;
122 HeapPage* pages_tail_; 132 HeapPage* pages_tail_;
123 HeapPage* large_pages_; 133 HeapPage* large_pages_;
124 134
135 // Page being used for bump allocation.
136 // The value has different meanings:
137 // NULL: Still bump allocating from last allocated fresh page.
138 // !NULL: Last page that had enough room to bump allocate, when we reach the
139 // tail page, we give up bump allocating.
140 HeapPage* bump_page_;
141
125 // Various sizes being tracked for this generation. 142 // Various sizes being tracked for this generation.
126 intptr_t max_capacity_; 143 intptr_t max_capacity_;
127 intptr_t capacity_; 144 intptr_t capacity_;
128 intptr_t in_use_; 145 intptr_t in_use_;
129 146
130 // Old-gen GC cycle count. 147 // Old-gen GC cycle count.
131 int count_; 148 int count_;
132 149
133 bool is_executable_; 150 bool is_executable_;
134 151
135 // Keep track whether a MarkSweep is currently running. 152 // Keep track whether a MarkSweep is currently running.
136 bool sweeping_; 153 bool sweeping_;
137 154
138 DISALLOW_IMPLICIT_CONSTRUCTORS(PageSpace); 155 DISALLOW_IMPLICIT_CONSTRUCTORS(PageSpace);
139 }; 156 };
140 157
141 } // namespace dart 158 } // namespace dart
142 159
143 #endif // VM_PAGES_H_ 160 #endif // VM_PAGES_H_
OLDNEW
« no previous file with comments | « no previous file | vm/pages.cc » ('j') | vm/pages.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698