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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 CHECK_EQ(1, te.GetTokenId(*v8::Utils::OpenHandle(*token2))); | 45 CHECK_EQ(1, te.GetTokenId(*v8::Utils::OpenHandle(*token2))); |
46 CHECK_EQ(0, te.GetTokenId(*v8::Utils::OpenHandle(*token1))); | 46 CHECK_EQ(0, te.GetTokenId(*v8::Utils::OpenHandle(*token1))); |
47 { | 47 { |
48 v8::HandleScope hs; | 48 v8::HandleScope hs; |
49 v8::Local<v8::String> token3(v8::String::New("3x")); | 49 v8::Local<v8::String> token3(v8::String::New("3x")); |
50 CHECK_EQ(2, te.GetTokenId(*v8::Utils::OpenHandle(*token3))); | 50 CHECK_EQ(2, te.GetTokenId(*v8::Utils::OpenHandle(*token3))); |
51 CHECK_EQ(1, te.GetTokenId(*v8::Utils::OpenHandle(*token2))); | 51 CHECK_EQ(1, te.GetTokenId(*v8::Utils::OpenHandle(*token2))); |
52 CHECK_EQ(0, te.GetTokenId(*v8::Utils::OpenHandle(*token1))); | 52 CHECK_EQ(0, te.GetTokenId(*v8::Utils::OpenHandle(*token1))); |
53 } | 53 } |
54 CHECK(!i::TokenEnumeratorTester::token_removed(&te)->at(2)); | 54 CHECK(!i::TokenEnumeratorTester::token_removed(&te)->at(2)); |
55 HEAP->CollectAllGarbage(false); | 55 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); |
56 CHECK(i::TokenEnumeratorTester::token_removed(&te)->at(2)); | 56 CHECK(i::TokenEnumeratorTester::token_removed(&te)->at(2)); |
57 CHECK_EQ(1, te.GetTokenId(*v8::Utils::OpenHandle(*token2))); | 57 CHECK_EQ(1, te.GetTokenId(*v8::Utils::OpenHandle(*token2))); |
58 CHECK_EQ(0, te.GetTokenId(*v8::Utils::OpenHandle(*token1))); | 58 CHECK_EQ(0, te.GetTokenId(*v8::Utils::OpenHandle(*token1))); |
59 } | 59 } |
60 | 60 |
61 | 61 |
62 TEST(ProfileNodeFindOrAddChild) { | 62 TEST(ProfileNodeFindOrAddChild) { |
63 ProfileNode node(NULL, NULL); | 63 ProfileNode node(NULL, NULL); |
64 CodeEntry entry1(i::Logger::FUNCTION_TAG, "", "aaa", "", 0, | 64 CodeEntry entry1(i::Logger::FUNCTION_TAG, "", "aaa", "", 0, |
65 TokenEnumerator::kNoSecurityToken); | 65 TokenEnumerator::kNoSecurityToken); |
(...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
814 i::Vector<char> title = i::Vector<char>::New(16); | 814 i::Vector<char> title = i::Vector<char>::New(16); |
815 i::OS::SNPrintF(title, "%d", i); | 815 i::OS::SNPrintF(title, "%d", i); |
816 CHECK(collection.StartProfiling(title.start(), i + 1)); // UID must be > 0. | 816 CHECK(collection.StartProfiling(title.start(), i + 1)); // UID must be > 0. |
817 titles[i] = title.start(); | 817 titles[i] = title.start(); |
818 } | 818 } |
819 CHECK(!collection.StartProfiling( | 819 CHECK(!collection.StartProfiling( |
820 "maximum", CpuProfilesCollection::kMaxSimultaneousProfiles + 1)); | 820 "maximum", CpuProfilesCollection::kMaxSimultaneousProfiles + 1)); |
821 for (int i = 0; i < CpuProfilesCollection::kMaxSimultaneousProfiles; ++i) | 821 for (int i = 0; i < CpuProfilesCollection::kMaxSimultaneousProfiles; ++i) |
822 i::DeleteArray(titles[i]); | 822 i::DeleteArray(titles[i]); |
823 } | 823 } |
OLD | NEW |