OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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/service.h" | 5 #include "vm/service.h" |
6 | 6 |
7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
8 #include "include/dart_native_api.h" | 8 #include "include/dart_native_api.h" |
9 #include "platform/globals.h" | 9 #include "platform/globals.h" |
10 | 10 |
(...skipping 2199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2210 } | 2210 } |
2211 | 2211 |
2212 | 2212 |
2213 class GetInstancesVisitor : public ObjectGraph::Visitor { | 2213 class GetInstancesVisitor : public ObjectGraph::Visitor { |
2214 public: | 2214 public: |
2215 GetInstancesVisitor(const Class& cls, const Array& storage) | 2215 GetInstancesVisitor(const Class& cls, const Array& storage) |
2216 : cls_(cls), storage_(storage), count_(0) {} | 2216 : cls_(cls), storage_(storage), count_(0) {} |
2217 | 2217 |
2218 virtual Direction VisitObject(ObjectGraph::StackIterator* it) { | 2218 virtual Direction VisitObject(ObjectGraph::StackIterator* it) { |
2219 RawObject* raw_obj = it->Get(); | 2219 RawObject* raw_obj = it->Get(); |
2220 if (raw_obj->IsFreeListElement()) { | 2220 if (raw_obj->IsPseudoObject()) { |
2221 return kProceed; | 2221 return kProceed; |
2222 } | 2222 } |
2223 Thread* thread = Thread::Current(); | 2223 Thread* thread = Thread::Current(); |
2224 REUSABLE_OBJECT_HANDLESCOPE(thread); | 2224 REUSABLE_OBJECT_HANDLESCOPE(thread); |
2225 Object& obj = thread->ObjectHandle(); | 2225 Object& obj = thread->ObjectHandle(); |
2226 obj = raw_obj; | 2226 obj = raw_obj; |
2227 if (obj.GetClassId() == cls_.id()) { | 2227 if (obj.GetClassId() == cls_.id()) { |
2228 if (!storage_.IsNull() && count_ < storage_.Length()) { | 2228 if (!storage_.IsNull() && count_ < storage_.Length()) { |
2229 storage_.SetAt(count_, obj); | 2229 storage_.SetAt(count_, obj); |
2230 } | 2230 } |
(...skipping 1103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3334 | 3334 |
3335 | 3335 |
3336 class ContainsAddressVisitor : public FindObjectVisitor { | 3336 class ContainsAddressVisitor : public FindObjectVisitor { |
3337 public: | 3337 public: |
3338 explicit ContainsAddressVisitor(uword addr) : addr_(addr) { } | 3338 explicit ContainsAddressVisitor(uword addr) : addr_(addr) { } |
3339 virtual ~ContainsAddressVisitor() { } | 3339 virtual ~ContainsAddressVisitor() { } |
3340 | 3340 |
3341 virtual uword filter_addr() const { return addr_; } | 3341 virtual uword filter_addr() const { return addr_; } |
3342 | 3342 |
3343 virtual bool FindObject(RawObject* obj) const { | 3343 virtual bool FindObject(RawObject* obj) const { |
3344 // Free list elements are not real objects, so skip them. | 3344 if (obj->IsPseudoObject()) { |
3345 if (obj->IsFreeListElement()) { | |
3346 return false; | 3345 return false; |
3347 } | 3346 } |
3348 uword obj_begin = RawObject::ToAddr(obj); | 3347 uword obj_begin = RawObject::ToAddr(obj); |
3349 uword obj_end = obj_begin + obj->Size(); | 3348 uword obj_end = obj_begin + obj->Size(); |
3350 return obj_begin <= addr_ && addr_ < obj_end; | 3349 return obj_begin <= addr_ && addr_ < obj_end; |
3351 } | 3350 } |
3352 private: | 3351 private: |
3353 uword addr_; | 3352 uword addr_; |
3354 }; | 3353 }; |
3355 | 3354 |
(...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4042 if (strcmp(method_name, method.name) == 0) { | 4041 if (strcmp(method_name, method.name) == 0) { |
4043 return &method; | 4042 return &method; |
4044 } | 4043 } |
4045 } | 4044 } |
4046 return NULL; | 4045 return NULL; |
4047 } | 4046 } |
4048 | 4047 |
4049 #endif // !PRODUCT | 4048 #endif // !PRODUCT |
4050 | 4049 |
4051 } // namespace dart | 4050 } // namespace dart |
OLD | NEW |