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

Unified Diff: runtime/vm/growable_array.h

Issue 10836061: Change the zone allocation api. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
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
Index: runtime/vm/growable_array.h
===================================================================
--- runtime/vm/growable_array.h (revision 10080)
+++ runtime/vm/growable_array.h (working copy)
@@ -28,7 +28,7 @@
ASSERT(zone_ != NULL);
if (initial_capacity > 0) {
capacity_ = Utils::RoundUpToPowerOfTwo(initial_capacity);
- data_ = reinterpret_cast<T*>(zone_->Allocate(capacity_ * sizeof(T)));
+ data_ = zone_->Alloc<T>(capacity_);
}
}
@@ -116,10 +116,7 @@
void BaseGrowableArray<T, B>::Resize(int new_length) {
if (new_length > capacity_) {
int new_capacity = Utils::RoundUpToPowerOfTwo(new_length);
- T* new_data = reinterpret_cast<T*>(
- zone_->Reallocate(reinterpret_cast<uword>(data_),
- capacity_ * sizeof(T),
- new_capacity * sizeof(T)));
+ T* new_data = zone_->Realloc<T>(data_, capacity_, new_capacity);
ASSERT(new_data != NULL);
data_ = new_data;
capacity_ = new_capacity;

Powered by Google App Engine
This is Rietveld 408576698