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

Side by Side Diff: test/cctest/test-profile-generator.cc

Issue 17875002: Revert "CPUProfiler: Simplify CodeEntry constructor calls." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 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/profile-generator-inl.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 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); 80 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags);
81 CHECK(i::TokenEnumeratorTester::token_removed(&te)->at(2)); 81 CHECK(i::TokenEnumeratorTester::token_removed(&te)->at(2));
82 CHECK_EQ(1, te.GetTokenId(*v8::Utils::OpenHandle(*token2))); 82 CHECK_EQ(1, te.GetTokenId(*v8::Utils::OpenHandle(*token2)));
83 CHECK_EQ(0, te.GetTokenId(*v8::Utils::OpenHandle(*token1))); 83 CHECK_EQ(0, te.GetTokenId(*v8::Utils::OpenHandle(*token1)));
84 } 84 }
85 85
86 86
87 TEST(ProfileNodeFindOrAddChild) { 87 TEST(ProfileNodeFindOrAddChild) {
88 ProfileTree tree; 88 ProfileTree tree;
89 ProfileNode node(&tree, NULL); 89 ProfileNode node(&tree, NULL);
90 CodeEntry entry1(i::Logger::FUNCTION_TAG, "", "aaa"); 90 CodeEntry entry1(i::Logger::FUNCTION_TAG, "", "aaa", "", 0,
91 TokenEnumerator::kNoSecurityToken);
91 ProfileNode* childNode1 = node.FindOrAddChild(&entry1); 92 ProfileNode* childNode1 = node.FindOrAddChild(&entry1);
92 CHECK_NE(NULL, childNode1); 93 CHECK_NE(NULL, childNode1);
93 CHECK_EQ(childNode1, node.FindOrAddChild(&entry1)); 94 CHECK_EQ(childNode1, node.FindOrAddChild(&entry1));
94 CodeEntry entry2(i::Logger::FUNCTION_TAG, "", "bbb"); 95 CodeEntry entry2(i::Logger::FUNCTION_TAG, "", "bbb", "", 0,
96 TokenEnumerator::kNoSecurityToken);
95 ProfileNode* childNode2 = node.FindOrAddChild(&entry2); 97 ProfileNode* childNode2 = node.FindOrAddChild(&entry2);
96 CHECK_NE(NULL, childNode2); 98 CHECK_NE(NULL, childNode2);
97 CHECK_NE(childNode1, childNode2); 99 CHECK_NE(childNode1, childNode2);
98 CHECK_EQ(childNode1, node.FindOrAddChild(&entry1)); 100 CHECK_EQ(childNode1, node.FindOrAddChild(&entry1));
99 CHECK_EQ(childNode2, node.FindOrAddChild(&entry2)); 101 CHECK_EQ(childNode2, node.FindOrAddChild(&entry2));
100 CodeEntry entry3(i::Logger::FUNCTION_TAG, "", "ccc"); 102 CodeEntry entry3(i::Logger::FUNCTION_TAG, "", "ccc", "", 0,
103 TokenEnumerator::kNoSecurityToken);
101 ProfileNode* childNode3 = node.FindOrAddChild(&entry3); 104 ProfileNode* childNode3 = node.FindOrAddChild(&entry3);
102 CHECK_NE(NULL, childNode3); 105 CHECK_NE(NULL, childNode3);
103 CHECK_NE(childNode1, childNode3); 106 CHECK_NE(childNode1, childNode3);
104 CHECK_NE(childNode2, childNode3); 107 CHECK_NE(childNode2, childNode3);
105 CHECK_EQ(childNode1, node.FindOrAddChild(&entry1)); 108 CHECK_EQ(childNode1, node.FindOrAddChild(&entry1));
106 CHECK_EQ(childNode2, node.FindOrAddChild(&entry2)); 109 CHECK_EQ(childNode2, node.FindOrAddChild(&entry2));
107 CHECK_EQ(childNode3, node.FindOrAddChild(&entry3)); 110 CHECK_EQ(childNode3, node.FindOrAddChild(&entry3));
108 } 111 }
109 112
110 113
111 TEST(ProfileNodeFindOrAddChildForSameFunction) { 114 TEST(ProfileNodeFindOrAddChildForSameFunction) {
112 const char* empty = ""; 115 const char* empty = "";
113 const char* aaa = "aaa"; 116 const char* aaa = "aaa";
114 ProfileTree tree; 117 ProfileTree tree;
115 ProfileNode node(&tree, NULL); 118 ProfileNode node(&tree, NULL);
116 CodeEntry entry1(i::Logger::FUNCTION_TAG, empty, aaa); 119 CodeEntry entry1(i::Logger::FUNCTION_TAG, empty, aaa, empty, 0,
120 TokenEnumerator::kNoSecurityToken);
117 ProfileNode* childNode1 = node.FindOrAddChild(&entry1); 121 ProfileNode* childNode1 = node.FindOrAddChild(&entry1);
118 CHECK_NE(NULL, childNode1); 122 CHECK_NE(NULL, childNode1);
119 CHECK_EQ(childNode1, node.FindOrAddChild(&entry1)); 123 CHECK_EQ(childNode1, node.FindOrAddChild(&entry1));
120 // The same function again. 124 // The same function again.
121 CodeEntry entry2(i::Logger::FUNCTION_TAG, empty, aaa); 125 CodeEntry entry2(i::Logger::FUNCTION_TAG, empty, aaa, empty, 0,
126 TokenEnumerator::kNoSecurityToken);
122 CHECK_EQ(childNode1, node.FindOrAddChild(&entry2)); 127 CHECK_EQ(childNode1, node.FindOrAddChild(&entry2));
123 // Now with a different security token. 128 // Now with a different security token.
124 CodeEntry entry3(i::Logger::FUNCTION_TAG, empty, aaa, 129 CodeEntry entry3(i::Logger::FUNCTION_TAG, empty, aaa, empty, 0,
125 TokenEnumerator::kNoSecurityToken + 1); 130 TokenEnumerator::kNoSecurityToken + 1);
126 CHECK_EQ(childNode1, node.FindOrAddChild(&entry3)); 131 CHECK_EQ(childNode1, node.FindOrAddChild(&entry3));
127 } 132 }
128 133
129 134
130 namespace { 135 namespace {
131 136
132 class ProfileTreeTestHelper { 137 class ProfileTreeTestHelper {
133 public: 138 public:
134 explicit ProfileTreeTestHelper(const ProfileTree* tree) 139 explicit ProfileTreeTestHelper(const ProfileTree* tree)
(...skipping 15 matching lines...) Expand all
150 return node; 155 return node;
151 } 156 }
152 157
153 private: 158 private:
154 const ProfileTree* tree_; 159 const ProfileTree* tree_;
155 }; 160 };
156 161
157 } // namespace 162 } // namespace
158 163
159 TEST(ProfileTreeAddPathFromStart) { 164 TEST(ProfileTreeAddPathFromStart) {
160 CodeEntry entry1(i::Logger::FUNCTION_TAG, "", "aaa"); 165 CodeEntry entry1(i::Logger::FUNCTION_TAG, "", "aaa", "", 0,
161 CodeEntry entry2(i::Logger::FUNCTION_TAG, "", "bbb"); 166 TokenEnumerator::kNoSecurityToken);
162 CodeEntry entry3(i::Logger::FUNCTION_TAG, "", "ccc"); 167 CodeEntry entry2(i::Logger::FUNCTION_TAG, "", "bbb", "", 0,
168 TokenEnumerator::kNoSecurityToken);
169 CodeEntry entry3(i::Logger::FUNCTION_TAG, "", "ccc", "", 0,
170 TokenEnumerator::kNoSecurityToken);
163 ProfileTree tree; 171 ProfileTree tree;
164 ProfileTreeTestHelper helper(&tree); 172 ProfileTreeTestHelper helper(&tree);
165 CHECK_EQ(NULL, helper.Walk(&entry1)); 173 CHECK_EQ(NULL, helper.Walk(&entry1));
166 CHECK_EQ(NULL, helper.Walk(&entry2)); 174 CHECK_EQ(NULL, helper.Walk(&entry2));
167 CHECK_EQ(NULL, helper.Walk(&entry3)); 175 CHECK_EQ(NULL, helper.Walk(&entry3));
168 176
169 CodeEntry* path[] = {NULL, &entry1, NULL, &entry2, NULL, NULL, &entry3, NULL}; 177 CodeEntry* path[] = {NULL, &entry1, NULL, &entry2, NULL, NULL, &entry3, NULL};
170 Vector<CodeEntry*> path_vec(path, sizeof(path) / sizeof(path[0])); 178 Vector<CodeEntry*> path_vec(path, sizeof(path) / sizeof(path[0]));
171 tree.AddPathFromStart(path_vec); 179 tree.AddPathFromStart(path_vec);
172 CHECK_EQ(NULL, helper.Walk(&entry2)); 180 CHECK_EQ(NULL, helper.Walk(&entry2));
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 CHECK_EQ(2, node3->self_ticks()); 225 CHECK_EQ(2, node3->self_ticks());
218 ProfileNode* node4 = helper.Walk(&entry1, &entry2, &entry2); 226 ProfileNode* node4 = helper.Walk(&entry1, &entry2, &entry2);
219 CHECK_NE(NULL, node4); 227 CHECK_NE(NULL, node4);
220 CHECK_NE(node3, node4); 228 CHECK_NE(node3, node4);
221 CHECK_EQ(0, node4->total_ticks()); 229 CHECK_EQ(0, node4->total_ticks());
222 CHECK_EQ(1, node4->self_ticks()); 230 CHECK_EQ(1, node4->self_ticks());
223 } 231 }
224 232
225 233
226 TEST(ProfileTreeAddPathFromEnd) { 234 TEST(ProfileTreeAddPathFromEnd) {
227 CodeEntry entry1(i::Logger::FUNCTION_TAG, "", "aaa"); 235 CodeEntry entry1(i::Logger::FUNCTION_TAG, "", "aaa", "", 0,
228 CodeEntry entry2(i::Logger::FUNCTION_TAG, "", "bbb"); 236 TokenEnumerator::kNoSecurityToken);
229 CodeEntry entry3(i::Logger::FUNCTION_TAG, "", "ccc"); 237 CodeEntry entry2(i::Logger::FUNCTION_TAG, "", "bbb", "", 0,
238 TokenEnumerator::kNoSecurityToken);
239 CodeEntry entry3(i::Logger::FUNCTION_TAG, "", "ccc", "", 0,
240 TokenEnumerator::kNoSecurityToken);
230 ProfileTree tree; 241 ProfileTree tree;
231 ProfileTreeTestHelper helper(&tree); 242 ProfileTreeTestHelper helper(&tree);
232 CHECK_EQ(NULL, helper.Walk(&entry1)); 243 CHECK_EQ(NULL, helper.Walk(&entry1));
233 CHECK_EQ(NULL, helper.Walk(&entry2)); 244 CHECK_EQ(NULL, helper.Walk(&entry2));
234 CHECK_EQ(NULL, helper.Walk(&entry3)); 245 CHECK_EQ(NULL, helper.Walk(&entry3));
235 246
236 CodeEntry* path[] = {NULL, &entry3, NULL, &entry2, NULL, NULL, &entry1, NULL}; 247 CodeEntry* path[] = {NULL, &entry3, NULL, &entry2, NULL, NULL, &entry1, NULL};
237 Vector<CodeEntry*> path_vec(path, sizeof(path) / sizeof(path[0])); 248 Vector<CodeEntry*> path_vec(path, sizeof(path) / sizeof(path[0]));
238 tree.AddPathFromEnd(path_vec); 249 tree.AddPathFromEnd(path_vec);
239 CHECK_EQ(NULL, helper.Walk(&entry2)); 250 CHECK_EQ(NULL, helper.Walk(&entry2));
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 empty_tree.CalculateTotalTicks(); 308 empty_tree.CalculateTotalTicks();
298 CHECK_EQ(0, empty_tree.root()->total_ticks()); 309 CHECK_EQ(0, empty_tree.root()->total_ticks());
299 CHECK_EQ(0, empty_tree.root()->self_ticks()); 310 CHECK_EQ(0, empty_tree.root()->self_ticks());
300 empty_tree.root()->IncrementSelfTicks(); 311 empty_tree.root()->IncrementSelfTicks();
301 CHECK_EQ(0, empty_tree.root()->total_ticks()); 312 CHECK_EQ(0, empty_tree.root()->total_ticks());
302 CHECK_EQ(1, empty_tree.root()->self_ticks()); 313 CHECK_EQ(1, empty_tree.root()->self_ticks());
303 empty_tree.CalculateTotalTicks(); 314 empty_tree.CalculateTotalTicks();
304 CHECK_EQ(1, empty_tree.root()->total_ticks()); 315 CHECK_EQ(1, empty_tree.root()->total_ticks());
305 CHECK_EQ(1, empty_tree.root()->self_ticks()); 316 CHECK_EQ(1, empty_tree.root()->self_ticks());
306 317
307 CodeEntry entry1(i::Logger::FUNCTION_TAG, "", "aaa"); 318 CodeEntry entry1(i::Logger::FUNCTION_TAG, "", "aaa", "", 0,
319 TokenEnumerator::kNoSecurityToken);
308 CodeEntry* e1_path[] = {&entry1}; 320 CodeEntry* e1_path[] = {&entry1};
309 Vector<CodeEntry*> e1_path_vec( 321 Vector<CodeEntry*> e1_path_vec(
310 e1_path, sizeof(e1_path) / sizeof(e1_path[0])); 322 e1_path, sizeof(e1_path) / sizeof(e1_path[0]));
311 323
312 ProfileTree single_child_tree; 324 ProfileTree single_child_tree;
313 single_child_tree.AddPathFromStart(e1_path_vec); 325 single_child_tree.AddPathFromStart(e1_path_vec);
314 single_child_tree.root()->IncrementSelfTicks(); 326 single_child_tree.root()->IncrementSelfTicks();
315 CHECK_EQ(0, single_child_tree.root()->total_ticks()); 327 CHECK_EQ(0, single_child_tree.root()->total_ticks());
316 CHECK_EQ(1, single_child_tree.root()->self_ticks()); 328 CHECK_EQ(1, single_child_tree.root()->self_ticks());
317 ProfileTreeTestHelper single_child_helper(&single_child_tree); 329 ProfileTreeTestHelper single_child_helper(&single_child_tree);
318 ProfileNode* node1 = single_child_helper.Walk(&entry1); 330 ProfileNode* node1 = single_child_helper.Walk(&entry1);
319 CHECK_NE(NULL, node1); 331 CHECK_NE(NULL, node1);
320 CHECK_EQ(0, node1->total_ticks()); 332 CHECK_EQ(0, node1->total_ticks());
321 CHECK_EQ(1, node1->self_ticks()); 333 CHECK_EQ(1, node1->self_ticks());
322 single_child_tree.CalculateTotalTicks(); 334 single_child_tree.CalculateTotalTicks();
323 CHECK_EQ(2, single_child_tree.root()->total_ticks()); 335 CHECK_EQ(2, single_child_tree.root()->total_ticks());
324 CHECK_EQ(1, single_child_tree.root()->self_ticks()); 336 CHECK_EQ(1, single_child_tree.root()->self_ticks());
325 CHECK_EQ(1, node1->total_ticks()); 337 CHECK_EQ(1, node1->total_ticks());
326 CHECK_EQ(1, node1->self_ticks()); 338 CHECK_EQ(1, node1->self_ticks());
327 339
328 CodeEntry entry2(i::Logger::FUNCTION_TAG, "", "bbb"); 340 CodeEntry entry2(i::Logger::FUNCTION_TAG, "", "bbb", "", 0,
341 TokenEnumerator::kNoSecurityToken);
329 CodeEntry* e1_e2_path[] = {&entry1, &entry2}; 342 CodeEntry* e1_e2_path[] = {&entry1, &entry2};
330 Vector<CodeEntry*> e1_e2_path_vec( 343 Vector<CodeEntry*> e1_e2_path_vec(
331 e1_e2_path, sizeof(e1_e2_path) / sizeof(e1_e2_path[0])); 344 e1_e2_path, sizeof(e1_e2_path) / sizeof(e1_e2_path[0]));
332 345
333 ProfileTree flat_tree; 346 ProfileTree flat_tree;
334 ProfileTreeTestHelper flat_helper(&flat_tree); 347 ProfileTreeTestHelper flat_helper(&flat_tree);
335 flat_tree.AddPathFromStart(e1_path_vec); 348 flat_tree.AddPathFromStart(e1_path_vec);
336 flat_tree.AddPathFromStart(e1_path_vec); 349 flat_tree.AddPathFromStart(e1_path_vec);
337 flat_tree.AddPathFromStart(e1_e2_path_vec); 350 flat_tree.AddPathFromStart(e1_e2_path_vec);
338 flat_tree.AddPathFromStart(e1_e2_path_vec); 351 flat_tree.AddPathFromStart(e1_e2_path_vec);
(...skipping 14 matching lines...) Expand all
353 CHECK_EQ(5, flat_tree.root()->total_ticks()); 366 CHECK_EQ(5, flat_tree.root()->total_ticks());
354 CHECK_EQ(0, flat_tree.root()->self_ticks()); 367 CHECK_EQ(0, flat_tree.root()->self_ticks());
355 CHECK_EQ(5, node1->total_ticks()); 368 CHECK_EQ(5, node1->total_ticks());
356 CHECK_EQ(2, node1->self_ticks()); 369 CHECK_EQ(2, node1->self_ticks());
357 CHECK_EQ(3, node2->total_ticks()); 370 CHECK_EQ(3, node2->total_ticks());
358 CHECK_EQ(3, node2->self_ticks()); 371 CHECK_EQ(3, node2->self_ticks());
359 372
360 CodeEntry* e2_path[] = {&entry2}; 373 CodeEntry* e2_path[] = {&entry2};
361 Vector<CodeEntry*> e2_path_vec( 374 Vector<CodeEntry*> e2_path_vec(
362 e2_path, sizeof(e2_path) / sizeof(e2_path[0])); 375 e2_path, sizeof(e2_path) / sizeof(e2_path[0]));
363 CodeEntry entry3(i::Logger::FUNCTION_TAG, "", "ccc"); 376 CodeEntry entry3(i::Logger::FUNCTION_TAG, "", "ccc", "", 0,
377 TokenEnumerator::kNoSecurityToken);
364 CodeEntry* e3_path[] = {&entry3}; 378 CodeEntry* e3_path[] = {&entry3};
365 Vector<CodeEntry*> e3_path_vec( 379 Vector<CodeEntry*> e3_path_vec(
366 e3_path, sizeof(e3_path) / sizeof(e3_path[0])); 380 e3_path, sizeof(e3_path) / sizeof(e3_path[0]));
367 381
368 ProfileTree wide_tree; 382 ProfileTree wide_tree;
369 ProfileTreeTestHelper wide_helper(&wide_tree); 383 ProfileTreeTestHelper wide_helper(&wide_tree);
370 wide_tree.AddPathFromStart(e1_path_vec); 384 wide_tree.AddPathFromStart(e1_path_vec);
371 wide_tree.AddPathFromStart(e1_path_vec); 385 wide_tree.AddPathFromStart(e1_path_vec);
372 wide_tree.AddPathFromStart(e1_e2_path_vec); 386 wide_tree.AddPathFromStart(e1_e2_path_vec);
373 wide_tree.AddPathFromStart(e2_path_vec); 387 wide_tree.AddPathFromStart(e2_path_vec);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 CHECK_EQ(3, node2->total_ticks()); 425 CHECK_EQ(3, node2->total_ticks());
412 CHECK_EQ(3, node2->self_ticks()); 426 CHECK_EQ(3, node2->self_ticks());
413 CHECK_EQ(4, node3->total_ticks()); 427 CHECK_EQ(4, node3->total_ticks());
414 CHECK_EQ(4, node3->self_ticks()); 428 CHECK_EQ(4, node3->self_ticks());
415 } 429 }
416 430
417 431
418 TEST(ProfileTreeFilteredClone) { 432 TEST(ProfileTreeFilteredClone) {
419 ProfileTree source_tree; 433 ProfileTree source_tree;
420 const int token0 = 0, token1 = 1, token2 = 2; 434 const int token0 = 0, token1 = 1, token2 = 2;
421 CodeEntry entry1(i::Logger::FUNCTION_TAG, "", "aaa", token0); 435 CodeEntry entry1(i::Logger::FUNCTION_TAG, "", "aaa", "", 0, token0);
422 CodeEntry entry2(i::Logger::FUNCTION_TAG, "", "bbb", token1); 436 CodeEntry entry2(i::Logger::FUNCTION_TAG, "", "bbb", "", 0, token1);
423 CodeEntry entry3(i::Logger::FUNCTION_TAG, "", "ccc", token0); 437 CodeEntry entry3(i::Logger::FUNCTION_TAG, "", "ccc", "", 0, token0);
424 CodeEntry entry4(i::Logger::FUNCTION_TAG, "", "ddd", 438 CodeEntry entry4(
425 TokenEnumerator::kInheritsSecurityToken); 439 i::Logger::FUNCTION_TAG, "", "ddd", "", 0,
440 TokenEnumerator::kInheritsSecurityToken);
426 441
427 { 442 {
428 CodeEntry* e1_e2_path[] = {&entry1, &entry2}; 443 CodeEntry* e1_e2_path[] = {&entry1, &entry2};
429 Vector<CodeEntry*> e1_e2_path_vec( 444 Vector<CodeEntry*> e1_e2_path_vec(
430 e1_e2_path, sizeof(e1_e2_path) / sizeof(e1_e2_path[0])); 445 e1_e2_path, sizeof(e1_e2_path) / sizeof(e1_e2_path[0]));
431 source_tree.AddPathFromStart(e1_e2_path_vec); 446 source_tree.AddPathFromStart(e1_e2_path_vec);
432 CodeEntry* e2_e4_path[] = {&entry2, &entry4}; 447 CodeEntry* e2_e4_path[] = {&entry2, &entry4};
433 Vector<CodeEntry*> e2_e4_path_vec( 448 Vector<CodeEntry*> e2_e4_path_vec(
434 e2_e4_path, sizeof(e2_e4_path) / sizeof(e2_e4_path[0])); 449 e2_e4_path, sizeof(e2_e4_path) / sizeof(e2_e4_path[0]));
435 source_tree.AddPathFromStart(e2_e4_path_vec); 450 source_tree.AddPathFromStart(e2_e4_path_vec);
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 } 527 }
513 } 528 }
514 529
515 530
516 static inline i::Address ToAddress(int n) { 531 static inline i::Address ToAddress(int n) {
517 return reinterpret_cast<i::Address>(n); 532 return reinterpret_cast<i::Address>(n);
518 } 533 }
519 534
520 TEST(CodeMapAddCode) { 535 TEST(CodeMapAddCode) {
521 CodeMap code_map; 536 CodeMap code_map;
522 CodeEntry entry1(i::Logger::FUNCTION_TAG, "", "aaa"); 537 CodeEntry entry1(i::Logger::FUNCTION_TAG, "", "aaa", "", 0,
523 CodeEntry entry2(i::Logger::FUNCTION_TAG, "", "bbb"); 538 TokenEnumerator::kNoSecurityToken);
524 CodeEntry entry3(i::Logger::FUNCTION_TAG, "", "ccc"); 539 CodeEntry entry2(i::Logger::FUNCTION_TAG, "", "bbb", "", 0,
525 CodeEntry entry4(i::Logger::FUNCTION_TAG, "", "ddd"); 540 TokenEnumerator::kNoSecurityToken);
541 CodeEntry entry3(i::Logger::FUNCTION_TAG, "", "ccc", "", 0,
542 TokenEnumerator::kNoSecurityToken);
543 CodeEntry entry4(i::Logger::FUNCTION_TAG, "", "ddd", "", 0,
544 TokenEnumerator::kNoSecurityToken);
526 code_map.AddCode(ToAddress(0x1500), &entry1, 0x200); 545 code_map.AddCode(ToAddress(0x1500), &entry1, 0x200);
527 code_map.AddCode(ToAddress(0x1700), &entry2, 0x100); 546 code_map.AddCode(ToAddress(0x1700), &entry2, 0x100);
528 code_map.AddCode(ToAddress(0x1900), &entry3, 0x50); 547 code_map.AddCode(ToAddress(0x1900), &entry3, 0x50);
529 code_map.AddCode(ToAddress(0x1950), &entry4, 0x10); 548 code_map.AddCode(ToAddress(0x1950), &entry4, 0x10);
530 CHECK_EQ(NULL, code_map.FindEntry(0)); 549 CHECK_EQ(NULL, code_map.FindEntry(0));
531 CHECK_EQ(NULL, code_map.FindEntry(ToAddress(0x1500 - 1))); 550 CHECK_EQ(NULL, code_map.FindEntry(ToAddress(0x1500 - 1)));
532 CHECK_EQ(&entry1, code_map.FindEntry(ToAddress(0x1500))); 551 CHECK_EQ(&entry1, code_map.FindEntry(ToAddress(0x1500)));
533 CHECK_EQ(&entry1, code_map.FindEntry(ToAddress(0x1500 + 0x100))); 552 CHECK_EQ(&entry1, code_map.FindEntry(ToAddress(0x1500 + 0x100)));
534 CHECK_EQ(&entry1, code_map.FindEntry(ToAddress(0x1500 + 0x200 - 1))); 553 CHECK_EQ(&entry1, code_map.FindEntry(ToAddress(0x1500 + 0x200 - 1)));
535 CHECK_EQ(&entry2, code_map.FindEntry(ToAddress(0x1700))); 554 CHECK_EQ(&entry2, code_map.FindEntry(ToAddress(0x1700)));
536 CHECK_EQ(&entry2, code_map.FindEntry(ToAddress(0x1700 + 0x50))); 555 CHECK_EQ(&entry2, code_map.FindEntry(ToAddress(0x1700 + 0x50)));
537 CHECK_EQ(&entry2, code_map.FindEntry(ToAddress(0x1700 + 0x100 - 1))); 556 CHECK_EQ(&entry2, code_map.FindEntry(ToAddress(0x1700 + 0x100 - 1)));
538 CHECK_EQ(NULL, code_map.FindEntry(ToAddress(0x1700 + 0x100))); 557 CHECK_EQ(NULL, code_map.FindEntry(ToAddress(0x1700 + 0x100)));
539 CHECK_EQ(NULL, code_map.FindEntry(ToAddress(0x1900 - 1))); 558 CHECK_EQ(NULL, code_map.FindEntry(ToAddress(0x1900 - 1)));
540 CHECK_EQ(&entry3, code_map.FindEntry(ToAddress(0x1900))); 559 CHECK_EQ(&entry3, code_map.FindEntry(ToAddress(0x1900)));
541 CHECK_EQ(&entry3, code_map.FindEntry(ToAddress(0x1900 + 0x28))); 560 CHECK_EQ(&entry3, code_map.FindEntry(ToAddress(0x1900 + 0x28)));
542 CHECK_EQ(&entry4, code_map.FindEntry(ToAddress(0x1950))); 561 CHECK_EQ(&entry4, code_map.FindEntry(ToAddress(0x1950)));
543 CHECK_EQ(&entry4, code_map.FindEntry(ToAddress(0x1950 + 0x7))); 562 CHECK_EQ(&entry4, code_map.FindEntry(ToAddress(0x1950 + 0x7)));
544 CHECK_EQ(&entry4, code_map.FindEntry(ToAddress(0x1950 + 0x10 - 1))); 563 CHECK_EQ(&entry4, code_map.FindEntry(ToAddress(0x1950 + 0x10 - 1)));
545 CHECK_EQ(NULL, code_map.FindEntry(ToAddress(0x1950 + 0x10))); 564 CHECK_EQ(NULL, code_map.FindEntry(ToAddress(0x1950 + 0x10)));
546 CHECK_EQ(NULL, code_map.FindEntry(ToAddress(0xFFFFFFFF))); 565 CHECK_EQ(NULL, code_map.FindEntry(ToAddress(0xFFFFFFFF)));
547 } 566 }
548 567
549 568
550 TEST(CodeMapMoveAndDeleteCode) { 569 TEST(CodeMapMoveAndDeleteCode) {
551 CodeMap code_map; 570 CodeMap code_map;
552 CodeEntry entry1(i::Logger::FUNCTION_TAG, "", "aaa"); 571 CodeEntry entry1(i::Logger::FUNCTION_TAG, "", "aaa", "", 0,
553 CodeEntry entry2(i::Logger::FUNCTION_TAG, "", "bbb"); 572 TokenEnumerator::kNoSecurityToken);
573 CodeEntry entry2(i::Logger::FUNCTION_TAG, "", "bbb", "", 0,
574 TokenEnumerator::kNoSecurityToken);
554 code_map.AddCode(ToAddress(0x1500), &entry1, 0x200); 575 code_map.AddCode(ToAddress(0x1500), &entry1, 0x200);
555 code_map.AddCode(ToAddress(0x1700), &entry2, 0x100); 576 code_map.AddCode(ToAddress(0x1700), &entry2, 0x100);
556 CHECK_EQ(&entry1, code_map.FindEntry(ToAddress(0x1500))); 577 CHECK_EQ(&entry1, code_map.FindEntry(ToAddress(0x1500)));
557 CHECK_EQ(&entry2, code_map.FindEntry(ToAddress(0x1700))); 578 CHECK_EQ(&entry2, code_map.FindEntry(ToAddress(0x1700)));
558 code_map.MoveCode(ToAddress(0x1500), ToAddress(0x1700)); // Deprecate bbb. 579 code_map.MoveCode(ToAddress(0x1500), ToAddress(0x1700)); // Deprecate bbb.
559 CHECK_EQ(NULL, code_map.FindEntry(ToAddress(0x1500))); 580 CHECK_EQ(NULL, code_map.FindEntry(ToAddress(0x1500)));
560 CHECK_EQ(&entry1, code_map.FindEntry(ToAddress(0x1700))); 581 CHECK_EQ(&entry1, code_map.FindEntry(ToAddress(0x1700)));
561 CodeEntry entry3(i::Logger::FUNCTION_TAG, "", "ccc"); 582 CodeEntry entry3(i::Logger::FUNCTION_TAG, "", "ccc", "", 0,
583 TokenEnumerator::kNoSecurityToken);
562 code_map.AddCode(ToAddress(0x1750), &entry3, 0x100); 584 code_map.AddCode(ToAddress(0x1750), &entry3, 0x100);
563 CHECK_EQ(NULL, code_map.FindEntry(ToAddress(0x1700))); 585 CHECK_EQ(NULL, code_map.FindEntry(ToAddress(0x1700)));
564 CHECK_EQ(&entry3, code_map.FindEntry(ToAddress(0x1750))); 586 CHECK_EQ(&entry3, code_map.FindEntry(ToAddress(0x1750)));
565 } 587 }
566 588
567 589
568 namespace { 590 namespace {
569 591
570 class TestSetup { 592 class TestSetup {
571 public: 593 public:
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
899 i::OS::SNPrintF(title, "%d", i); 921 i::OS::SNPrintF(title, "%d", i);
900 // UID must be > 0. 922 // UID must be > 0.
901 CHECK(collection.StartProfiling(title.start(), i + 1, false)); 923 CHECK(collection.StartProfiling(title.start(), i + 1, false));
902 titles[i] = title.start(); 924 titles[i] = title.start();
903 } 925 }
904 CHECK(!collection.StartProfiling( 926 CHECK(!collection.StartProfiling(
905 "maximum", CpuProfilesCollection::kMaxSimultaneousProfiles + 1, false)); 927 "maximum", CpuProfilesCollection::kMaxSimultaneousProfiles + 1, false));
906 for (int i = 0; i < CpuProfilesCollection::kMaxSimultaneousProfiles; ++i) 928 for (int i = 0; i < CpuProfilesCollection::kMaxSimultaneousProfiles; ++i)
907 i::DeleteArray(titles[i]); 929 i::DeleteArray(titles[i]);
908 } 930 }
OLDNEW
« no previous file with comments | « src/profile-generator-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698