Chromium Code Reviews| 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 #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 Loading... | |
| 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 Loading... | |
| 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 std::map<RawObject*, void*> peer_; | |
|
siva
2012/09/14 00:03:46
peer_table_ or peer_map_ ?
| |
| 145 | |
| 134 // Current allocation top and end. These values are being accessed directly | 146 // Current allocation top and end. These values are being accessed directly |
| 135 // from generated code. | 147 // from generated code. |
| 136 uword top_; | 148 uword top_; |
| 137 uword end_; | 149 uword end_; |
| 138 | 150 |
| 139 // A pointer to the first unscanned object. Scanning completes when | 151 // A pointer to the first unscanned object. Scanning completes when |
| 140 // this value meets the allocation top. | 152 // this value meets the allocation top. |
| 141 uword resolved_top_; | 153 uword resolved_top_; |
| 142 | 154 |
| 143 // Objects below this address have survived a scavenge. | 155 // Objects below this address have survived a scavenge. |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 155 | 167 |
| 156 friend class ScavengerVisitor; | 168 friend class ScavengerVisitor; |
| 157 friend class ScavengerWeakVisitor; | 169 friend class ScavengerWeakVisitor; |
| 158 | 170 |
| 159 DISALLOW_COPY_AND_ASSIGN(Scavenger); | 171 DISALLOW_COPY_AND_ASSIGN(Scavenger); |
| 160 }; | 172 }; |
| 161 | 173 |
| 162 } // namespace dart | 174 } // namespace dart |
| 163 | 175 |
| 164 #endif // VM_SCAVENGER_H_ | 176 #endif // VM_SCAVENGER_H_ |
| OLD | NEW |