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

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

Issue 10905251: Lazy peer API. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebased Created 8 years, 3 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
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 VM_SCAVENGER_H_ 5 #ifndef VM_SCAVENGER_H_
6 #define VM_SCAVENGER_H_ 6 #define VM_SCAVENGER_H_
7 7
8 #include <map>
9
8 #include "platform/assert.h" 10 #include "platform/assert.h"
9 #include "platform/utils.h" 11 #include "platform/utils.h"
10 #include "vm/flags.h" 12 #include "vm/flags.h"
11 #include "vm/globals.h" 13 #include "vm/globals.h"
12 #include "vm/raw_object.h" 14 #include "vm/raw_object.h"
13 #include "vm/virtual_memory.h" 15 #include "vm/virtual_memory.h"
14 #include "vm/visitor.h" 16 #include "vm/visitor.h"
15 17
16 namespace dart { 18 namespace dart {
17 19
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 *end = to_->end(); 82 *end = to_->end();
81 } 83 }
82 84
83 // Returns true if the last scavenge had a promotion failure. 85 // Returns true if the last scavenge had a promotion failure.
84 bool HadPromotionFailure() { 86 bool HadPromotionFailure() {
85 return had_promotion_failure_; 87 return had_promotion_failure_;
86 } 88 }
87 89
88 void WriteProtect(bool read_only); 90 void WriteProtect(bool read_only);
89 91
92 void SetPeer(RawObject* raw_obj, void* peer);
93
94 void* GetPeer(RawObject* raw_obj);
95
96 int64_t PeerCount() const;
97
90 private: 98 private:
91 uword FirstObjectStart() const { return to_->start() | object_alignment_; } 99 uword FirstObjectStart() const { return to_->start() | object_alignment_; }
92 void Prologue(Isolate* isolate, bool invoke_api_callbacks); 100 void Prologue(Isolate* isolate, bool invoke_api_callbacks);
93 void IterateStoreBuffers(Isolate* isolate, ScavengerVisitor* visitor); 101 void IterateStoreBuffers(Isolate* isolate, ScavengerVisitor* visitor);
94 void IterateRoots(Isolate* isolate, 102 void IterateRoots(Isolate* isolate,
95 ScavengerVisitor* visitor, 103 ScavengerVisitor* visitor,
96 bool visit_prologue_weak_persistent_handles); 104 bool visit_prologue_weak_persistent_handles);
97 void IterateWeakProperties(Isolate* isolate, ScavengerVisitor* visitor); 105 void IterateWeakProperties(Isolate* isolate, ScavengerVisitor* visitor);
98 void IterateWeakReferences(Isolate* isolate, ScavengerVisitor* visitor); 106 void IterateWeakReferences(Isolate* isolate, ScavengerVisitor* visitor);
99 void IterateWeakRoots(Isolate* isolate, 107 void IterateWeakRoots(Isolate* isolate,
(...skipping 18 matching lines...) Expand all
118 uword PopFromPromotedStack() { 126 uword PopFromPromotedStack() {
119 uword result = *reinterpret_cast<uword*>(end_); 127 uword result = *reinterpret_cast<uword*>(end_);
120 end_ += sizeof(result); 128 end_ += sizeof(result);
121 ASSERT(end_ <= to_->end()); 129 ASSERT(end_ <= to_->end());
122 return result; 130 return result;
123 } 131 }
124 bool PromotedStackHasMore() const { 132 bool PromotedStackHasMore() const {
125 return end_ < to_->end(); 133 return end_ < to_->end();
126 } 134 }
127 135
136 void ProcessPeerReferents();
137
128 VirtualMemory* space_; 138 VirtualMemory* space_;
129 MemoryRegion* to_; 139 MemoryRegion* to_;
130 MemoryRegion* from_; 140 MemoryRegion* from_;
131 141
132 Heap* heap_; 142 Heap* heap_;
133 143
144 typedef std::map<RawObject*, void*> PeerTable;
145 PeerTable peer_table_;
146
134 // Current allocation top and end. These values are being accessed directly 147 // Current allocation top and end. These values are being accessed directly
135 // from generated code. 148 // from generated code.
136 uword top_; 149 uword top_;
137 uword end_; 150 uword end_;
138 151
139 // A pointer to the first unscanned object. Scanning completes when 152 // A pointer to the first unscanned object. Scanning completes when
140 // this value meets the allocation top. 153 // this value meets the allocation top.
141 uword resolved_top_; 154 uword resolved_top_;
142 155
143 // Objects below this address have survived a scavenge. 156 // Objects below this address have survived a scavenge.
(...skipping 11 matching lines...) Expand all
155 168
156 friend class ScavengerVisitor; 169 friend class ScavengerVisitor;
157 friend class ScavengerWeakVisitor; 170 friend class ScavengerWeakVisitor;
158 171
159 DISALLOW_COPY_AND_ASSIGN(Scavenger); 172 DISALLOW_COPY_AND_ASSIGN(Scavenger);
160 }; 173 };
161 174
162 } // namespace dart 175 } // namespace dart
163 176
164 #endif // VM_SCAVENGER_H_ 177 #endif // VM_SCAVENGER_H_
OLDNEW
« runtime/vm/dart_api_impl.cc ('K') | « runtime/vm/pages.cc ('k') | runtime/vm/scavenger.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698