OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 6445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6456 void PathTracer::Reset() { | 6456 void PathTracer::Reset() { |
6457 found_target_ = false; | 6457 found_target_ = false; |
6458 object_stack_.Clear(); | 6458 object_stack_.Clear(); |
6459 } | 6459 } |
6460 | 6460 |
6461 | 6461 |
6462 void PathTracer::TracePathFrom(Object** root) { | 6462 void PathTracer::TracePathFrom(Object** root) { |
6463 ASSERT((search_target_ == kAnyGlobalObject) || | 6463 ASSERT((search_target_ == kAnyGlobalObject) || |
6464 search_target_->IsHeapObject()); | 6464 search_target_->IsHeapObject()); |
6465 found_target_in_trace_ = false; | 6465 found_target_in_trace_ = false; |
6466 object_stack_.Clear(); | 6466 Reset(); |
6467 | 6467 |
6468 MarkVisitor mark_visitor(this); | 6468 MarkVisitor mark_visitor(this); |
6469 MarkRecursively(root, &mark_visitor); | 6469 MarkRecursively(root, &mark_visitor); |
6470 | 6470 |
6471 UnmarkVisitor unmark_visitor(this); | 6471 UnmarkVisitor unmark_visitor(this); |
6472 UnmarkRecursively(root, &unmark_visitor); | 6472 UnmarkRecursively(root, &unmark_visitor); |
6473 | 6473 |
6474 ProcessResults(); | 6474 ProcessResults(); |
6475 } | 6475 } |
6476 | 6476 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6560 void PathTracer::ProcessResults() { | 6560 void PathTracer::ProcessResults() { |
6561 if (found_target_) { | 6561 if (found_target_) { |
6562 PrintF("=====================================\n"); | 6562 PrintF("=====================================\n"); |
6563 PrintF("==== Path to object ====\n"); | 6563 PrintF("==== Path to object ====\n"); |
6564 PrintF("=====================================\n\n"); | 6564 PrintF("=====================================\n\n"); |
6565 | 6565 |
6566 ASSERT(!object_stack_.is_empty()); | 6566 ASSERT(!object_stack_.is_empty()); |
6567 for (int i = 0; i < object_stack_.length(); i++) { | 6567 for (int i = 0; i < object_stack_.length(); i++) { |
6568 if (i > 0) PrintF("\n |\n |\n V\n\n"); | 6568 if (i > 0) PrintF("\n |\n |\n V\n\n"); |
6569 Object* obj = object_stack_[i]; | 6569 Object* obj = object_stack_[i]; |
6570 #ifdef OBJECT_PRINT | |
6571 obj->Print(); | 6570 obj->Print(); |
6572 #else | |
6573 obj->ShortPrint(); | |
6574 #endif | |
6575 } | 6571 } |
6576 PrintF("=====================================\n"); | 6572 PrintF("=====================================\n"); |
6577 } | 6573 } |
6578 } | 6574 } |
6579 #endif // DEBUG || LIVE_OBJECT_LIST | 6575 #endif // DEBUG || LIVE_OBJECT_LIST |
6580 | 6576 |
6581 | 6577 |
6582 #ifdef DEBUG | 6578 #ifdef DEBUG |
6583 // Triggers a depth-first traversal of reachable objects from roots | 6579 // Triggers a depth-first traversal of reachable objects from roots |
6584 // and finds a path to a specific heap object and prints it. | 6580 // and finds a path to a specific heap object and prints it. |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6980 } else { | 6976 } else { |
6981 p ^= 0x1d1ed & (Page::kPageSize - 1); // I died. | 6977 p ^= 0x1d1ed & (Page::kPageSize - 1); // I died. |
6982 } | 6978 } |
6983 remembered_unmapped_pages_[remembered_unmapped_pages_index_] = | 6979 remembered_unmapped_pages_[remembered_unmapped_pages_index_] = |
6984 reinterpret_cast<Address>(p); | 6980 reinterpret_cast<Address>(p); |
6985 remembered_unmapped_pages_index_++; | 6981 remembered_unmapped_pages_index_++; |
6986 remembered_unmapped_pages_index_ %= kRememberedUnmappedPages; | 6982 remembered_unmapped_pages_index_ %= kRememberedUnmappedPages; |
6987 } | 6983 } |
6988 | 6984 |
6989 } } // namespace v8::internal | 6985 } } // namespace v8::internal |
OLD | NEW |