Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(38)

Side by Side Diff: src/heap.cc

Issue 10823054: Implement TracePathToObjectFrom helper for debugging. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/heap.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 6752 matching lines...) Expand 10 before | Expand all | Expand 10 after
6763 Object* obj = object_stack_[i]; 6763 Object* obj = object_stack_[i];
6764 obj->Print(); 6764 obj->Print();
6765 } 6765 }
6766 PrintF("=====================================\n"); 6766 PrintF("=====================================\n");
6767 } 6767 }
6768 } 6768 }
6769 #endif // DEBUG || LIVE_OBJECT_LIST 6769 #endif // DEBUG || LIVE_OBJECT_LIST
6770 6770
6771 6771
6772 #ifdef DEBUG 6772 #ifdef DEBUG
6773 // Triggers a depth-first traversal of reachable objects from one
6774 // given root object and finds a path to a specific heap object and
6775 // prints it.
6776 void Heap::TracePathToObjectFrom(Object* target, Object* root) {
6777 PathTracer tracer(target, PathTracer::FIND_ALL, VISIT_ALL);
6778 tracer.VisitPointer(&root);
6779 }
6780
6781
6773 // Triggers a depth-first traversal of reachable objects from roots 6782 // Triggers a depth-first traversal of reachable objects from roots
6774 // and finds a path to a specific heap object and prints it. 6783 // and finds a path to a specific heap object and prints it.
6775 void Heap::TracePathToObject(Object* target) { 6784 void Heap::TracePathToObject(Object* target) {
6776 PathTracer tracer(target, PathTracer::FIND_ALL, VISIT_ALL); 6785 PathTracer tracer(target, PathTracer::FIND_ALL, VISIT_ALL);
6777 IterateRoots(&tracer, VISIT_ONLY_STRONG); 6786 IterateRoots(&tracer, VISIT_ONLY_STRONG);
6778 } 6787 }
6779 6788
6780 6789
6781 // Triggers a depth-first traversal of reachable objects from roots 6790 // Triggers a depth-first traversal of reachable objects from roots
6782 // and finds a path to any global object and prints it. Useful for 6791 // and finds a path to any global object and prints it. Useful for
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
7229 static_cast<int>(object_sizes_last_time_[index])); 7238 static_cast<int>(object_sizes_last_time_[index]));
7230 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) 7239 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT)
7231 #undef ADJUST_LAST_TIME_OBJECT_COUNT 7240 #undef ADJUST_LAST_TIME_OBJECT_COUNT
7232 7241
7233 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 7242 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
7234 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 7243 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
7235 ClearObjectStats(); 7244 ClearObjectStats();
7236 } 7245 }
7237 7246
7238 } } // namespace v8::internal 7247 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698