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

Side by Side Diff: src/profile-generator.cc

Issue 2418001: Fix AddBlock invocations in CpuProfilesCollection. (Closed)
Patch Set: Created 10 years, 6 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
« no previous file with comments | « src/platform-linux.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 565
566 int CpuProfilesCollection::TokenToIndex(int security_token_id) { 566 int CpuProfilesCollection::TokenToIndex(int security_token_id) {
567 ASSERT(CodeEntry::kNoSecurityToken == -1); 567 ASSERT(CodeEntry::kNoSecurityToken == -1);
568 return security_token_id + 1; // kNoSecurityToken -> 0, 0 -> 1, ... 568 return security_token_id + 1; // kNoSecurityToken -> 0, 0 -> 1, ...
569 } 569 }
570 570
571 571
572 List<CpuProfile*>* CpuProfilesCollection::GetProfilesList( 572 List<CpuProfile*>* CpuProfilesCollection::GetProfilesList(
573 int security_token_id) { 573 int security_token_id) {
574 const int index = TokenToIndex(security_token_id); 574 const int index = TokenToIndex(security_token_id);
575 profiles_by_token_.AddBlock(NULL, profiles_by_token_.length() - index + 1); 575 const int lists_to_add = index - profiles_by_token_.length() + 1;
576 if (lists_to_add > 0) profiles_by_token_.AddBlock(NULL, lists_to_add);
576 List<CpuProfile*>* unabridged_list = 577 List<CpuProfile*>* unabridged_list =
577 profiles_by_token_[TokenToIndex(CodeEntry::kNoSecurityToken)]; 578 profiles_by_token_[TokenToIndex(CodeEntry::kNoSecurityToken)];
578 const int current_count = unabridged_list->length(); 579 const int current_count = unabridged_list->length();
579 if (profiles_by_token_[index] == NULL) { 580 if (profiles_by_token_[index] == NULL) {
580 profiles_by_token_[index] = new List<CpuProfile*>(current_count); 581 profiles_by_token_[index] = new List<CpuProfile*>(current_count);
581 } 582 }
582 List<CpuProfile*>* list = profiles_by_token_[index]; 583 List<CpuProfile*>* list = profiles_by_token_[index];
583 list->AddBlock(NULL, current_count - list->length()); 584 const int profiles_to_add = current_count - list->length();
585 if (profiles_to_add > 0) list->AddBlock(NULL, profiles_to_add);
584 return list; 586 return list;
585 } 587 }
586 588
587 589
588 List<CpuProfile*>* CpuProfilesCollection::Profiles(int security_token_id) { 590 List<CpuProfile*>* CpuProfilesCollection::Profiles(int security_token_id) {
589 List<CpuProfile*>* unabridged_list = 591 List<CpuProfile*>* unabridged_list =
590 profiles_by_token_[TokenToIndex(CodeEntry::kNoSecurityToken)]; 592 profiles_by_token_[TokenToIndex(CodeEntry::kNoSecurityToken)];
591 if (security_token_id == CodeEntry::kNoSecurityToken) { 593 if (security_token_id == CodeEntry::kNoSecurityToken) {
592 return unabridged_list; 594 return unabridged_list;
593 } 595 }
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
801 *entry++ = EntryForVMState(sample.state); 803 *entry++ = EntryForVMState(sample.state);
802 } 804 }
803 } 805 }
804 806
805 profiles_->AddPathToCurrentProfiles(entries); 807 profiles_->AddPathToCurrentProfiles(entries);
806 } 808 }
807 809
808 } } // namespace v8::internal 810 } } // namespace v8::internal
809 811
810 #endif // ENABLE_LOGGING_AND_PROFILING 812 #endif // ENABLE_LOGGING_AND_PROFILING
OLDNEW
« no previous file with comments | « src/platform-linux.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698