| 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 11 matching lines...) Expand all Loading... |
| 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 // | 27 // |
| 28 // Tests of profiles generator and utilities. | 28 // Tests of profiles generator and utilities. |
| 29 | 29 |
| 30 #include "v8.h" | 30 #include "v8.h" |
| 31 #include "profile-generator-inl.h" | 31 #include "profile-generator-inl.h" |
| 32 #include "profiler-extension.h" |
| 32 #include "cctest.h" | 33 #include "cctest.h" |
| 33 #include "cpu-profiler.h" | 34 #include "cpu-profiler.h" |
| 34 #include "../include/v8-profiler.h" | 35 #include "../include/v8-profiler.h" |
| 35 | 36 |
| 36 using i::CodeEntry; | 37 using i::CodeEntry; |
| 37 using i::CodeMap; | 38 using i::CodeMap; |
| 38 using i::CpuProfile; | 39 using i::CpuProfile; |
| 39 using i::CpuProfiler; | 40 using i::CpuProfiler; |
| 40 using i::CpuProfilesCollection; | 41 using i::CpuProfilesCollection; |
| 41 using i::ProfileNode; | 42 using i::ProfileNode; |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 | 394 |
| 394 private: | 395 private: |
| 395 bool old_flag_prof_browser_mode_; | 396 bool old_flag_prof_browser_mode_; |
| 396 }; | 397 }; |
| 397 | 398 |
| 398 } // namespace | 399 } // namespace |
| 399 | 400 |
| 400 TEST(RecordTickSample) { | 401 TEST(RecordTickSample) { |
| 401 TestSetup test_setup; | 402 TestSetup test_setup; |
| 402 CpuProfilesCollection profiles(CcTest::heap()); | 403 CpuProfilesCollection profiles(CcTest::heap()); |
| 403 profiles.StartProfiling("", 1, false); | 404 profiles.StartProfiling("", false); |
| 404 ProfileGenerator generator(&profiles); | 405 ProfileGenerator generator(&profiles); |
| 405 CodeEntry* entry1 = profiles.NewCodeEntry(i::Logger::FUNCTION_TAG, "aaa"); | 406 CodeEntry* entry1 = profiles.NewCodeEntry(i::Logger::FUNCTION_TAG, "aaa"); |
| 406 CodeEntry* entry2 = profiles.NewCodeEntry(i::Logger::FUNCTION_TAG, "bbb"); | 407 CodeEntry* entry2 = profiles.NewCodeEntry(i::Logger::FUNCTION_TAG, "bbb"); |
| 407 CodeEntry* entry3 = profiles.NewCodeEntry(i::Logger::FUNCTION_TAG, "ccc"); | 408 CodeEntry* entry3 = profiles.NewCodeEntry(i::Logger::FUNCTION_TAG, "ccc"); |
| 408 generator.code_map()->AddCode(ToAddress(0x1500), entry1, 0x200); | 409 generator.code_map()->AddCode(ToAddress(0x1500), entry1, 0x200); |
| 409 generator.code_map()->AddCode(ToAddress(0x1700), entry2, 0x100); | 410 generator.code_map()->AddCode(ToAddress(0x1700), entry2, 0x100); |
| 410 generator.code_map()->AddCode(ToAddress(0x1900), entry3, 0x50); | 411 generator.code_map()->AddCode(ToAddress(0x1900), entry3, 0x50); |
| 411 | 412 |
| 412 // We are building the following calls tree: | 413 // We are building the following calls tree: |
| 413 // -> aaa - sample1 | 414 // -> aaa - sample1 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 459 CHECK_EQ((*expectedId)++, node->id()); | 460 CHECK_EQ((*expectedId)++, node->id()); |
| 460 for (int i = 0; i < node->children()->length(); i++) { | 461 for (int i = 0; i < node->children()->length(); i++) { |
| 461 CheckNodeIds(node->children()->at(i), expectedId); | 462 CheckNodeIds(node->children()->at(i), expectedId); |
| 462 } | 463 } |
| 463 } | 464 } |
| 464 | 465 |
| 465 | 466 |
| 466 TEST(SampleIds) { | 467 TEST(SampleIds) { |
| 467 TestSetup test_setup; | 468 TestSetup test_setup; |
| 468 CpuProfilesCollection profiles(CcTest::heap()); | 469 CpuProfilesCollection profiles(CcTest::heap()); |
| 469 profiles.StartProfiling("", 1, true); | 470 profiles.StartProfiling("", true); |
| 470 ProfileGenerator generator(&profiles); | 471 ProfileGenerator generator(&profiles); |
| 471 CodeEntry* entry1 = profiles.NewCodeEntry(i::Logger::FUNCTION_TAG, "aaa"); | 472 CodeEntry* entry1 = profiles.NewCodeEntry(i::Logger::FUNCTION_TAG, "aaa"); |
| 472 CodeEntry* entry2 = profiles.NewCodeEntry(i::Logger::FUNCTION_TAG, "bbb"); | 473 CodeEntry* entry2 = profiles.NewCodeEntry(i::Logger::FUNCTION_TAG, "bbb"); |
| 473 CodeEntry* entry3 = profiles.NewCodeEntry(i::Logger::FUNCTION_TAG, "ccc"); | 474 CodeEntry* entry3 = profiles.NewCodeEntry(i::Logger::FUNCTION_TAG, "ccc"); |
| 474 generator.code_map()->AddCode(ToAddress(0x1500), entry1, 0x200); | 475 generator.code_map()->AddCode(ToAddress(0x1500), entry1, 0x200); |
| 475 generator.code_map()->AddCode(ToAddress(0x1700), entry2, 0x100); | 476 generator.code_map()->AddCode(ToAddress(0x1700), entry2, 0x100); |
| 476 generator.code_map()->AddCode(ToAddress(0x1900), entry3, 0x50); | 477 generator.code_map()->AddCode(ToAddress(0x1900), entry3, 0x50); |
| 477 | 478 |
| 478 // We are building the following calls tree: | 479 // We are building the following calls tree: |
| 479 // -> aaa #3 - sample1 | 480 // -> aaa #3 - sample1 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 507 int expected_id[] = {3, 5, 7}; | 508 int expected_id[] = {3, 5, 7}; |
| 508 for (int i = 0; i < 3; i++) { | 509 for (int i = 0; i < 3; i++) { |
| 509 CHECK_EQ(expected_id[i], profile->sample(i)->id()); | 510 CHECK_EQ(expected_id[i], profile->sample(i)->id()); |
| 510 } | 511 } |
| 511 } | 512 } |
| 512 | 513 |
| 513 | 514 |
| 514 TEST(NoSamples) { | 515 TEST(NoSamples) { |
| 515 TestSetup test_setup; | 516 TestSetup test_setup; |
| 516 CpuProfilesCollection profiles(CcTest::heap()); | 517 CpuProfilesCollection profiles(CcTest::heap()); |
| 517 profiles.StartProfiling("", 1, false); | 518 profiles.StartProfiling("", false); |
| 518 ProfileGenerator generator(&profiles); | 519 ProfileGenerator generator(&profiles); |
| 519 CodeEntry* entry1 = profiles.NewCodeEntry(i::Logger::FUNCTION_TAG, "aaa"); | 520 CodeEntry* entry1 = profiles.NewCodeEntry(i::Logger::FUNCTION_TAG, "aaa"); |
| 520 generator.code_map()->AddCode(ToAddress(0x1500), entry1, 0x200); | 521 generator.code_map()->AddCode(ToAddress(0x1500), entry1, 0x200); |
| 521 | 522 |
| 522 // We are building the following calls tree: | 523 // We are building the following calls tree: |
| 523 // (root)#1 -> aaa #2 -> aaa #3 - sample1 | 524 // (root)#1 -> aaa #2 -> aaa #3 - sample1 |
| 524 TickSample sample1; | 525 TickSample sample1; |
| 525 sample1.pc = ToAddress(0x1600); | 526 sample1.pc = ToAddress(0x1600); |
| 526 sample1.stack[0] = ToAddress(0x1510); | 527 sample1.stack[0] = ToAddress(0x1510); |
| 527 sample1.frames_count = 1; | 528 sample1.frames_count = 1; |
| 528 generator.RecordTickSample(sample1); | 529 generator.RecordTickSample(sample1); |
| 529 | 530 |
| 530 CpuProfile* profile = profiles.StopProfiling(""); | 531 CpuProfile* profile = profiles.StopProfiling(""); |
| 531 int nodeId = 1; | 532 int nodeId = 1; |
| 532 CheckNodeIds(profile->top_down()->root(), &nodeId); | 533 CheckNodeIds(profile->top_down()->root(), &nodeId); |
| 533 CHECK_EQ(3, nodeId - 1); | 534 CHECK_EQ(3, nodeId - 1); |
| 534 | 535 |
| 535 CHECK_EQ(0, profile->samples_count()); | 536 CHECK_EQ(0, profile->samples_count()); |
| 536 } | 537 } |
| 537 | 538 |
| 538 | 539 |
| 539 // --- P r o f i l e r E x t e n s i o n --- | |
| 540 | |
| 541 class ProfilerExtension : public v8::Extension { | |
| 542 public: | |
| 543 ProfilerExtension() : v8::Extension("v8/profiler", kSource) { } | |
| 544 virtual v8::Handle<v8::FunctionTemplate> GetNativeFunctionTemplate( | |
| 545 v8::Isolate* isolate, | |
| 546 v8::Handle<v8::String> name); | |
| 547 static void StartProfiling(const v8::FunctionCallbackInfo<v8::Value>& args); | |
| 548 static void StopProfiling(const v8::FunctionCallbackInfo<v8::Value>& args); | |
| 549 private: | |
| 550 static const char* kSource; | |
| 551 }; | |
| 552 | |
| 553 | |
| 554 const char* ProfilerExtension::kSource = | |
| 555 "native function startProfiling();" | |
| 556 "native function stopProfiling();"; | |
| 557 | |
| 558 v8::Handle<v8::FunctionTemplate> ProfilerExtension::GetNativeFunctionTemplate( | |
| 559 v8::Isolate* isolate, v8::Handle<v8::String> name) { | |
| 560 if (name->Equals(v8::String::NewFromUtf8(isolate, "startProfiling"))) { | |
| 561 return v8::FunctionTemplate::New(ProfilerExtension::StartProfiling); | |
| 562 } else if (name->Equals(v8::String::NewFromUtf8(isolate, "stopProfiling"))) { | |
| 563 return v8::FunctionTemplate::New(ProfilerExtension::StopProfiling); | |
| 564 } else { | |
| 565 CHECK(false); | |
| 566 return v8::Handle<v8::FunctionTemplate>(); | |
| 567 } | |
| 568 } | |
| 569 | |
| 570 | |
| 571 void ProfilerExtension::StartProfiling( | |
| 572 const v8::FunctionCallbackInfo<v8::Value>& args) { | |
| 573 v8::CpuProfiler* cpu_profiler = args.GetIsolate()->GetCpuProfiler(); | |
| 574 if (args.Length() > 0) | |
| 575 cpu_profiler->StartCpuProfiling(args[0].As<v8::String>()); | |
| 576 else | |
| 577 cpu_profiler->StartCpuProfiling( | |
| 578 v8::String::NewFromUtf8(args.GetIsolate(), "")); | |
| 579 } | |
| 580 | |
| 581 | |
| 582 void ProfilerExtension::StopProfiling( | |
| 583 const v8::FunctionCallbackInfo<v8::Value>& args) { | |
| 584 v8::CpuProfiler* cpu_profiler = args.GetIsolate()->GetCpuProfiler(); | |
| 585 if (args.Length() > 0) | |
| 586 cpu_profiler->StopCpuProfiling(args[0].As<v8::String>()); | |
| 587 else | |
| 588 cpu_profiler->StopCpuProfiling( | |
| 589 v8::String::NewFromUtf8(args.GetIsolate(), "")); | |
| 590 } | |
| 591 | |
| 592 | |
| 593 static ProfilerExtension kProfilerExtension; | |
| 594 v8::DeclareExtension kProfilerExtensionDeclaration(&kProfilerExtension); | |
| 595 | |
| 596 static const ProfileNode* PickChild(const ProfileNode* parent, | 540 static const ProfileNode* PickChild(const ProfileNode* parent, |
| 597 const char* name) { | 541 const char* name) { |
| 598 for (int i = 0; i < parent->children()->length(); ++i) { | 542 for (int i = 0; i < parent->children()->length(); ++i) { |
| 599 const ProfileNode* child = parent->children()->at(i); | 543 const ProfileNode* child = parent->children()->at(i); |
| 600 if (strcmp(child->entry()->name(), name) == 0) return child; | 544 if (strcmp(child->entry()->name(), name) == 0) return child; |
| 601 } | 545 } |
| 602 return NULL; | 546 return NULL; |
| 603 } | 547 } |
| 604 | 548 |
| 605 | 549 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 654 } | 598 } |
| 655 | 599 |
| 656 | 600 |
| 657 TEST(Issue51919) { | 601 TEST(Issue51919) { |
| 658 CpuProfilesCollection collection(CcTest::heap()); | 602 CpuProfilesCollection collection(CcTest::heap()); |
| 659 i::EmbeddedVector<char*, | 603 i::EmbeddedVector<char*, |
| 660 CpuProfilesCollection::kMaxSimultaneousProfiles> titles; | 604 CpuProfilesCollection::kMaxSimultaneousProfiles> titles; |
| 661 for (int i = 0; i < CpuProfilesCollection::kMaxSimultaneousProfiles; ++i) { | 605 for (int i = 0; i < CpuProfilesCollection::kMaxSimultaneousProfiles; ++i) { |
| 662 i::Vector<char> title = i::Vector<char>::New(16); | 606 i::Vector<char> title = i::Vector<char>::New(16); |
| 663 i::OS::SNPrintF(title, "%d", i); | 607 i::OS::SNPrintF(title, "%d", i); |
| 664 // UID must be > 0. | 608 CHECK(collection.StartProfiling(title.start(), false)); |
| 665 CHECK(collection.StartProfiling(title.start(), i + 1, false)); | |
| 666 titles[i] = title.start(); | 609 titles[i] = title.start(); |
| 667 } | 610 } |
| 668 CHECK(!collection.StartProfiling( | 611 CHECK(!collection.StartProfiling("maximum", false)); |
| 669 "maximum", CpuProfilesCollection::kMaxSimultaneousProfiles + 1, false)); | |
| 670 for (int i = 0; i < CpuProfilesCollection::kMaxSimultaneousProfiles; ++i) | 612 for (int i = 0; i < CpuProfilesCollection::kMaxSimultaneousProfiles; ++i) |
| 671 i::DeleteArray(titles[i]); | 613 i::DeleteArray(titles[i]); |
| 672 } | 614 } |
| 673 | 615 |
| 674 | 616 |
| 675 static const v8::CpuProfileNode* PickChild(const v8::CpuProfileNode* parent, | 617 static const v8::CpuProfileNode* PickChild(const v8::CpuProfileNode* parent, |
| 676 const char* name) { | 618 const char* name) { |
| 677 for (int i = 0; i < parent->GetChildrenCount(); ++i) { | 619 for (int i = 0; i < parent->GetChildrenCount(); ++i) { |
| 678 const v8::CpuProfileNode* child = parent->GetChild(i); | 620 const v8::CpuProfileNode* child = parent->GetChild(i); |
| 679 v8::String::Utf8Value function_name(child->GetFunctionName()); | 621 v8::String::Utf8Value function_name(child->GetFunctionName()); |
| 680 if (strcmp(*function_name, name) == 0) return child; | 622 if (strcmp(*function_name, name) == 0) return child; |
| 681 } | 623 } |
| 682 return NULL; | 624 return NULL; |
| 683 } | 625 } |
| 684 | 626 |
| 685 | 627 |
| 686 TEST(ProfileNodeScriptId) { | 628 TEST(ProfileNodeScriptId) { |
| 687 // This test does not pass with inlining enabled since inlined functions | 629 // This test does not pass with inlining enabled since inlined functions |
| 688 // don't appear in the stack trace. | 630 // don't appear in the stack trace. |
| 689 i::FLAG_use_inlining = false; | 631 i::FLAG_use_inlining = false; |
| 690 | 632 |
| 691 const char* extensions[] = { "v8/profiler" }; | 633 const char* extensions[] = { "v8/profiler" }; |
| 692 v8::ExtensionConfiguration config(1, extensions); | 634 v8::ExtensionConfiguration config(1, extensions); |
| 693 LocalContext env(&config); | 635 LocalContext env(&config); |
| 694 v8::HandleScope hs(env->GetIsolate()); | 636 v8::HandleScope hs(env->GetIsolate()); |
| 695 | 637 |
| 696 v8::CpuProfiler* profiler = env->GetIsolate()->GetCpuProfiler(); | 638 v8::CpuProfiler* profiler = env->GetIsolate()->GetCpuProfiler(); |
| 697 CHECK_EQ(0, profiler->GetProfileCount()); | 639 i::CpuProfiler* iprofiler = reinterpret_cast<i::CpuProfiler*>(profiler); |
| 640 CHECK_EQ(0, iprofiler->GetProfilesCount()); |
| 698 v8::Handle<v8::Script> script_a = v8::Script::Compile(v8::String::NewFromUtf8( | 641 v8::Handle<v8::Script> script_a = v8::Script::Compile(v8::String::NewFromUtf8( |
| 699 env->GetIsolate(), "function a() { startProfiling(); }\n")); | 642 env->GetIsolate(), "function a() { startProfiling(); }\n")); |
| 700 script_a->Run(); | 643 script_a->Run(); |
| 701 v8::Handle<v8::Script> script_b = | 644 v8::Handle<v8::Script> script_b = |
| 702 v8::Script::Compile(v8::String::NewFromUtf8(env->GetIsolate(), | 645 v8::Script::Compile(v8::String::NewFromUtf8(env->GetIsolate(), |
| 703 "function b() { a(); }\n" | 646 "function b() { a(); }\n" |
| 704 "b();\n" | 647 "b();\n" |
| 705 "stopProfiling();\n")); | 648 "stopProfiling();\n")); |
| 706 script_b->Run(); | 649 script_b->Run(); |
| 707 CHECK_EQ(1, profiler->GetProfileCount()); | 650 CHECK_EQ(1, iprofiler->GetProfilesCount()); |
| 708 const v8::CpuProfile* profile = profiler->GetCpuProfile(0); | 651 const v8::CpuProfile* profile = ProfilerExtension::last_profile; |
| 709 const v8::CpuProfileNode* current = profile->GetTopDownRoot(); | 652 const v8::CpuProfileNode* current = profile->GetTopDownRoot(); |
| 710 reinterpret_cast<ProfileNode*>( | 653 reinterpret_cast<ProfileNode*>( |
| 711 const_cast<v8::CpuProfileNode*>(current))->Print(0); | 654 const_cast<v8::CpuProfileNode*>(current))->Print(0); |
| 712 // The tree should look like this: | 655 // The tree should look like this: |
| 713 // (root) | 656 // (root) |
| 714 // (anonymous function) | 657 // (anonymous function) |
| 715 // b | 658 // b |
| 716 // a | 659 // a |
| 717 // There can also be: | 660 // There can also be: |
| 718 // startProfiling | 661 // startProfiling |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 789 | 732 |
| 790 | 733 |
| 791 | 734 |
| 792 TEST(BailoutReason) { | 735 TEST(BailoutReason) { |
| 793 const char* extensions[] = { "v8/profiler" }; | 736 const char* extensions[] = { "v8/profiler" }; |
| 794 v8::ExtensionConfiguration config(1, extensions); | 737 v8::ExtensionConfiguration config(1, extensions); |
| 795 LocalContext env(&config); | 738 LocalContext env(&config); |
| 796 v8::HandleScope hs(env->GetIsolate()); | 739 v8::HandleScope hs(env->GetIsolate()); |
| 797 | 740 |
| 798 v8::CpuProfiler* profiler = env->GetIsolate()->GetCpuProfiler(); | 741 v8::CpuProfiler* profiler = env->GetIsolate()->GetCpuProfiler(); |
| 799 CHECK_EQ(0, profiler->GetProfileCount()); | 742 i::CpuProfiler* iprofiler = reinterpret_cast<i::CpuProfiler*>(profiler); |
| 743 CHECK_EQ(0, iprofiler->GetProfilesCount()); |
| 800 v8::Handle<v8::Script> script = | 744 v8::Handle<v8::Script> script = |
| 801 v8::Script::Compile(v8::String::NewFromUtf8(env->GetIsolate(), | 745 v8::Script::Compile(v8::String::NewFromUtf8(env->GetIsolate(), |
| 802 "function TryCatch() {\n" | 746 "function TryCatch() {\n" |
| 803 " try {\n" | 747 " try {\n" |
| 804 " startProfiling();\n" | 748 " startProfiling();\n" |
| 805 " } catch (e) { };\n" | 749 " } catch (e) { };\n" |
| 806 "}\n" | 750 "}\n" |
| 807 "function TryFinally() {\n" | 751 "function TryFinally() {\n" |
| 808 " try {\n" | 752 " try {\n" |
| 809 " TryCatch();\n" | 753 " TryCatch();\n" |
| 810 " } finally { };\n" | 754 " } finally { };\n" |
| 811 "}\n" | 755 "}\n" |
| 812 "TryFinally();\n" | 756 "TryFinally();\n" |
| 813 "stopProfiling();")); | 757 "stopProfiling();")); |
| 814 script->Run(); | 758 script->Run(); |
| 815 CHECK_EQ(1, profiler->GetProfileCount()); | 759 CHECK_EQ(1, iprofiler->GetProfilesCount()); |
| 816 const v8::CpuProfile* profile = profiler->GetCpuProfile(0); | 760 const v8::CpuProfile* profile = ProfilerExtension::last_profile; |
| 761 CHECK(profile); |
| 817 const v8::CpuProfileNode* current = profile->GetTopDownRoot(); | 762 const v8::CpuProfileNode* current = profile->GetTopDownRoot(); |
| 818 reinterpret_cast<ProfileNode*>( | 763 reinterpret_cast<ProfileNode*>( |
| 819 const_cast<v8::CpuProfileNode*>(current))->Print(0); | 764 const_cast<v8::CpuProfileNode*>(current))->Print(0); |
| 820 // The tree should look like this: | 765 // The tree should look like this: |
| 821 // (root) | 766 // (root) |
| 822 // (anonymous function) | 767 // (anonymous function) |
| 823 // kTryFinally | 768 // kTryFinally |
| 824 // kTryCatch | 769 // kTryCatch |
| 825 current = PickChild(current, i::ProfileGenerator::kAnonymousFunctionName); | 770 current = PickChild(current, i::ProfileGenerator::kAnonymousFunctionName); |
| 826 CHECK_NE(NULL, const_cast<v8::CpuProfileNode*>(current)); | 771 CHECK_NE(NULL, const_cast<v8::CpuProfileNode*>(current)); |
| 827 | 772 |
| 828 current = PickChild(current, "TryFinally"); | 773 current = PickChild(current, "TryFinally"); |
| 829 CHECK_NE(NULL, const_cast<v8::CpuProfileNode*>(current)); | 774 CHECK_NE(NULL, const_cast<v8::CpuProfileNode*>(current)); |
| 830 CHECK(!strcmp("TryFinallyStatement", current->GetBailoutReason())); | 775 CHECK(!strcmp("TryFinallyStatement", current->GetBailoutReason())); |
| 831 | 776 |
| 832 current = PickChild(current, "TryCatch"); | 777 current = PickChild(current, "TryCatch"); |
| 833 CHECK_NE(NULL, const_cast<v8::CpuProfileNode*>(current)); | 778 CHECK_NE(NULL, const_cast<v8::CpuProfileNode*>(current)); |
| 834 CHECK(!strcmp("TryCatchStatement", current->GetBailoutReason())); | 779 CHECK(!strcmp("TryCatchStatement", current->GetBailoutReason())); |
| 835 } | 780 } |
| OLD | NEW |