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

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

Issue 534653002: Bump allocation for promotion (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 3 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/bit_set.h ('k') | runtime/vm/freelist.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) 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_FREELIST_H_ 5 #ifndef VM_FREELIST_H_
6 #define VM_FREELIST_H_ 6 #define VM_FREELIST_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/bit_set.h" 10 #include "vm/bit_set.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 void Reset(); 87 void Reset();
88 88
89 void Print() const; 89 void Print() const;
90 90
91 Mutex* mutex() { return mutex_; } 91 Mutex* mutex() { return mutex_; }
92 uword TryAllocateLocked(intptr_t size, bool is_protected); 92 uword TryAllocateLocked(intptr_t size, bool is_protected);
93 void FreeLocked(uword addr, intptr_t size); 93 void FreeLocked(uword addr, intptr_t size);
94 94
95 // Returns a large element, at least 'minimum_size', or NULL if none exists. 95 // Returns a large element, at least 'minimum_size', or NULL if none exists.
96 FreeListElement* TryAllocateLarge(intptr_t minimum_size); 96 FreeListElement* TryAllocateLarge(intptr_t minimum_size);
97 FreeListElement* TryAllocateLargeLocked(intptr_t minimum_size);
98
99 // Allocates locked and unprotected memory, but only from small elements
100 // (i.e., fixed size lists).
101 uword TryAllocateSmallLocked(intptr_t size);
97 102
98 private: 103 private:
99 static const int kNumLists = 128; 104 static const int kNumLists = 128;
100 105
101 static intptr_t IndexForSize(intptr_t size); 106 static intptr_t IndexForSize(intptr_t size);
102 107
103 intptr_t LengthLocked(int index) const; 108 intptr_t LengthLocked(int index) const;
104 109
105 void EnqueueElement(FreeListElement* element, intptr_t index); 110 void EnqueueElement(FreeListElement* element, intptr_t index);
106 FreeListElement* DequeueElement(intptr_t index); 111 FreeListElement* DequeueElement(intptr_t index);
107 112
108 void SplitElementAfterAndEnqueue(FreeListElement* element, 113 void SplitElementAfterAndEnqueue(FreeListElement* element,
109 intptr_t size, 114 intptr_t size,
110 bool is_protected); 115 bool is_protected);
111 116
112 void PrintSmall() const; 117 void PrintSmall() const;
113 void PrintLarge() const; 118 void PrintLarge() const;
114 119
115 // Lock protecting the free list data structures. 120 // Lock protecting the free list data structures.
116 Mutex* mutex_; 121 Mutex* mutex_;
117 122
118 BitSet<kNumLists> free_map_; 123 BitSet<kNumLists> free_map_;
119 124
120 FreeListElement* free_lists_[kNumLists + 1]; 125 FreeListElement* free_lists_[kNumLists + 1];
121 126
127 // The largest available small size in bytes, or negative if there is none.
128 intptr_t last_free_small_size_;
129
122 DISALLOW_COPY_AND_ASSIGN(FreeList); 130 DISALLOW_COPY_AND_ASSIGN(FreeList);
123 }; 131 };
124 132
125 } // namespace dart 133 } // namespace dart
126 134
127 #endif // VM_FREELIST_H_ 135 #endif // VM_FREELIST_H_
OLDNEW
« no previous file with comments | « runtime/vm/bit_set.h ('k') | runtime/vm/freelist.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698