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

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

Issue 2872883003: Avoid scanning huge freelists for large enough free blocks. (Closed)
Patch Set: Feedback from Martin Created 3 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
« no previous file with comments | « no previous file | 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 RUNTIME_VM_FREELIST_H_ 5 #ifndef RUNTIME_VM_FREELIST_H_
6 #define RUNTIME_VM_FREELIST_H_ 6 #define RUNTIME_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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 // Returns a large element, at least 'minimum_size', or NULL if none exists. 91 // Returns a large element, at least 'minimum_size', or NULL if none exists.
92 FreeListElement* TryAllocateLarge(intptr_t minimum_size); 92 FreeListElement* TryAllocateLarge(intptr_t minimum_size);
93 FreeListElement* TryAllocateLargeLocked(intptr_t minimum_size); 93 FreeListElement* TryAllocateLargeLocked(intptr_t minimum_size);
94 94
95 // Allocates locked and unprotected memory, but only from small elements 95 // Allocates locked and unprotected memory, but only from small elements
96 // (i.e., fixed size lists). 96 // (i.e., fixed size lists).
97 uword TryAllocateSmallLocked(intptr_t size); 97 uword TryAllocateSmallLocked(intptr_t size);
98 98
99 private: 99 private:
100 static const int kNumLists = 128; 100 static const int kNumLists = 128;
101 static const intptr_t kInitialFreeListSearchBudget = 1000;
101 102
102 static intptr_t IndexForSize(intptr_t size); 103 static intptr_t IndexForSize(intptr_t size);
103 104
104 intptr_t LengthLocked(int index) const; 105 intptr_t LengthLocked(int index) const;
105 106
106 void EnqueueElement(FreeListElement* element, intptr_t index); 107 void EnqueueElement(FreeListElement* element, intptr_t index);
107 FreeListElement* DequeueElement(intptr_t index); 108 FreeListElement* DequeueElement(intptr_t index);
108 109
109 void SplitElementAfterAndEnqueue(FreeListElement* element, 110 void SplitElementAfterAndEnqueue(FreeListElement* element,
110 intptr_t size, 111 intptr_t size,
111 bool is_protected); 112 bool is_protected);
112 113
113 void PrintSmall() const; 114 void PrintSmall() const;
114 void PrintLarge() const; 115 void PrintLarge() const;
115 116
116 // Lock protecting the free list data structures. 117 // Lock protecting the free list data structures.
117 Mutex* mutex_; 118 Mutex* mutex_;
118 119
119 BitSet<kNumLists> free_map_; 120 BitSet<kNumLists> free_map_;
120 121
121 FreeListElement* free_lists_[kNumLists + 1]; 122 FreeListElement* free_lists_[kNumLists + 1];
122 123
124 intptr_t freelist_search_budget_;
125
123 // The largest available small size in bytes, or negative if there is none. 126 // The largest available small size in bytes, or negative if there is none.
124 intptr_t last_free_small_size_; 127 intptr_t last_free_small_size_;
125 128
126 DISALLOW_COPY_AND_ASSIGN(FreeList); 129 DISALLOW_COPY_AND_ASSIGN(FreeList);
127 }; 130 };
128 131
129 } // namespace dart 132 } // namespace dart
130 133
131 #endif // RUNTIME_VM_FREELIST_H_ 134 #endif // RUNTIME_VM_FREELIST_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/freelist.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698