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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 | 162 |
163 void Heap::IterateCodeObjects(ObjectVisitor* visitor) { | 163 void Heap::IterateCodeObjects(ObjectVisitor* visitor) { |
164 code_space_->VisitObjects(visitor); | 164 code_space_->VisitObjects(visitor); |
165 } | 165 } |
166 | 166 |
167 | 167 |
168 RawInstructions* Heap::FindObjectInCodeSpace(FindObjectVisitor* visitor) { | 168 RawInstructions* Heap::FindObjectInCodeSpace(FindObjectVisitor* visitor) { |
169 // The code heap can only have RawInstructions objects. | 169 // The code heap can only have RawInstructions objects. |
170 RawObject* raw_obj = code_space_->FindObject(visitor); | 170 RawObject* raw_obj = code_space_->FindObject(visitor); |
171 ASSERT((raw_obj == Object::null()) || | 171 ASSERT((raw_obj == Object::null()) || |
172 (raw_obj->GetClassId() == kInstructions)); | 172 (raw_obj->GetClassId() == kInstructionsCid)); |
173 return reinterpret_cast<RawInstructions*>(raw_obj); | 173 return reinterpret_cast<RawInstructions*>(raw_obj); |
174 } | 174 } |
175 | 175 |
176 | 176 |
177 void Heap::CollectGarbage(Space space, ApiCallbacks api_callbacks) { | 177 void Heap::CollectGarbage(Space space, ApiCallbacks api_callbacks) { |
178 bool invoke_api_callbacks = (api_callbacks == kInvokeApiCallbacks); | 178 bool invoke_api_callbacks = (api_callbacks == kInvokeApiCallbacks); |
179 switch (space) { | 179 switch (space) { |
180 case kNew: | 180 case kNew: |
181 new_space_->Scavenge(invoke_api_callbacks); | 181 new_space_->Scavenge(invoke_api_callbacks); |
182 if (new_space_->HadPromotionFailure()) { | 182 if (new_space_->HadPromotionFailure()) { |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 isolate()->IncrementNoGCScopeDepth(); | 338 isolate()->IncrementNoGCScopeDepth(); |
339 } | 339 } |
340 | 340 |
341 | 341 |
342 NoGCScope::~NoGCScope() { | 342 NoGCScope::~NoGCScope() { |
343 isolate()->DecrementNoGCScopeDepth(); | 343 isolate()->DecrementNoGCScopeDepth(); |
344 } | 344 } |
345 #endif // defined(DEBUG) | 345 #endif // defined(DEBUG) |
346 | 346 |
347 } // namespace dart | 347 } // namespace dart |
OLD | NEW |