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

Side by Side Diff: runtime/vm/heap.cc

Issue 1399783002: Add a hash map for a raw object to id mapping, this table will be used during snapshot writing in o… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: code-review-comments Created 5 years, 2 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 | « runtime/vm/heap.h ('k') | runtime/vm/weak_table.h » ('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 #include "vm/heap.h" 5 #include "vm/heap.h"
6 6
7 #include "platform/assert.h" 7 #include "platform/assert.h"
8 #include "platform/utils.h" 8 #include "platform/utils.h"
9 #include "vm/flags.h" 9 #include "vm/flags.h"
10 #include "vm/isolate.h" 10 #include "vm/isolate.h"
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 } 640 }
641 } 641 }
642 642
643 643
644 int64_t Heap::PeerCount() const { 644 int64_t Heap::PeerCount() const {
645 return new_weak_tables_[kPeers]->count() + old_weak_tables_[kPeers]->count(); 645 return new_weak_tables_[kPeers]->count() + old_weak_tables_[kPeers]->count();
646 } 646 }
647 647
648 648
649 int64_t Heap::HashCount() const { 649 int64_t Heap::HashCount() const {
650 return 650 return new_weak_tables_[kHashes]->count() +
651 new_weak_tables_[kHashes]->count() + old_weak_tables_[kHashes]->count(); 651 old_weak_tables_[kHashes]->count();
652 } 652 }
653 653
654 654
655 int64_t Heap::ObjectIdCount() const {
656 return new_weak_tables_[kObjectIds]->count() +
657 old_weak_tables_[kObjectIds]->count();
658 }
659
660
661 void Heap::ResetObjectIdTable() {
662 new_weak_tables_[kObjectIds]->Reset();
663 old_weak_tables_[kObjectIds]->Reset();
664 }
665
666
655 intptr_t Heap::GetWeakEntry(RawObject* raw_obj, WeakSelector sel) const { 667 intptr_t Heap::GetWeakEntry(RawObject* raw_obj, WeakSelector sel) const {
656 if (raw_obj->IsNewObject()) { 668 if (raw_obj->IsNewObject()) {
657 return new_weak_tables_[sel]->GetValue(raw_obj); 669 return new_weak_tables_[sel]->GetValue(raw_obj);
658 } 670 }
659 ASSERT(raw_obj->IsOldObject()); 671 ASSERT(raw_obj->IsOldObject());
660 return old_weak_tables_[sel]->GetValue(raw_obj); 672 return old_weak_tables_[sel]->GetValue(raw_obj);
661 } 673 }
662 674
663 675
664 void Heap::SetWeakEntry(RawObject* raw_obj, WeakSelector sel, intptr_t val) { 676 void Heap::SetWeakEntry(RawObject* raw_obj, WeakSelector sel, intptr_t val) {
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
793 Dart::vm_isolate()->heap()->WriteProtect(false); 805 Dart::vm_isolate()->heap()->WriteProtect(false);
794 } 806 }
795 807
796 808
797 WritableVMIsolateScope::~WritableVMIsolateScope() { 809 WritableVMIsolateScope::~WritableVMIsolateScope() {
798 ASSERT(Dart::vm_isolate()->heap()->UsedInWords(Heap::kNew) == 0); 810 ASSERT(Dart::vm_isolate()->heap()->UsedInWords(Heap::kNew) == 0);
799 Dart::vm_isolate()->heap()->WriteProtect(true); 811 Dart::vm_isolate()->heap()->WriteProtect(true);
800 } 812 }
801 813
802 } // namespace dart 814 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/heap.h ('k') | runtime/vm/weak_table.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698