OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/api.h" | 8 #include "src/api.h" |
9 #include "src/base/once.h" | 9 #include "src/base/once.h" |
10 #include "src/base/utils/random-number-generator.h" | 10 #include "src/base/utils/random-number-generator.h" |
(...skipping 5935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5946 Map* map = Map::cast(unmarked_map_word.ToMap()); | 5946 Map* map = Map::cast(unmarked_map_word.ToMap()); |
5947 | 5947 |
5948 UnmarkRecursively(reinterpret_cast<Object**>(&map), unmark_visitor); | 5948 UnmarkRecursively(reinterpret_cast<Object**>(&map), unmark_visitor); |
5949 | 5949 |
5950 obj->IterateBody(map->instance_type(), obj->SizeFromMap(map), unmark_visitor); | 5950 obj->IterateBody(map->instance_type(), obj->SizeFromMap(map), unmark_visitor); |
5951 } | 5951 } |
5952 | 5952 |
5953 | 5953 |
5954 void PathTracer::ProcessResults() { | 5954 void PathTracer::ProcessResults() { |
5955 if (found_target_) { | 5955 if (found_target_) { |
5956 PrintF("=====================================\n"); | 5956 OFStream os(stdout); |
5957 PrintF("==== Path to object ====\n"); | 5957 os << "=====================================\n" |
5958 PrintF("=====================================\n\n"); | 5958 << "==== Path to object ====\n" |
| 5959 << "=====================================\n\n"; |
5959 | 5960 |
5960 ASSERT(!object_stack_.is_empty()); | 5961 ASSERT(!object_stack_.is_empty()); |
5961 for (int i = 0; i < object_stack_.length(); i++) { | 5962 for (int i = 0; i < object_stack_.length(); i++) { |
5962 if (i > 0) PrintF("\n |\n |\n V\n\n"); | 5963 if (i > 0) os << "\n |\n |\n V\n\n"; |
5963 Object* obj = object_stack_[i]; | 5964 object_stack_[i]->Print(os); |
5964 obj->Print(); | |
5965 } | 5965 } |
5966 PrintF("=====================================\n"); | 5966 os << "=====================================\n"; |
5967 } | 5967 } |
5968 } | 5968 } |
5969 | 5969 |
5970 | 5970 |
5971 // Triggers a depth-first traversal of reachable objects from one | 5971 // Triggers a depth-first traversal of reachable objects from one |
5972 // given root object and finds a path to a specific heap object and | 5972 // given root object and finds a path to a specific heap object and |
5973 // prints it. | 5973 // prints it. |
5974 void Heap::TracePathToObjectFrom(Object* target, Object* root) { | 5974 void Heap::TracePathToObjectFrom(Object* target, Object* root) { |
5975 PathTracer tracer(target, PathTracer::FIND_ALL, VISIT_ALL); | 5975 PathTracer tracer(target, PathTracer::FIND_ALL, VISIT_ALL); |
5976 tracer.VisitPointer(&root); | 5976 tracer.VisitPointer(&root); |
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6463 static_cast<int>(object_sizes_last_time_[index])); | 6463 static_cast<int>(object_sizes_last_time_[index])); |
6464 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6464 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
6465 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6465 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
6466 | 6466 |
6467 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6467 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
6468 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6468 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
6469 ClearObjectStats(); | 6469 ClearObjectStats(); |
6470 } | 6470 } |
6471 | 6471 |
6472 } } // namespace v8::internal | 6472 } } // namespace v8::internal |
OLD | NEW |