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

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

Issue 425223004: Move anonymous function name beautifying out of v8. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebaseline Created 6 years, 4 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-heap-profiler.cc ('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 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 "function a() { b(); }\n" 565 "function a() { b(); }\n"
566 "a();\n" 566 "a();\n"
567 "stopProfiling();"); 567 "stopProfiling();");
568 CHECK_EQ(1, profiler->GetProfilesCount()); 568 CHECK_EQ(1, profiler->GetProfilesCount());
569 CpuProfile* profile = profiler->GetProfile(0); 569 CpuProfile* profile = profiler->GetProfile(0);
570 const ProfileTree* topDown = profile->top_down(); 570 const ProfileTree* topDown = profile->top_down();
571 const ProfileNode* current = topDown->root(); 571 const ProfileNode* current = topDown->root();
572 const_cast<ProfileNode*>(current)->Print(0); 572 const_cast<ProfileNode*>(current)->Print(0);
573 // The tree should look like this: 573 // The tree should look like this:
574 // (root) 574 // (root)
575 // (anonymous function) 575 // ""
576 // a 576 // a
577 // b 577 // b
578 // c 578 // c
579 // There can also be: 579 // There can also be:
580 // startProfiling 580 // startProfiling
581 // if the sampler managed to get a tick. 581 // if the sampler managed to get a tick.
582 current = PickChild(current, "(anonymous function)"); 582 current = PickChild(current, "");
583 CHECK_NE(NULL, const_cast<ProfileNode*>(current)); 583 CHECK_NE(NULL, const_cast<ProfileNode*>(current));
584 current = PickChild(current, "a"); 584 current = PickChild(current, "a");
585 CHECK_NE(NULL, const_cast<ProfileNode*>(current)); 585 CHECK_NE(NULL, const_cast<ProfileNode*>(current));
586 current = PickChild(current, "b"); 586 current = PickChild(current, "b");
587 CHECK_NE(NULL, const_cast<ProfileNode*>(current)); 587 CHECK_NE(NULL, const_cast<ProfileNode*>(current));
588 current = PickChild(current, "c"); 588 current = PickChild(current, "c");
589 CHECK_NE(NULL, const_cast<ProfileNode*>(current)); 589 CHECK_NE(NULL, const_cast<ProfileNode*>(current));
590 CHECK(current->children()->length() == 0 || 590 CHECK(current->children()->length() == 0 ||
591 current->children()->length() == 1); 591 current->children()->length() == 1);
592 if (current->children()->length() == 1) { 592 if (current->children()->length() == 1) {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 "b();\n" 644 "b();\n"
645 "stopProfiling();\n")); 645 "stopProfiling();\n"));
646 script_b->Run(); 646 script_b->Run();
647 CHECK_EQ(1, iprofiler->GetProfilesCount()); 647 CHECK_EQ(1, iprofiler->GetProfilesCount());
648 const v8::CpuProfile* profile = i::ProfilerExtension::last_profile; 648 const v8::CpuProfile* profile = i::ProfilerExtension::last_profile;
649 const v8::CpuProfileNode* current = profile->GetTopDownRoot(); 649 const v8::CpuProfileNode* current = profile->GetTopDownRoot();
650 reinterpret_cast<ProfileNode*>( 650 reinterpret_cast<ProfileNode*>(
651 const_cast<v8::CpuProfileNode*>(current))->Print(0); 651 const_cast<v8::CpuProfileNode*>(current))->Print(0);
652 // The tree should look like this: 652 // The tree should look like this:
653 // (root) 653 // (root)
654 // (anonymous function) 654 // ""
655 // b 655 // b
656 // a 656 // a
657 // There can also be: 657 // There can also be:
658 // startProfiling 658 // startProfiling
659 // if the sampler managed to get a tick. 659 // if the sampler managed to get a tick.
660 current = PickChild(current, i::ProfileGenerator::kAnonymousFunctionName); 660 current = PickChild(current, "");
661 CHECK_NE(NULL, const_cast<v8::CpuProfileNode*>(current)); 661 CHECK_NE(NULL, const_cast<v8::CpuProfileNode*>(current));
662 662
663 current = PickChild(current, "b"); 663 current = PickChild(current, "b");
664 CHECK_NE(NULL, const_cast<v8::CpuProfileNode*>(current)); 664 CHECK_NE(NULL, const_cast<v8::CpuProfileNode*>(current));
665 CHECK_EQ(script_b->GetUnboundScript()->GetId(), current->GetScriptId()); 665 CHECK_EQ(script_b->GetUnboundScript()->GetId(), current->GetScriptId());
666 666
667 current = PickChild(current, "a"); 667 current = PickChild(current, "a");
668 CHECK_NE(NULL, const_cast<v8::CpuProfileNode*>(current)); 668 CHECK_NE(NULL, const_cast<v8::CpuProfileNode*>(current));
669 CHECK_EQ(script_a->GetUnboundScript()->GetId(), current->GetScriptId()); 669 CHECK_EQ(script_a->GetUnboundScript()->GetId(), current->GetScriptId());
670 } 670 }
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
753 "stopProfiling();")); 753 "stopProfiling();"));
754 script->Run(); 754 script->Run();
755 CHECK_EQ(1, iprofiler->GetProfilesCount()); 755 CHECK_EQ(1, iprofiler->GetProfilesCount());
756 const v8::CpuProfile* profile = i::ProfilerExtension::last_profile; 756 const v8::CpuProfile* profile = i::ProfilerExtension::last_profile;
757 CHECK(profile); 757 CHECK(profile);
758 const v8::CpuProfileNode* current = profile->GetTopDownRoot(); 758 const v8::CpuProfileNode* current = profile->GetTopDownRoot();
759 reinterpret_cast<ProfileNode*>( 759 reinterpret_cast<ProfileNode*>(
760 const_cast<v8::CpuProfileNode*>(current))->Print(0); 760 const_cast<v8::CpuProfileNode*>(current))->Print(0);
761 // The tree should look like this: 761 // The tree should look like this:
762 // (root) 762 // (root)
763 // (anonymous function) 763 // ""
764 // kTryFinally 764 // kTryFinally
765 // kTryCatch 765 // kTryCatch
766 current = PickChild(current, i::ProfileGenerator::kAnonymousFunctionName); 766 current = PickChild(current, "");
767 CHECK_NE(NULL, const_cast<v8::CpuProfileNode*>(current)); 767 CHECK_NE(NULL, const_cast<v8::CpuProfileNode*>(current));
768 768
769 current = PickChild(current, "TryFinally"); 769 current = PickChild(current, "TryFinally");
770 CHECK_NE(NULL, const_cast<v8::CpuProfileNode*>(current)); 770 CHECK_NE(NULL, const_cast<v8::CpuProfileNode*>(current));
771 CHECK(!strcmp("TryFinallyStatement", current->GetBailoutReason())); 771 CHECK(!strcmp("TryFinallyStatement", current->GetBailoutReason()));
772 772
773 current = PickChild(current, "TryCatch"); 773 current = PickChild(current, "TryCatch");
774 CHECK_NE(NULL, const_cast<v8::CpuProfileNode*>(current)); 774 CHECK_NE(NULL, const_cast<v8::CpuProfileNode*>(current));
775 CHECK(!strcmp("TryCatchStatement", current->GetBailoutReason())); 775 CHECK(!strcmp("TryCatchStatement", current->GetBailoutReason()));
776 } 776 }
OLDNEW
« no previous file with comments | « test/cctest/test-heap-profiler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698