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

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

Issue 24169005: remove HEAP from tests (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 3 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 | « test/cctest/test-object-observe.cc ('k') | test/cctest/test-serialize.cc » ('j') | 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 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 } 392 }
393 393
394 private: 394 private:
395 bool old_flag_prof_browser_mode_; 395 bool old_flag_prof_browser_mode_;
396 }; 396 };
397 397
398 } // namespace 398 } // namespace
399 399
400 TEST(RecordTickSample) { 400 TEST(RecordTickSample) {
401 TestSetup test_setup; 401 TestSetup test_setup;
402 CpuProfilesCollection profiles(CcTest::i_isolate()->heap()); 402 CpuProfilesCollection profiles(CcTest::heap());
403 profiles.StartProfiling("", 1, false); 403 profiles.StartProfiling("", 1, false);
404 ProfileGenerator generator(&profiles); 404 ProfileGenerator generator(&profiles);
405 CodeEntry* entry1 = profiles.NewCodeEntry(i::Logger::FUNCTION_TAG, "aaa"); 405 CodeEntry* entry1 = profiles.NewCodeEntry(i::Logger::FUNCTION_TAG, "aaa");
406 CodeEntry* entry2 = profiles.NewCodeEntry(i::Logger::FUNCTION_TAG, "bbb"); 406 CodeEntry* entry2 = profiles.NewCodeEntry(i::Logger::FUNCTION_TAG, "bbb");
407 CodeEntry* entry3 = profiles.NewCodeEntry(i::Logger::FUNCTION_TAG, "ccc"); 407 CodeEntry* entry3 = profiles.NewCodeEntry(i::Logger::FUNCTION_TAG, "ccc");
408 generator.code_map()->AddCode(ToAddress(0x1500), entry1, 0x200); 408 generator.code_map()->AddCode(ToAddress(0x1500), entry1, 0x200);
409 generator.code_map()->AddCode(ToAddress(0x1700), entry2, 0x100); 409 generator.code_map()->AddCode(ToAddress(0x1700), entry2, 0x100);
410 generator.code_map()->AddCode(ToAddress(0x1900), entry3, 0x50); 410 generator.code_map()->AddCode(ToAddress(0x1900), entry3, 0x50);
411 411
412 // We are building the following calls tree: 412 // We are building the following calls tree:
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 static void CheckNodeIds(ProfileNode* node, int* expectedId) { 458 static void CheckNodeIds(ProfileNode* node, int* expectedId) {
459 CHECK_EQ((*expectedId)++, node->id()); 459 CHECK_EQ((*expectedId)++, node->id());
460 for (int i = 0; i < node->children()->length(); i++) { 460 for (int i = 0; i < node->children()->length(); i++) {
461 CheckNodeIds(node->children()->at(i), expectedId); 461 CheckNodeIds(node->children()->at(i), expectedId);
462 } 462 }
463 } 463 }
464 464
465 465
466 TEST(SampleIds) { 466 TEST(SampleIds) {
467 TestSetup test_setup; 467 TestSetup test_setup;
468 CpuProfilesCollection profiles(CcTest::i_isolate()->heap()); 468 CpuProfilesCollection profiles(CcTest::heap());
469 profiles.StartProfiling("", 1, true); 469 profiles.StartProfiling("", 1, true);
470 ProfileGenerator generator(&profiles); 470 ProfileGenerator generator(&profiles);
471 CodeEntry* entry1 = profiles.NewCodeEntry(i::Logger::FUNCTION_TAG, "aaa"); 471 CodeEntry* entry1 = profiles.NewCodeEntry(i::Logger::FUNCTION_TAG, "aaa");
472 CodeEntry* entry2 = profiles.NewCodeEntry(i::Logger::FUNCTION_TAG, "bbb"); 472 CodeEntry* entry2 = profiles.NewCodeEntry(i::Logger::FUNCTION_TAG, "bbb");
473 CodeEntry* entry3 = profiles.NewCodeEntry(i::Logger::FUNCTION_TAG, "ccc"); 473 CodeEntry* entry3 = profiles.NewCodeEntry(i::Logger::FUNCTION_TAG, "ccc");
474 generator.code_map()->AddCode(ToAddress(0x1500), entry1, 0x200); 474 generator.code_map()->AddCode(ToAddress(0x1500), entry1, 0x200);
475 generator.code_map()->AddCode(ToAddress(0x1700), entry2, 0x100); 475 generator.code_map()->AddCode(ToAddress(0x1700), entry2, 0x100);
476 generator.code_map()->AddCode(ToAddress(0x1900), entry3, 0x50); 476 generator.code_map()->AddCode(ToAddress(0x1900), entry3, 0x50);
477 477
478 // We are building the following calls tree: 478 // We are building the following calls tree:
(...skipping 27 matching lines...) Expand all
506 CHECK_EQ(3, profile->samples_count()); 506 CHECK_EQ(3, profile->samples_count());
507 int expected_id[] = {3, 5, 7}; 507 int expected_id[] = {3, 5, 7};
508 for (int i = 0; i < 3; i++) { 508 for (int i = 0; i < 3; i++) {
509 CHECK_EQ(expected_id[i], profile->sample(i)->id()); 509 CHECK_EQ(expected_id[i], profile->sample(i)->id());
510 } 510 }
511 } 511 }
512 512
513 513
514 TEST(NoSamples) { 514 TEST(NoSamples) {
515 TestSetup test_setup; 515 TestSetup test_setup;
516 CpuProfilesCollection profiles(CcTest::i_isolate()->heap()); 516 CpuProfilesCollection profiles(CcTest::heap());
517 profiles.StartProfiling("", 1, false); 517 profiles.StartProfiling("", 1, false);
518 ProfileGenerator generator(&profiles); 518 ProfileGenerator generator(&profiles);
519 CodeEntry* entry1 = profiles.NewCodeEntry(i::Logger::FUNCTION_TAG, "aaa"); 519 CodeEntry* entry1 = profiles.NewCodeEntry(i::Logger::FUNCTION_TAG, "aaa");
520 generator.code_map()->AddCode(ToAddress(0x1500), entry1, 0x200); 520 generator.code_map()->AddCode(ToAddress(0x1500), entry1, 0x200);
521 521
522 // We are building the following calls tree: 522 // We are building the following calls tree:
523 // (root)#1 -> aaa #2 -> aaa #3 - sample1 523 // (root)#1 -> aaa #2 -> aaa #3 - sample1
524 TickSample sample1; 524 TickSample sample1;
525 sample1.pc = ToAddress(0x1600); 525 sample1.pc = ToAddress(0x1600);
526 sample1.stack[0] = ToAddress(0x1510); 526 sample1.stack[0] = ToAddress(0x1510);
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 CHECK(current->children()->length() == 0 || 645 CHECK(current->children()->length() == 0 ||
646 current->children()->length() == 1); 646 current->children()->length() == 1);
647 if (current->children()->length() == 1) { 647 if (current->children()->length() == 1) {
648 current = PickChild(current, "startProfiling"); 648 current = PickChild(current, "startProfiling");
649 CHECK_EQ(0, current->children()->length()); 649 CHECK_EQ(0, current->children()->length());
650 } 650 }
651 } 651 }
652 652
653 653
654 TEST(Issue51919) { 654 TEST(Issue51919) {
655 CpuProfilesCollection collection(CcTest::i_isolate()->heap()); 655 CpuProfilesCollection collection(CcTest::heap());
656 i::EmbeddedVector<char*, 656 i::EmbeddedVector<char*,
657 CpuProfilesCollection::kMaxSimultaneousProfiles> titles; 657 CpuProfilesCollection::kMaxSimultaneousProfiles> titles;
658 for (int i = 0; i < CpuProfilesCollection::kMaxSimultaneousProfiles; ++i) { 658 for (int i = 0; i < CpuProfilesCollection::kMaxSimultaneousProfiles; ++i) {
659 i::Vector<char> title = i::Vector<char>::New(16); 659 i::Vector<char> title = i::Vector<char>::New(16);
660 i::OS::SNPrintF(title, "%d", i); 660 i::OS::SNPrintF(title, "%d", i);
661 // UID must be > 0. 661 // UID must be > 0.
662 CHECK(collection.StartProfiling(title.start(), i + 1, false)); 662 CHECK(collection.StartProfiling(title.start(), i + 1, false));
663 titles[i] = title.start(); 663 titles[i] = title.start();
664 } 664 }
665 CHECK(!collection.StartProfiling( 665 CHECK(!collection.StartProfiling(
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 CHECK_NE(NULL, const_cast<v8::CpuProfileNode*>(current)); 821 CHECK_NE(NULL, const_cast<v8::CpuProfileNode*>(current));
822 822
823 current = PickChild(current, "TryFinally"); 823 current = PickChild(current, "TryFinally");
824 CHECK_NE(NULL, const_cast<v8::CpuProfileNode*>(current)); 824 CHECK_NE(NULL, const_cast<v8::CpuProfileNode*>(current));
825 CHECK(!strcmp("TryFinallyStatement", current->GetBailoutReason())); 825 CHECK(!strcmp("TryFinallyStatement", current->GetBailoutReason()));
826 826
827 current = PickChild(current, "TryCatch"); 827 current = PickChild(current, "TryCatch");
828 CHECK_NE(NULL, const_cast<v8::CpuProfileNode*>(current)); 828 CHECK_NE(NULL, const_cast<v8::CpuProfileNode*>(current));
829 CHECK(!strcmp("TryCatchStatement", current->GetBailoutReason())); 829 CHECK(!strcmp("TryCatchStatement", current->GetBailoutReason()));
830 } 830 }
OLDNEW
« no previous file with comments | « test/cctest/test-object-observe.cc ('k') | test/cctest/test-serialize.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698