OLD | NEW |
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 #include "vm/pages.h" | 5 #include "vm/pages.h" |
6 | 6 |
7 #include "platform/assert.h" | 7 #include "platform/assert.h" |
8 #include "vm/compiler_stats.h" | 8 #include "vm/compiler_stats.h" |
9 #include "vm/gc_marker.h" | 9 #include "vm/gc_marker.h" |
10 #include "vm/gc_sweeper.h" | 10 #include "vm/gc_sweeper.h" |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 } | 314 } |
315 | 315 |
316 page = large_pages_; | 316 page = large_pages_; |
317 while (page != NULL) { | 317 while (page != NULL) { |
318 page->VisitObjects(visitor); | 318 page->VisitObjects(visitor); |
319 page = page->next(); | 319 page = page->next(); |
320 } | 320 } |
321 } | 321 } |
322 | 322 |
323 | 323 |
324 void PageSpace::SetPeer(RawObject* raw_obj, void* peer) { | |
325 if (peer == NULL) { | |
326 peer_table_.erase(raw_obj); | |
327 } else { | |
328 peer_table_[raw_obj] = peer; | |
329 } | |
330 } | |
331 | |
332 | |
333 void* PageSpace::GetPeer(RawObject* raw_obj) { | |
334 PeerTable::iterator it = peer_table_.find(raw_obj); | |
335 return (it == peer_table_.end()) ? NULL : it->second; | |
336 } | |
337 | |
338 | |
339 int64_t PageSpace::PeerCount() const { | |
340 return static_cast<int64_t>(peer_table_.size()); | |
341 } | |
342 | |
343 | |
344 void PageSpace::VisitObjectPointers(ObjectPointerVisitor* visitor) const { | 324 void PageSpace::VisitObjectPointers(ObjectPointerVisitor* visitor) const { |
345 HeapPage* page = pages_; | 325 HeapPage* page = pages_; |
346 while (page != NULL) { | 326 while (page != NULL) { |
347 page->VisitObjectPointers(visitor); | 327 page->VisitObjectPointers(visitor); |
348 page = page->next(); | 328 page = page->next(); |
349 } | 329 } |
350 | 330 |
351 page = large_pages_; | 331 page = large_pages_; |
352 while (page != NULL) { | 332 while (page != NULL) { |
353 page->VisitObjectPointers(visitor); | 333 page->VisitObjectPointers(visitor); |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 return 0; | 586 return 0; |
607 } else { | 587 } else { |
608 ASSERT(total_time >= gc_time); | 588 ASSERT(total_time >= gc_time); |
609 int result= static_cast<int>((static_cast<double>(gc_time) / | 589 int result= static_cast<int>((static_cast<double>(gc_time) / |
610 static_cast<double>(total_time)) * 100); | 590 static_cast<double>(total_time)) * 100); |
611 return result; | 591 return result; |
612 } | 592 } |
613 } | 593 } |
614 | 594 |
615 } // namespace dart | 595 } // namespace dart |
OLD | NEW |