| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/allocation-tracker.h" | 7 #include "src/allocation-tracker.h" |
| 8 #include "src/frames-inl.h" | 8 #include "src/frames-inl.h" |
| 9 #include "src/heap-snapshot-generator.h" | 9 #include "src/heap-snapshot-generator.h" |
| 10 | 10 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 } | 47 } |
| 48 | 48 |
| 49 | 49 |
| 50 void AllocationTraceNode::AddAllocation(unsigned size) { | 50 void AllocationTraceNode::AddAllocation(unsigned size) { |
| 51 total_size_ += size; | 51 total_size_ += size; |
| 52 ++allocation_count_; | 52 ++allocation_count_; |
| 53 } | 53 } |
| 54 | 54 |
| 55 | 55 |
| 56 void AllocationTraceNode::Print(int indent, AllocationTracker* tracker) { | 56 void AllocationTraceNode::Print(int indent, AllocationTracker* tracker) { |
| 57 OS::Print("%10u %10u %*c", total_size_, allocation_count_, indent, ' '); | 57 base::OS::Print("%10u %10u %*c", total_size_, allocation_count_, indent, ' '); |
| 58 if (tracker != NULL) { | 58 if (tracker != NULL) { |
| 59 AllocationTracker::FunctionInfo* info = | 59 AllocationTracker::FunctionInfo* info = |
| 60 tracker->function_info_list()[function_info_index_]; | 60 tracker->function_info_list()[function_info_index_]; |
| 61 OS::Print("%s #%u", info->name, id_); | 61 base::OS::Print("%s #%u", info->name, id_); |
| 62 } else { | 62 } else { |
| 63 OS::Print("%u #%u", function_info_index_, id_); | 63 base::OS::Print("%u #%u", function_info_index_, id_); |
| 64 } | 64 } |
| 65 OS::Print("\n"); | 65 base::OS::Print("\n"); |
| 66 indent += 2; | 66 indent += 2; |
| 67 for (int i = 0; i < children_.length(); i++) { | 67 for (int i = 0; i < children_.length(); i++) { |
| 68 children_[i]->Print(indent, tracker); | 68 children_[i]->Print(indent, tracker); |
| 69 } | 69 } |
| 70 } | 70 } |
| 71 | 71 |
| 72 | 72 |
| 73 AllocationTraceTree::AllocationTraceTree() | 73 AllocationTraceTree::AllocationTraceTree() |
| 74 : next_node_id_(1), | 74 : next_node_id_(1), |
| 75 root_(this, 0) { | 75 root_(this, 0) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 86 for (unsigned* entry = path.start() + path.length() - 1; | 86 for (unsigned* entry = path.start() + path.length() - 1; |
| 87 entry != path.start() - 1; | 87 entry != path.start() - 1; |
| 88 --entry) { | 88 --entry) { |
| 89 node = node->FindOrAddChild(*entry); | 89 node = node->FindOrAddChild(*entry); |
| 90 } | 90 } |
| 91 return node; | 91 return node; |
| 92 } | 92 } |
| 93 | 93 |
| 94 | 94 |
| 95 void AllocationTraceTree::Print(AllocationTracker* tracker) { | 95 void AllocationTraceTree::Print(AllocationTracker* tracker) { |
| 96 OS::Print("[AllocationTraceTree:]\n"); | 96 base::OS::Print("[AllocationTraceTree:]\n"); |
| 97 OS::Print("Total size | Allocation count | Function id | id\n"); | 97 base::OS::Print("Total size | Allocation count | Function id | id\n"); |
| 98 root()->Print(0, tracker); | 98 root()->Print(0, tracker); |
| 99 } | 99 } |
| 100 | 100 |
| 101 | 101 |
| 102 void AllocationTracker::DeleteUnresolvedLocation( | 102 void AllocationTracker::DeleteUnresolvedLocation( |
| 103 UnresolvedLocation** location) { | 103 UnresolvedLocation** location) { |
| 104 delete *location; | 104 delete *location; |
| 105 } | 105 } |
| 106 | 106 |
| 107 | 107 |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 void AllocationTracker::UnresolvedLocation::HandleWeakScript( | 333 void AllocationTracker::UnresolvedLocation::HandleWeakScript( |
| 334 const v8::WeakCallbackData<v8::Value, void>& data) { | 334 const v8::WeakCallbackData<v8::Value, void>& data) { |
| 335 UnresolvedLocation* loc = | 335 UnresolvedLocation* loc = |
| 336 reinterpret_cast<UnresolvedLocation*>(data.GetParameter()); | 336 reinterpret_cast<UnresolvedLocation*>(data.GetParameter()); |
| 337 GlobalHandles::Destroy(reinterpret_cast<Object**>(loc->script_.location())); | 337 GlobalHandles::Destroy(reinterpret_cast<Object**>(loc->script_.location())); |
| 338 loc->script_ = Handle<Script>::null(); | 338 loc->script_ = Handle<Script>::null(); |
| 339 } | 339 } |
| 340 | 340 |
| 341 | 341 |
| 342 } } // namespace v8::internal | 342 } } // namespace v8::internal |
| OLD | NEW |