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

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

Issue 7840029: Make one-character strings into symbols more agressively. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 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 | « src/heap.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 // 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 19 matching lines...) Expand all
30 return &te->token_removed_; 30 return &te->token_removed_;
31 } 31 }
32 }; 32 };
33 33
34 } } // namespace v8::internal 34 } } // namespace v8::internal
35 35
36 TEST(TokenEnumerator) { 36 TEST(TokenEnumerator) {
37 TokenEnumerator te; 37 TokenEnumerator te;
38 CHECK_EQ(TokenEnumerator::kNoSecurityToken, te.GetTokenId(NULL)); 38 CHECK_EQ(TokenEnumerator::kNoSecurityToken, te.GetTokenId(NULL));
39 v8::HandleScope hs; 39 v8::HandleScope hs;
40 v8::Local<v8::String> token1(v8::String::New("1")); 40 v8::Local<v8::String> token1(v8::String::New("1x"));
41 CHECK_EQ(0, te.GetTokenId(*v8::Utils::OpenHandle(*token1))); 41 CHECK_EQ(0, te.GetTokenId(*v8::Utils::OpenHandle(*token1)));
42 CHECK_EQ(0, te.GetTokenId(*v8::Utils::OpenHandle(*token1))); 42 CHECK_EQ(0, te.GetTokenId(*v8::Utils::OpenHandle(*token1)));
43 v8::Local<v8::String> token2(v8::String::New("2")); 43 v8::Local<v8::String> token2(v8::String::New("2x"));
44 CHECK_EQ(1, te.GetTokenId(*v8::Utils::OpenHandle(*token2))); 44 CHECK_EQ(1, te.GetTokenId(*v8::Utils::OpenHandle(*token2)));
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("3")); 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(false);
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 }
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after
813 i::Vector<char> title = i::Vector<char>::New(16); 813 i::Vector<char> title = i::Vector<char>::New(16);
814 i::OS::SNPrintF(title, "%d", i); 814 i::OS::SNPrintF(title, "%d", i);
815 CHECK(collection.StartProfiling(title.start(), i + 1)); // UID must be > 0. 815 CHECK(collection.StartProfiling(title.start(), i + 1)); // UID must be > 0.
816 titles[i] = title.start(); 816 titles[i] = title.start();
817 } 817 }
818 CHECK(!collection.StartProfiling( 818 CHECK(!collection.StartProfiling(
819 "maximum", CpuProfilesCollection::kMaxSimultaneousProfiles + 1)); 819 "maximum", CpuProfilesCollection::kMaxSimultaneousProfiles + 1));
820 for (int i = 0; i < CpuProfilesCollection::kMaxSimultaneousProfiles; ++i) 820 for (int i = 0; i < CpuProfilesCollection::kMaxSimultaneousProfiles; ++i)
821 i::DeleteArray(titles[i]); 821 i::DeleteArray(titles[i]);
822 } 822 }
OLDNEW
« no previous file with comments | « src/heap.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698