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

Side by Side Diff: runtime/vm/heap.h

Issue 14190014: - Disassociate old page size from new allocatable size. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 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 | « runtime/vm/gc_sweeper.cc ('k') | runtime/vm/pages.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 static const intptr_t kHeapSizeInMB = 512; 51 static const intptr_t kHeapSizeInMB = 512;
52 static const intptr_t kCodeHeapSizeInMB = 18; 52 static const intptr_t kCodeHeapSizeInMB = 18;
53 53
54 ~Heap(); 54 ~Heap();
55 55
56 uword Allocate(intptr_t size, Space space) { 56 uword Allocate(intptr_t size, Space space) {
57 ASSERT(!read_only_); 57 ASSERT(!read_only_);
58 switch (space) { 58 switch (space) {
59 case kNew: 59 case kNew:
60 // Do not attempt to allocate very large objects in new space. 60 // Do not attempt to allocate very large objects in new space.
61 if (!PageSpace::IsPageAllocatableSize(size)) { 61 if (!IsNewAllocatableSize(size)) {
62 return AllocateOld(size, HeapPage::kData); 62 return AllocateOld(size, HeapPage::kData);
63 } 63 }
64 return AllocateNew(size); 64 return AllocateNew(size);
65 case kOld: 65 case kOld:
66 return AllocateOld(size, HeapPage::kData); 66 return AllocateOld(size, HeapPage::kData);
67 case kCode: 67 case kCode:
68 return AllocateOld(size, HeapPage::kExecutable); 68 return AllocateOld(size, HeapPage::kExecutable);
69 default: 69 default:
70 UNREACHABLE(); 70 UNREACHABLE();
71 } 71 }
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 stats_.times_[id] = micros; 185 stats_.times_[id] = micros;
186 } 186 }
187 187
188 void RecordData(int id, intptr_t value) { 188 void RecordData(int id, intptr_t value) {
189 ASSERT((id >= 0) && (id < GCStats::kDataEntries)); 189 ASSERT((id >= 0) && (id < GCStats::kDataEntries));
190 stats_.data_[id] = value; 190 stats_.data_[id] = value;
191 } 191 }
192 192
193 bool gc_in_progress() const { return gc_in_progress_; } 193 bool gc_in_progress() const { return gc_in_progress_; }
194 194
195 static bool IsNewAllocatableSize(intptr_t size) {
Vyacheslav Egorov (Google) 2013/04/25 22:11:28 the name is a bit confusing. maybe IsAllocatableIn
Ivan Posva 2013/04/26 06:14:00 I was not happy with the name either. I settled on
196 return size <= kNewAllocatableSize;
197 }
198
195 private: 199 private:
196 class GCStats : public ValueObject { 200 class GCStats : public ValueObject {
197 public: 201 public:
198 GCStats() {} 202 GCStats() {}
199 intptr_t num_; 203 intptr_t num_;
200 Heap::Space space_; 204 Heap::Space space_;
201 Heap::GCReason reason_; 205 Heap::GCReason reason_;
202 206
203 class Data : public ValueObject { 207 class Data : public ValueObject {
204 public: 208 public:
(...skipping 12 matching lines...) Expand all
217 }; 221 };
218 222
219 Data before_; 223 Data before_;
220 Data after_; 224 Data after_;
221 int64_t times_[kDataEntries]; 225 int64_t times_[kDataEntries];
222 intptr_t data_[kDataEntries]; 226 intptr_t data_[kDataEntries];
223 227
224 DISALLOW_COPY_AND_ASSIGN(GCStats); 228 DISALLOW_COPY_AND_ASSIGN(GCStats);
225 }; 229 };
226 230
231 static const intptr_t kNewAllocatableSize = 256 * KB;
232
227 Heap(); 233 Heap();
228 234
229 uword AllocateNew(intptr_t size); 235 uword AllocateNew(intptr_t size);
230 uword AllocateOld(intptr_t size, HeapPage::PageType type); 236 uword AllocateOld(intptr_t size, HeapPage::PageType type);
231 237
232 // GC stats collection. 238 // GC stats collection.
233 void RecordBeforeGC(Space space, GCReason reason); 239 void RecordBeforeGC(Space space, GCReason reason);
234 void RecordAfterGC(); 240 void RecordAfterGC();
235 void PrintStats(); 241 void PrintStats();
236 242
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 NoHeapGrowthControlScope(); 281 NoHeapGrowthControlScope();
276 ~NoHeapGrowthControlScope(); 282 ~NoHeapGrowthControlScope();
277 private: 283 private:
278 bool current_growth_controller_state_; 284 bool current_growth_controller_state_;
279 DISALLOW_COPY_AND_ASSIGN(NoHeapGrowthControlScope); 285 DISALLOW_COPY_AND_ASSIGN(NoHeapGrowthControlScope);
280 }; 286 };
281 287
282 } // namespace dart 288 } // namespace dart
283 289
284 #endif // VM_HEAP_H_ 290 #endif // VM_HEAP_H_
OLDNEW
« no previous file with comments | « runtime/vm/gc_sweeper.cc ('k') | runtime/vm/pages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698