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

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

Issue 511963007: Pretenure some strings into bump-allocated block (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/lib/num.cc ('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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 void Free(uword addr, intptr_t size); 85 void Free(uword addr, intptr_t size);
86 86
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.
96 FreeListElement* TryAllocateLarge(intptr_t minimum_size);
97
95 private: 98 private:
96 static const int kNumLists = 128; 99 static const int kNumLists = 128;
97 100
98 static intptr_t IndexForSize(intptr_t size); 101 static intptr_t IndexForSize(intptr_t size);
99 102
100 intptr_t Length(int index) const; 103 intptr_t LengthLocked(int index) const;
101 104
102 void EnqueueElement(FreeListElement* element, intptr_t index); 105 void EnqueueElement(FreeListElement* element, intptr_t index);
103 FreeListElement* DequeueElement(intptr_t index); 106 FreeListElement* DequeueElement(intptr_t index);
104 107
105 void SplitElementAfterAndEnqueue(FreeListElement* element, 108 void SplitElementAfterAndEnqueue(FreeListElement* element,
106 intptr_t size, 109 intptr_t size,
107 bool is_protected); 110 bool is_protected);
108 111
109 void PrintSmall() const; 112 void PrintSmall() const;
110 void PrintLarge() const; 113 void PrintLarge() const;
111 114
112 // Lock protecting the free list data structures. 115 // Lock protecting the free list data structures.
113 Mutex* mutex_; 116 Mutex* mutex_;
114 117
115 BitSet<kNumLists> free_map_; 118 BitSet<kNumLists> free_map_;
116 119
117 FreeListElement* free_lists_[kNumLists + 1]; 120 FreeListElement* free_lists_[kNumLists + 1];
118 121
119 DISALLOW_COPY_AND_ASSIGN(FreeList); 122 DISALLOW_COPY_AND_ASSIGN(FreeList);
120 }; 123 };
121 124
122 } // namespace dart 125 } // namespace dart
123 126
124 #endif // VM_FREELIST_H_ 127 #endif // VM_FREELIST_H_
OLDNEW
« no previous file with comments | « runtime/lib/num.cc ('k') | runtime/vm/freelist.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698