| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
| 2 // | 2 // |
| 3 // Tests of profiles generator and utilities. | 3 // Tests of profiles generator and utilities. |
| 4 | 4 |
| 5 #ifdef ENABLE_CPP_PROFILES_PROCESSOR | 5 #ifdef ENABLE_CPP_PROFILES_PROCESSOR |
| 6 | 6 |
| 7 #include "v8.h" | 7 #include "v8.h" |
| 8 #include "cpu-profiler-inl.h" | 8 #include "cpu-profiler-inl.h" |
| 9 #include "cctest.h" | 9 #include "cctest.h" |
| 10 | 10 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 | 103 |
| 104 // Check the state of profile generator. | 104 // Check the state of profile generator. |
| 105 CodeEntry* entry1 = generator.code_map()->FindEntry(ToAddress(0x1000)); | 105 CodeEntry* entry1 = generator.code_map()->FindEntry(ToAddress(0x1000)); |
| 106 CHECK_NE(NULL, entry1); | 106 CHECK_NE(NULL, entry1); |
| 107 CHECK_EQ(aaa_str, entry1->name()); | 107 CHECK_EQ(aaa_str, entry1->name()); |
| 108 CodeEntry* entry2 = generator.code_map()->FindEntry(ToAddress(0x1200)); | 108 CodeEntry* entry2 = generator.code_map()->FindEntry(ToAddress(0x1200)); |
| 109 CHECK_NE(NULL, entry2); | 109 CHECK_NE(NULL, entry2); |
| 110 CHECK_EQ("bbb", entry2->name()); | 110 CHECK_EQ("bbb", entry2->name()); |
| 111 CodeEntry* entry3 = generator.code_map()->FindEntry(ToAddress(0x1300)); | 111 CodeEntry* entry3 = generator.code_map()->FindEntry(ToAddress(0x1300)); |
| 112 CHECK_NE(NULL, entry3); | 112 CHECK_NE(NULL, entry3); |
| 113 CHECK_EQ("args_count: 5", entry3->name()); | 113 CHECK_EQ("5", entry3->name()); |
| 114 CHECK_EQ(NULL, generator.code_map()->FindEntry(ToAddress(0x1400))); | 114 CHECK_EQ(NULL, generator.code_map()->FindEntry(ToAddress(0x1400))); |
| 115 CodeEntry* entry4 = generator.code_map()->FindEntry(ToAddress(0x1500)); | 115 CodeEntry* entry4 = generator.code_map()->FindEntry(ToAddress(0x1500)); |
| 116 CHECK_NE(NULL, entry4); | 116 CHECK_NE(NULL, entry4); |
| 117 CHECK_EQ("ddd", entry4->name()); | 117 CHECK_EQ("ddd", entry4->name()); |
| 118 CHECK_EQ(NULL, generator.code_map()->FindEntry(ToAddress(0x1600))); | 118 CHECK_EQ(NULL, generator.code_map()->FindEntry(ToAddress(0x1600))); |
| 119 CodeEntry* entry5 = generator.code_map()->FindEntry(ToAddress(0x1700)); | 119 CodeEntry* entry5 = generator.code_map()->FindEntry(ToAddress(0x1700)); |
| 120 CHECK_NE(NULL, entry5); | 120 CHECK_NE(NULL, entry5); |
| 121 CHECK_EQ(aaa_str, entry5->name()); | 121 CHECK_EQ(aaa_str, entry5->name()); |
| 122 } | 122 } |
| 123 | 123 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 CHECK_NE(NULL, profile); | 159 CHECK_NE(NULL, profile); |
| 160 | 160 |
| 161 // Check call trees. | 161 // Check call trees. |
| 162 const i::List<ProfileNode*>* top_down_root_children = | 162 const i::List<ProfileNode*>* top_down_root_children = |
| 163 profile->top_down()->root()->children(); | 163 profile->top_down()->root()->children(); |
| 164 CHECK_EQ(1, top_down_root_children->length()); | 164 CHECK_EQ(1, top_down_root_children->length()); |
| 165 CHECK_EQ("bbb", top_down_root_children->last()->entry()->name()); | 165 CHECK_EQ("bbb", top_down_root_children->last()->entry()->name()); |
| 166 const i::List<ProfileNode*>* top_down_bbb_children = | 166 const i::List<ProfileNode*>* top_down_bbb_children = |
| 167 top_down_root_children->last()->children(); | 167 top_down_root_children->last()->children(); |
| 168 CHECK_EQ(1, top_down_bbb_children->length()); | 168 CHECK_EQ(1, top_down_bbb_children->length()); |
| 169 CHECK_EQ("args_count: 5", top_down_bbb_children->last()->entry()->name()); | 169 CHECK_EQ("5", top_down_bbb_children->last()->entry()->name()); |
| 170 const i::List<ProfileNode*>* top_down_stub_children = | 170 const i::List<ProfileNode*>* top_down_stub_children = |
| 171 top_down_bbb_children->last()->children(); | 171 top_down_bbb_children->last()->children(); |
| 172 CHECK_EQ(1, top_down_stub_children->length()); | 172 CHECK_EQ(1, top_down_stub_children->length()); |
| 173 CHECK_EQ("ddd", top_down_stub_children->last()->entry()->name()); | 173 CHECK_EQ("ddd", top_down_stub_children->last()->entry()->name()); |
| 174 const i::List<ProfileNode*>* top_down_ddd_children = | 174 const i::List<ProfileNode*>* top_down_ddd_children = |
| 175 top_down_stub_children->last()->children(); | 175 top_down_stub_children->last()->children(); |
| 176 CHECK_EQ(0, top_down_ddd_children->length()); | 176 CHECK_EQ(0, top_down_ddd_children->length()); |
| 177 | 177 |
| 178 const i::List<ProfileNode*>* bottom_up_root_children_unsorted = | 178 const i::List<ProfileNode*>* bottom_up_root_children_unsorted = |
| 179 profile->bottom_up()->root()->children(); | 179 profile->bottom_up()->root()->children(); |
| 180 CHECK_EQ(3, bottom_up_root_children_unsorted->length()); | 180 CHECK_EQ(3, bottom_up_root_children_unsorted->length()); |
| 181 i::List<ProfileNode*> bottom_up_root_children(3); | 181 i::List<ProfileNode*> bottom_up_root_children(3); |
| 182 bottom_up_root_children.AddAll(*bottom_up_root_children_unsorted); | 182 bottom_up_root_children.AddAll(*bottom_up_root_children_unsorted); |
| 183 bottom_up_root_children.Sort(&CompareProfileNodes); | 183 bottom_up_root_children.Sort(&CompareProfileNodes); |
| 184 CHECK_EQ("args_count: 5", bottom_up_root_children[0]->entry()->name()); | 184 CHECK_EQ("5", bottom_up_root_children[0]->entry()->name()); |
| 185 CHECK_EQ("bbb", bottom_up_root_children[1]->entry()->name()); | 185 CHECK_EQ("bbb", bottom_up_root_children[1]->entry()->name()); |
| 186 CHECK_EQ("ddd", bottom_up_root_children[2]->entry()->name()); | 186 CHECK_EQ("ddd", bottom_up_root_children[2]->entry()->name()); |
| 187 const i::List<ProfileNode*>* bottom_up_stub_children = | 187 const i::List<ProfileNode*>* bottom_up_stub_children = |
| 188 bottom_up_root_children[0]->children(); | 188 bottom_up_root_children[0]->children(); |
| 189 CHECK_EQ(1, bottom_up_stub_children->length()); | 189 CHECK_EQ(1, bottom_up_stub_children->length()); |
| 190 CHECK_EQ("bbb", bottom_up_stub_children->last()->entry()->name()); | 190 CHECK_EQ("bbb", bottom_up_stub_children->last()->entry()->name()); |
| 191 const i::List<ProfileNode*>* bottom_up_bbb_children = | 191 const i::List<ProfileNode*>* bottom_up_bbb_children = |
| 192 bottom_up_root_children[1]->children(); | 192 bottom_up_root_children[1]->children(); |
| 193 CHECK_EQ(0, bottom_up_bbb_children->length()); | 193 CHECK_EQ(0, bottom_up_bbb_children->length()); |
| 194 const i::List<ProfileNode*>* bottom_up_ddd_children = | 194 const i::List<ProfileNode*>* bottom_up_ddd_children = |
| 195 bottom_up_root_children[2]->children(); | 195 bottom_up_root_children[2]->children(); |
| 196 CHECK_EQ(1, bottom_up_ddd_children->length()); | 196 CHECK_EQ(1, bottom_up_ddd_children->length()); |
| 197 CHECK_EQ("args_count: 5", bottom_up_ddd_children->last()->entry()->name()); | 197 CHECK_EQ("5", bottom_up_ddd_children->last()->entry()->name()); |
| 198 const i::List<ProfileNode*>* bottom_up_ddd_stub_children = | 198 const i::List<ProfileNode*>* bottom_up_ddd_stub_children = |
| 199 bottom_up_ddd_children->last()->children(); | 199 bottom_up_ddd_children->last()->children(); |
| 200 CHECK_EQ(1, bottom_up_ddd_stub_children->length()); | 200 CHECK_EQ(1, bottom_up_ddd_stub_children->length()); |
| 201 CHECK_EQ("bbb", bottom_up_ddd_stub_children->last()->entry()->name()); | 201 CHECK_EQ("bbb", bottom_up_ddd_stub_children->last()->entry()->name()); |
| 202 } | 202 } |
| 203 | 203 |
| 204 #endif // ENABLE_CPP_PROFILES_PROCESSOR | 204 #endif // ENABLE_CPP_PROFILES_PROCESSOR |
| OLD | NEW |