| 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/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/compiler_stats.h" | 9 #include "vm/compiler_stats.h" |
| 10 #include "vm/flags.h" | 10 #include "vm/flags.h" |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 old_space_->VisitObjectPointers(visitor); | 122 old_space_->VisitObjectPointers(visitor); |
| 123 code_space_->VisitObjectPointers(visitor); | 123 code_space_->VisitObjectPointers(visitor); |
| 124 } | 124 } |
| 125 | 125 |
| 126 | 126 |
| 127 void Heap::IterateCodePointers(ObjectPointerVisitor* visitor) { | 127 void Heap::IterateCodePointers(ObjectPointerVisitor* visitor) { |
| 128 code_space_->VisitObjectPointers(visitor); | 128 code_space_->VisitObjectPointers(visitor); |
| 129 } | 129 } |
| 130 | 130 |
| 131 | 131 |
| 132 RawInstructions* Heap::FindObjectInCodeSpace(FindObjectVisitor* visitor) { | |
| 133 // The code heap can only have RawInstructions objects. | |
| 134 RawObject* raw_obj = code_space_->FindObject(visitor); | |
| 135 ASSERT(raw_obj->ptr()->class_->ptr()->instance_kind_ == kInstructions); | |
| 136 return reinterpret_cast<RawInstructions*>(raw_obj); | |
| 137 } | |
| 138 | |
| 139 | |
| 140 void Heap::CollectGarbage(Space space, ApiCallbacks api_callbacks) { | 132 void Heap::CollectGarbage(Space space, ApiCallbacks api_callbacks) { |
| 141 bool invoke_api_callbacks = (api_callbacks == kInvokeApiCallbacks); | 133 bool invoke_api_callbacks = (api_callbacks == kInvokeApiCallbacks); |
| 142 switch (space) { | 134 switch (space) { |
| 143 case kNew: | 135 case kNew: |
| 144 new_space_->Scavenge(invoke_api_callbacks); | 136 new_space_->Scavenge(invoke_api_callbacks); |
| 145 break; | 137 break; |
| 146 case kOld: | 138 case kOld: |
| 147 old_space_->MarkSweep(invoke_api_callbacks); | 139 old_space_->MarkSweep(invoke_api_callbacks); |
| 148 break; | 140 break; |
| 149 case kExecutable: | 141 case kExecutable: |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 isolate()->IncrementNoGCScopeDepth(); | 199 isolate()->IncrementNoGCScopeDepth(); |
| 208 } | 200 } |
| 209 | 201 |
| 210 | 202 |
| 211 NoGCScope::~NoGCScope() { | 203 NoGCScope::~NoGCScope() { |
| 212 isolate()->DecrementNoGCScopeDepth(); | 204 isolate()->DecrementNoGCScopeDepth(); |
| 213 } | 205 } |
| 214 #endif // defined(DEBUG) | 206 #endif // defined(DEBUG) |
| 215 | 207 |
| 216 } // namespace dart | 208 } // namespace dart |
| OLD | NEW |