| OLD | NEW |
| 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 #include "vm/freelist.h" | 5 #include "vm/freelist.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "vm/bit_set.h" | 10 #include "vm/bit_set.h" |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 if (it != sorted.end()) { | 186 if (it != sorted.end()) { |
| 187 it->second += 1; | 187 it->second += 1; |
| 188 } else { | 188 } else { |
| 189 large_sizes += 1; | 189 large_sizes += 1; |
| 190 sorted.insert(std::make_pair(node->Size(), 1)); | 190 sorted.insert(std::make_pair(node->Size(), 1)); |
| 191 } | 191 } |
| 192 large_objects += 1; | 192 large_objects += 1; |
| 193 } | 193 } |
| 194 for (it = sorted.begin(); it != sorted.end(); ++it) { | 194 for (it = sorted.begin(); it != sorted.end(); ++it) { |
| 195 intptr_t size = it->first; | 195 intptr_t size = it->first; |
| 196 int list_length = it->second; | 196 intptr_t list_length = it->second; |
| 197 intptr_t list_bytes = list_length * size; | 197 intptr_t list_bytes = list_length * size; |
| 198 large_bytes += list_bytes; | 198 large_bytes += list_bytes; |
| 199 OS::Print("large %3d [%8d bytes] : " | 199 OS::Print("large %3"Pd" [%8"Pd" bytes] : " |
| 200 "%8"Pd" objs; %8.1f KB; %8.1f cum KB\n", | 200 "%8"Pd" objs; %8.1f KB; %8.1f cum KB\n", |
| 201 size / kObjectAlignment, | 201 size / kObjectAlignment, |
| 202 size, | 202 size, |
| 203 list_length, | 203 list_length, |
| 204 list_bytes / static_cast<double>(KB), | 204 list_bytes / static_cast<double>(KB), |
| 205 large_bytes / static_cast<double>(KB)); | 205 large_bytes / static_cast<double>(KB)); |
| 206 } | 206 } |
| 207 } | 207 } |
| 208 | 208 |
| 209 | 209 |
| 210 void FreeList::Print() const { | 210 void FreeList::Print() const { |
| 211 PrintSmall(); | 211 PrintSmall(); |
| 212 PrintLarge(); | 212 PrintLarge(); |
| 213 } | 213 } |
| 214 | 214 |
| 215 | 215 |
| 216 void FreeList::SplitElementAfterAndEnqueue(FreeListElement* element, | 216 void FreeList::SplitElementAfterAndEnqueue(FreeListElement* element, |
| 217 intptr_t size) { | 217 intptr_t size) { |
| 218 intptr_t remainder_size = element->Size() - size; | 218 intptr_t remainder_size = element->Size() - size; |
| 219 if (remainder_size == 0) return; | 219 if (remainder_size == 0) return; |
| 220 | 220 |
| 221 element = FreeListElement::AsElement(reinterpret_cast<uword>(element) + size, | 221 element = FreeListElement::AsElement(reinterpret_cast<uword>(element) + size, |
| 222 remainder_size); | 222 remainder_size); |
| 223 intptr_t remainder_index = IndexForSize(remainder_size); | 223 intptr_t remainder_index = IndexForSize(remainder_size); |
| 224 EnqueueElement(element, remainder_index); | 224 EnqueueElement(element, remainder_index); |
| 225 } | 225 } |
| 226 | 226 |
| 227 } // namespace dart | 227 } // namespace dart |
| OLD | NEW |