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 #include "v8.h" | 5 #include "v8.h" |
6 #include "profile-generator-inl.h" | 6 #include "profile-generator-inl.h" |
7 #include "cctest.h" | 7 #include "cctest.h" |
8 #include "../include/v8-profiler.h" | 8 #include "../include/v8-profiler.h" |
9 | 9 |
10 using i::CodeEntry; | 10 using i::CodeEntry; |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
542 TEST(CodeMapMoveAndDeleteCode) { | 542 TEST(CodeMapMoveAndDeleteCode) { |
543 CodeMap code_map; | 543 CodeMap code_map; |
544 CodeEntry entry1(i::Logger::FUNCTION_TAG, "", "aaa", "", 0, | 544 CodeEntry entry1(i::Logger::FUNCTION_TAG, "", "aaa", "", 0, |
545 TokenEnumerator::kNoSecurityToken); | 545 TokenEnumerator::kNoSecurityToken); |
546 CodeEntry entry2(i::Logger::FUNCTION_TAG, "", "bbb", "", 0, | 546 CodeEntry entry2(i::Logger::FUNCTION_TAG, "", "bbb", "", 0, |
547 TokenEnumerator::kNoSecurityToken); | 547 TokenEnumerator::kNoSecurityToken); |
548 code_map.AddCode(ToAddress(0x1500), &entry1, 0x200); | 548 code_map.AddCode(ToAddress(0x1500), &entry1, 0x200); |
549 code_map.AddCode(ToAddress(0x1700), &entry2, 0x100); | 549 code_map.AddCode(ToAddress(0x1700), &entry2, 0x100); |
550 CHECK_EQ(&entry1, code_map.FindEntry(ToAddress(0x1500))); | 550 CHECK_EQ(&entry1, code_map.FindEntry(ToAddress(0x1500))); |
551 CHECK_EQ(&entry2, code_map.FindEntry(ToAddress(0x1700))); | 551 CHECK_EQ(&entry2, code_map.FindEntry(ToAddress(0x1700))); |
552 code_map.MoveCode(ToAddress(0x1500), ToAddress(0x1800)); | 552 code_map.MoveCode(ToAddress(0x1500), ToAddress(0x1700)); // Deprecate bbb. |
553 CHECK_EQ(NULL, code_map.FindEntry(ToAddress(0x1500))); | 553 CHECK_EQ(NULL, code_map.FindEntry(ToAddress(0x1500))); |
554 CHECK_EQ(&entry2, code_map.FindEntry(ToAddress(0x1700))); | 554 CHECK_EQ(&entry1, code_map.FindEntry(ToAddress(0x1700))); |
555 CHECK_EQ(&entry1, code_map.FindEntry(ToAddress(0x1800))); | 555 CodeEntry entry3(i::Logger::FUNCTION_TAG, "", "ccc", "", 0, |
556 code_map.DeleteCode(ToAddress(0x1700)); | 556 TokenEnumerator::kNoSecurityToken); |
| 557 code_map.AddCode(ToAddress(0x1750), &entry3, 0x100); |
557 CHECK_EQ(NULL, code_map.FindEntry(ToAddress(0x1700))); | 558 CHECK_EQ(NULL, code_map.FindEntry(ToAddress(0x1700))); |
558 CHECK_EQ(&entry1, code_map.FindEntry(ToAddress(0x1800))); | 559 CHECK_EQ(&entry3, code_map.FindEntry(ToAddress(0x1750))); |
559 } | 560 } |
560 | 561 |
561 | 562 |
562 namespace { | 563 namespace { |
563 | 564 |
564 class TestSetup { | 565 class TestSetup { |
565 public: | 566 public: |
566 TestSetup() | 567 TestSetup() |
567 : old_flag_prof_browser_mode_(i::FLAG_prof_browser_mode) { | 568 : old_flag_prof_browser_mode_(i::FLAG_prof_browser_mode) { |
568 i::FLAG_prof_browser_mode = false; | 569 i::FLAG_prof_browser_mode = false; |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
813 i::Vector<char> title = i::Vector<char>::New(16); | 814 i::Vector<char> title = i::Vector<char>::New(16); |
814 i::OS::SNPrintF(title, "%d", i); | 815 i::OS::SNPrintF(title, "%d", i); |
815 CHECK(collection.StartProfiling(title.start(), i + 1)); // UID must be > 0. | 816 CHECK(collection.StartProfiling(title.start(), i + 1)); // UID must be > 0. |
816 titles[i] = title.start(); | 817 titles[i] = title.start(); |
817 } | 818 } |
818 CHECK(!collection.StartProfiling( | 819 CHECK(!collection.StartProfiling( |
819 "maximum", CpuProfilesCollection::kMaxSimultaneousProfiles + 1)); | 820 "maximum", CpuProfilesCollection::kMaxSimultaneousProfiles + 1)); |
820 for (int i = 0; i < CpuProfilesCollection::kMaxSimultaneousProfiles; ++i) | 821 for (int i = 0; i < CpuProfilesCollection::kMaxSimultaneousProfiles; ++i) |
821 i::DeleteArray(titles[i]); | 822 i::DeleteArray(titles[i]); |
822 } | 823 } |
OLD | NEW |