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

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

Issue 110883016: - Allow to pre-filter before calling the FindObjectVisitor. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 11 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/vm/object.h ('k') | runtime/vm/visitor.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/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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 uword end_addr = object_end(); 75 uword end_addr = object_end();
76 while (obj_addr < end_addr) { 76 while (obj_addr < end_addr) {
77 RawObject* raw_obj = RawObject::FromAddr(obj_addr); 77 RawObject* raw_obj = RawObject::FromAddr(obj_addr);
78 obj_addr += raw_obj->VisitPointers(visitor); 78 obj_addr += raw_obj->VisitPointers(visitor);
79 } 79 }
80 ASSERT(obj_addr == end_addr); 80 ASSERT(obj_addr == end_addr);
81 } 81 }
82 82
83 83
84 RawObject* HeapPage::FindObject(FindObjectVisitor* visitor) const { 84 RawObject* HeapPage::FindObject(FindObjectVisitor* visitor) const {
85 uword filter_addr = visitor->filter_addr();
85 uword obj_addr = object_start(); 86 uword obj_addr = object_start();
86 uword end_addr = object_end(); 87 uword end_addr = object_end();
87 while (obj_addr < end_addr) { 88 if ((filter_addr == 0) ||
88 RawObject* raw_obj = RawObject::FromAddr(obj_addr); 89 ((filter_addr >= obj_addr) && (filter_addr < end_addr))) {
siva 2013/12/30 22:15:12 Instead of a filter_addr method in the visitor int
Ivan Posva 2013/12/31 00:26:59 Redone as discussed. On 2013/12/30 22:15:12, siva
89 if (raw_obj->FindObject(visitor)) { 90 while (obj_addr < end_addr) {
90 return raw_obj; // Found object, return it. 91 RawObject* raw_obj = RawObject::FromAddr(obj_addr);
92 uword next_obj_addr = obj_addr + raw_obj->Size();
93 if (((filter_addr == 0) ||
94 ((filter_addr >= obj_addr) && (filter_addr < end_addr))) &&
siva 2013/12/30 22:15:12 next_obj_addr ?
Ivan Posva 2013/12/31 00:26:59 Done.
95 raw_obj->FindObject(visitor)) {
96 return raw_obj; // Found object, return it.
97 }
98 obj_addr = next_obj_addr;
91 } 99 }
92 obj_addr += raw_obj->Size(); 100 ASSERT(obj_addr == end_addr);
93 } 101 }
94 ASSERT(obj_addr == end_addr);
95 return Object::null(); 102 return Object::null();
96 } 103 }
97 104
98 105
99 void HeapPage::WriteProtect(bool read_only) { 106 void HeapPage::WriteProtect(bool read_only) {
100 VirtualMemory::Protection prot; 107 VirtualMemory::Protection prot;
101 if (read_only) { 108 if (read_only) {
102 if (executable_) { 109 if (executable_) {
103 prot = VirtualMemory::kReadExecute; 110 prot = VirtualMemory::kReadExecute;
104 } else { 111 } else {
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 return 0; 629 return 0;
623 } else { 630 } else {
624 ASSERT(total_time >= gc_time); 631 ASSERT(total_time >= gc_time);
625 int result= static_cast<int>((static_cast<double>(gc_time) / 632 int result= static_cast<int>((static_cast<double>(gc_time) /
626 static_cast<double>(total_time)) * 100); 633 static_cast<double>(total_time)) * 100);
627 return result; 634 return result;
628 } 635 }
629 } 636 }
630 637
631 } // namespace dart 638 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/visitor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698