OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 HashMap::Entry* map_entry = | 46 HashMap::Entry* map_entry = |
47 children_.Lookup(entry, CodeEntryHash(entry), true); | 47 children_.Lookup(entry, CodeEntryHash(entry), true); |
48 if (map_entry->value == NULL) { | 48 if (map_entry->value == NULL) { |
49 // New node added. | 49 // New node added. |
50 map_entry->value = new ProfileNode(entry); | 50 map_entry->value = new ProfileNode(entry); |
51 } | 51 } |
52 return reinterpret_cast<ProfileNode*>(map_entry->value); | 52 return reinterpret_cast<ProfileNode*>(map_entry->value); |
53 } | 53 } |
54 | 54 |
55 | 55 |
| 56 void ProfileNode::GetChildren(List<ProfileNode*>* children) { |
| 57 for (HashMap::Entry* p = children_.Start(); |
| 58 p != NULL; |
| 59 p = children_.Next(p)) { |
| 60 children->Add(reinterpret_cast<ProfileNode*>(p->value)); |
| 61 } |
| 62 } |
| 63 |
| 64 |
56 void ProfileNode::Print(int indent) { | 65 void ProfileNode::Print(int indent) { |
57 OS::Print("%4u %4u %*c %s\n", | 66 OS::Print("%4u %4u %*c %s\n", |
58 total_ticks_, self_ticks_, | 67 total_ticks_, self_ticks_, |
59 indent, ' ', | 68 indent, ' ', |
60 entry_ != NULL ? entry_->name() : ""); | 69 entry_ != NULL ? entry_->name() : ""); |
61 for (HashMap::Entry* p = children_.Start(); | 70 for (HashMap::Entry* p = children_.Start(); |
62 p != NULL; | 71 p != NULL; |
63 p = children_.Next(p)) { | 72 p = children_.Next(p)) { |
64 reinterpret_cast<ProfileNode*>(p->value)->Print(indent + 2); | 73 reinterpret_cast<ProfileNode*>(p->value)->Print(indent + 2); |
65 } | 74 } |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 stack_pos != stack_end; | 375 stack_pos != stack_end; |
367 ++stack_pos) { | 376 ++stack_pos) { |
368 *entry++ = code_map_.FindEntry(*stack_pos); | 377 *entry++ = code_map_.FindEntry(*stack_pos); |
369 } | 378 } |
370 | 379 |
371 profile()->AddPath(entries); | 380 profile()->AddPath(entries); |
372 } | 381 } |
373 | 382 |
374 | 383 |
375 } } // namespace v8::internal | 384 } } // namespace v8::internal |
OLD | NEW |