Revision: 12137
Author:   [email protected]
Date:     Thu Jul 19 00:32:58 2012
Log:      Don't use alloca.

It leads to compability hell, and the amount of memory we need is bounded,
anyway. Added a few more assertions on the way.

Review URL: https://chromiumcodereview.appspot.com/10808029
http://code.google.com/p/v8/source/detail?r=12137

Modified:
 /branches/bleeding_edge/src/objects-inl.h

=======================================
--- /branches/bleeding_edge/src/objects-inl.h   Wed Jul 18 08:38:58 2012
+++ /branches/bleeding_edge/src/objects-inl.h   Thu Jul 19 00:32:58 2012
@@ -3503,11 +3503,11 @@

 void Map::InitializeDescriptors(DescriptorArray* descriptors) {
   int len = descriptors->number_of_descriptors();
+  ASSERT(len <= DescriptorArray::kMaxNumberOfDescriptors);
   SLOW_ASSERT(descriptors->IsSortedNoDuplicates());

 #ifdef DEBUG
-  bool* used_indices =
-      reinterpret_cast<bool*>(alloca(sizeof(*used_indices) * len));
+  bool used_indices[DescriptorArray::kMaxNumberOfDescriptors];
   for (int i = 0; i < len; ++i) used_indices[i] = false;

// Ensure that all enumeration indexes between 1 and length occur uniquely in
@@ -3515,6 +3515,7 @@
   for (int i = 0; i < len; ++i) {
     int enum_index = descriptors->GetDetails(i).index() -
                      PropertyDetails::kInitialIndex;
+    ASSERT(0 <= enum_index && enum_index < len);
     ASSERT(!used_indices[enum_index]);
     used_indices[enum_index] = true;
   }

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

Reply via email to