Revision: 4754
Author: [email protected]
Date: Mon May 31 03:09:07 2010
Log: 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
http://code.google.com/p/v8/source/detail?r=4754

Modified:
 /branches/bleeding_edge/src/platform-linux.cc
 /branches/bleeding_edge/src/profile-generator.cc

=======================================
--- /branches/bleeding_edge/src/platform-linux.cc       Fri May 21 23:35:27 2010
+++ /branches/bleeding_edge/src/platform-linux.cc       Mon May 31 03:09:07 2010
@@ -177,7 +177,8 @@
 #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");
=======================================
--- /branches/bleeding_edge/src/profile-generator.cc Tue May 18 08:18:23 2010 +++ /branches/bleeding_edge/src/profile-generator.cc Mon May 31 03:09:07 2010
@@ -572,7 +572,8 @@
 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 @@
     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;
 }

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to