diff options
author | 2015-01-26 14:45:59 +0000 | |
---|---|---|
committer | 2015-01-26 14:46:00 +0000 | |
commit | 76d032bacd65e396609631bb6aca3a90a80116f7 (patch) | |
tree | d53d23ed8ccacd41fffb70f2157506d0b9d59182 /compiler/utils/growable_array.h | |
parent | c2c25a939a8bc98365c282f76f8f33f9549034b8 (diff) | |
parent | 86dde1658a1951c251dd5c6ff21ecc5c281879a6 (diff) |
Merge "Introduce a SideEffectsAnalysis class."
Diffstat (limited to 'compiler/utils/growable_array.h')
-rw-r--r-- | compiler/utils/growable_array.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/compiler/utils/growable_array.h b/compiler/utils/growable_array.h index fde65e79c3..b84842910b 100644 --- a/compiler/utils/growable_array.h +++ b/compiler/utils/growable_array.h @@ -37,6 +37,18 @@ class GrowableArray : public ArenaObject<kArenaAllocGrowableArray> { kArenaAllocGrowableArray)); } + GrowableArray(ArenaAllocator* arena, size_t init_length, T initial_data) + : arena_(arena), + num_allocated_(init_length), + num_used_(0) { + SetSize(init_length); + elem_list_ = static_cast<T*>(arena_->Alloc(sizeof(T) * init_length, + kArenaAllocGrowableArray)); + for (size_t i = 0; i < init_length; ++i) { + elem_list_[i] = initial_data; + } + } + // Expand the list size to at least new length. void Resize(size_t new_length) { |