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

Unified Diff: src/objects-inl.h

Issue 10808029: Don't use alloca. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index 9e866e3317906da88babfad09de25e10e657c5b8..e48787b03856d7e24a6cd8e496f525d0bab94a29 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -3503,11 +3503,11 @@ void Map::set_instance_descriptors(DescriptorArray* value,
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 @@ void Map::InitializeDescriptors(DescriptorArray* descriptors) {
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;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698