Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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/object_graph.h" | 5 #include "vm/object_graph.h" |
| 6 | 6 |
| 7 #include "vm/dart.h" | 7 #include "vm/dart.h" |
| 8 #include "vm/growable_array.h" | 8 #include "vm/growable_array.h" |
| 9 #include "vm/isolate.h" | 9 #include "vm/isolate.h" |
| 10 #include "vm/object.h" | 10 #include "vm/object.h" |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 321 | 321 |
| 322 virtual Direction VisitObject(ObjectGraph::StackIterator* it) { | 322 virtual Direction VisitObject(ObjectGraph::StackIterator* it) { |
| 323 if (it->Get() != obj_) { | 323 if (it->Get() != obj_) { |
| 324 if (ShouldSkip(it->Get())) { | 324 if (ShouldSkip(it->Get())) { |
| 325 return kBacktrack; | 325 return kBacktrack; |
| 326 } else { | 326 } else { |
| 327 return kProceed; | 327 return kProceed; |
| 328 } | 328 } |
| 329 } else { | 329 } else { |
| 330 HANDLESCOPE(thread_); | 330 HANDLESCOPE(thread_); |
| 331 RawObject* object; | |
|
Cutch
2016/08/11 13:23:21
It is generally unsafe to use a RawObject* you sho
cbernaschina
2016/08/11 22:03:31
Done.
| |
| 331 Object& current = Object::Handle(); | 332 Object& current = Object::Handle(); |
| 332 Smi& offset_from_parent = Smi::Handle(); | 333 Smi& offset_from_parent = Smi::Handle(); |
| 334 bool isLastDartInstance = true; | |
| 333 do { | 335 do { |
| 336 object = it->Get(); | |
| 337 if (!isLastDartInstance && object->IsArray()) { | |
|
Cutch
2016/08/11 13:23:21
please document what this is testing for and why i
cbernaschina
2016/08/11 22:03:31
Done.
| |
| 338 isLastDartInstance = true; | |
| 339 continue; | |
| 340 } | |
| 341 isLastDartInstance = object->IsDartInstance(); | |
| 334 intptr_t obj_index = length_ * 2; | 342 intptr_t obj_index = length_ * 2; |
| 335 intptr_t offset_index = obj_index + 1; | 343 intptr_t offset_index = obj_index + 1; |
| 336 if (!path_.IsNull() && offset_index < path_.Length()) { | 344 if (!path_.IsNull() && offset_index < path_.Length()) { |
| 337 current = it->Get(); | 345 current = object; |
| 338 path_.SetAt(obj_index, current); | 346 path_.SetAt(obj_index, current); |
| 339 offset_from_parent = Smi::New(it->OffsetFromParentInWords()); | 347 offset_from_parent = Smi::New(it->OffsetFromParentInWords()); |
| 340 path_.SetAt(offset_index, offset_from_parent); | 348 path_.SetAt(offset_index, offset_from_parent); |
| 341 } | 349 } |
| 342 ++length_; | 350 ++length_; |
| 343 } while (it->MoveToParent()); | 351 } while (it->MoveToParent()); |
| 344 return kAbort; | 352 return kAbort; |
| 345 } | 353 } |
| 346 } | 354 } |
| 347 | 355 |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 524 { | 532 { |
| 525 WritePointerVisitor ptr_writer(isolate(), stream); | 533 WritePointerVisitor ptr_writer(isolate(), stream); |
| 526 isolate()->IterateObjectPointers(&ptr_writer, false); | 534 isolate()->IterateObjectPointers(&ptr_writer, false); |
| 527 } | 535 } |
| 528 stream->WriteUnsigned(0); | 536 stream->WriteUnsigned(0); |
| 529 IterateObjects(&visitor); | 537 IterateObjects(&visitor); |
| 530 return visitor.count() + 1; // + root | 538 return visitor.count() + 1; // + root |
| 531 } | 539 } |
| 532 | 540 |
| 533 } // namespace dart | 541 } // namespace dart |
| OLD | NEW |