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

Side by Side Diff: vm/heap.h

Issue 8423023: Add command line options to specify the various heap size parameters. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: '' Created 9 years, 1 month 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/heap.cc » ('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) 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_HEAP_H_ 5 #ifndef VM_HEAP_H_
6 #define VM_HEAP_H_ 6 #define VM_HEAP_H_
7 7
8 #include "vm/allocation.h" 8 #include "vm/allocation.h"
9 #include "vm/flags.h" 9 #include "vm/flags.h"
10 #include "vm/globals.h" 10 #include "vm/globals.h"
(...skipping 11 matching lines...) Expand all
22 DECLARE_FLAG(bool, gc_at_alloc); 22 DECLARE_FLAG(bool, gc_at_alloc);
23 23
24 class Heap { 24 class Heap {
25 public: 25 public:
26 enum Space { 26 enum Space {
27 kNew, 27 kNew,
28 kOld, 28 kOld,
29 kExecutable 29 kExecutable
30 }; 30 };
31 31
32 // Default allocation sizes in MB for the old gen and code heaps.
33 static const intptr_t kHeapSizeInMB = 512;
34 static const intptr_t kCodeHeapSizeInMB = 4;
35
32 ~Heap(); 36 ~Heap();
33 37
34 uword Allocate(intptr_t size, Space space) { 38 uword Allocate(intptr_t size, Space space) {
35 switch (space) { 39 switch (space) {
36 case kNew: 40 case kNew:
37 return AllocateNew(size); 41 return AllocateNew(size);
38 case kOld: 42 case kOld:
39 return AllocateOld(size); 43 return AllocateOld(size);
40 case kExecutable: 44 case kExecutable:
41 return AllocateCode(size); 45 return AllocateCode(size);
(...skipping 20 matching lines...) Expand all
62 uword EndAddress(); 66 uword EndAddress();
63 static intptr_t new_space_offset() { return OFFSET_OF(Heap, new_space_); } 67 static intptr_t new_space_offset() { return OFFSET_OF(Heap, new_space_); }
64 68
65 private: 69 private:
66 Heap(); 70 Heap();
67 71
68 uword AllocateNew(intptr_t size); 72 uword AllocateNew(intptr_t size);
69 uword AllocateOld(intptr_t size); 73 uword AllocateOld(intptr_t size);
70 uword AllocateCode(intptr_t size); 74 uword AllocateCode(intptr_t size);
71 75
72 // Allocation is limited to the below sizes.
73 static const intptr_t kHeapSize = 512 * MB;
74 static const intptr_t kCodeHeapSize = 4 * MB;
75
76 // The different spaces used for allocation. 76 // The different spaces used for allocation.
77 Scavenger* new_space_; 77 Scavenger* new_space_;
78 PageSpace* old_space_; 78 PageSpace* old_space_;
79 PageSpace* code_space_; 79 PageSpace* code_space_;
80 80
81 DISALLOW_COPY_AND_ASSIGN(Heap); 81 DISALLOW_COPY_AND_ASSIGN(Heap);
82 }; 82 };
83 83
84 84
85 #if defined(DEBUG) 85 #if defined(DEBUG)
(...skipping 11 matching lines...) Expand all
97 public: 97 public:
98 NoGCScope() {} 98 NoGCScope() {}
99 private: 99 private:
100 DISALLOW_COPY_AND_ASSIGN(NoGCScope); 100 DISALLOW_COPY_AND_ASSIGN(NoGCScope);
101 }; 101 };
102 #endif // defined(DEBUG) 102 #endif // defined(DEBUG)
103 103
104 } // namespace dart 104 } // namespace dart
105 105
106 #endif // VM_HEAP_H_ 106 #endif // VM_HEAP_H_
OLDNEW
« no previous file with comments | « no previous file | vm/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698