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 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 current_profiles_.Iterate(DeleteCpuProfile); | 485 current_profiles_.Iterate(DeleteCpuProfile); |
486 profiles_by_token_.Iterate(DeleteProfilesList); | 486 profiles_by_token_.Iterate(DeleteProfilesList); |
487 code_entries_.Iterate(DeleteCodeEntry); | 487 code_entries_.Iterate(DeleteCodeEntry); |
488 args_count_names_.Iterate(DeleteArgsCountName); | 488 args_count_names_.Iterate(DeleteArgsCountName); |
489 } | 489 } |
490 | 490 |
491 | 491 |
492 bool CpuProfilesCollection::StartProfiling(const char* title, unsigned uid) { | 492 bool CpuProfilesCollection::StartProfiling(const char* title, unsigned uid) { |
493 ASSERT(uid > 0); | 493 ASSERT(uid > 0); |
494 current_profiles_semaphore_->Wait(); | 494 current_profiles_semaphore_->Wait(); |
| 495 if (current_profiles_.length() >= kMaxSimultaneousProfiles) { |
| 496 current_profiles_semaphore_->Signal(); |
| 497 return false; |
| 498 } |
495 for (int i = 0; i < current_profiles_.length(); ++i) { | 499 for (int i = 0; i < current_profiles_.length(); ++i) { |
496 if (strcmp(current_profiles_[i]->title(), title) == 0) { | 500 if (strcmp(current_profiles_[i]->title(), title) == 0) { |
497 // Ignore attempts to start profile with the same title. | 501 // Ignore attempts to start profile with the same title. |
498 current_profiles_semaphore_->Signal(); | 502 current_profiles_semaphore_->Signal(); |
499 return false; | 503 return false; |
500 } | 504 } |
501 } | 505 } |
502 current_profiles_.Add(new CpuProfile(title, uid)); | 506 current_profiles_.Add(new CpuProfile(title, uid)); |
503 current_profiles_semaphore_->Signal(); | 507 current_profiles_semaphore_->Signal(); |
504 return true; | 508 return true; |
(...skipping 1619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2124 HeapEntry* entry = added_entries[i]; | 2128 HeapEntry* entry = added_entries[i]; |
2125 if (entry->painted_reachable()) | 2129 if (entry->painted_reachable()) |
2126 diff->AddAddedEntry(add_child_index++, added_entry_index++, entry); | 2130 diff->AddAddedEntry(add_child_index++, added_entry_index++, entry); |
2127 } | 2131 } |
2128 return diff; | 2132 return diff; |
2129 } | 2133 } |
2130 | 2134 |
2131 } } // namespace v8::internal | 2135 } } // namespace v8::internal |
2132 | 2136 |
2133 #endif // ENABLE_LOGGING_AND_PROFILING | 2137 #endif // ENABLE_LOGGING_AND_PROFILING |
OLD | NEW |