Fix AddBlock invocations in CpuProfilesCollection.

It was a bad idea not to check the count of numbers to add.

Also fix a rollover: the comment in platform-linux.

Review URL: http://codereview.chromium.org/2418001

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4754 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
mikhail.naganov@gmail.com 2010-05-31 10:09:07 +00:00
parent 44cfbe392c
commit bb0ba1e5ae
2 changed files with 6 additions and 3 deletions

View File

@ -177,7 +177,8 @@ LinuxKernelMemoryBarrierFunc pLinuxKernelMemoryBarrier __attribute__((weak)) =
#endif
void OS::ReleaseStore(volatile AtomicWord* ptr, AtomicWord value) {
#if defined(V8_TARGET_ARCH_ARM) && defined(__arm__) // don't use on a simulator
#if defined(V8_TARGET_ARCH_ARM) && defined(__arm__)
// Only use on ARM hardware.
pLinuxKernelMemoryBarrier();
#else
__asm__ __volatile__("" : : : "memory");

View File

@ -572,7 +572,8 @@ int CpuProfilesCollection::TokenToIndex(int security_token_id) {
List<CpuProfile*>* CpuProfilesCollection::GetProfilesList(
int security_token_id) {
const int index = TokenToIndex(security_token_id);
profiles_by_token_.AddBlock(NULL, profiles_by_token_.length() - index + 1);
const int lists_to_add = index - profiles_by_token_.length() + 1;
if (lists_to_add > 0) profiles_by_token_.AddBlock(NULL, lists_to_add);
List<CpuProfile*>* unabridged_list =
profiles_by_token_[TokenToIndex(CodeEntry::kNoSecurityToken)];
const int current_count = unabridged_list->length();
@ -580,7 +581,8 @@ List<CpuProfile*>* CpuProfilesCollection::GetProfilesList(
profiles_by_token_[index] = new List<CpuProfile*>(current_count);
}
List<CpuProfile*>* list = profiles_by_token_[index];
list->AddBlock(NULL, current_count - list->length());
const int profiles_to_add = current_count - list->length();
if (profiles_to_add > 0) list->AddBlock(NULL, profiles_to_add);
return list;
}