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

Side by Side Diff: runtime/vm/debuginfo.h

Issue 16271010: Use 'new' in all the snapshot reallocation functions instead of realloc. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/dart_api_message.cc ('k') | runtime/vm/megamorphic_cache_table.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_DEBUGINFO_H_ 5 #ifndef VM_DEBUGINFO_H_
6 #define VM_DEBUGINFO_H_ 6 #define VM_DEBUGINFO_H_
7 7
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "platform/utils.h" 9 #include "platform/utils.h"
10 #include "vm/globals.h" 10 #include "vm/globals.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 // Append an element. 43 // Append an element.
44 void Add(const uint8_t value) { 44 void Add(const uint8_t value) {
45 Resize(size() + 1); 45 Resize(size() + 1);
46 data_[size() - 1] = value; 46 data_[size() - 1] = value;
47 } 47 }
48 48
49 private: 49 private:
50 void Resize(int new_size) { 50 void Resize(int new_size) {
51 if (new_size > capacity_) { 51 if (new_size > capacity_) {
52 int new_capacity = Utils::RoundUpToPowerOfTwo(new_size); 52 int new_capacity = Utils::RoundUpToPowerOfTwo(new_size);
53 uint8_t* new_data = 53 uint8_t* new_data = Utils::Realloc(data_, capacity_, new_capacity);
54 reinterpret_cast<uint8_t*>(realloc(data_, new_capacity));
55 ASSERT(new_data != NULL); 54 ASSERT(new_data != NULL);
56 data_ = new_data; 55 data_ = new_data;
57 capacity_ = new_capacity; 56 capacity_ = new_capacity;
58 } 57 }
59 size_ = new_size; 58 size_ = new_size;
60 } 59 }
61 60
62 int size_; 61 int size_;
63 int capacity_; 62 int capacity_;
64 uint8_t* data_; 63 uint8_t* data_;
(...skipping 28 matching lines...) Expand all
93 private: 92 private:
94 void* handle_; 93 void* handle_;
95 DebugInfo(); 94 DebugInfo();
96 95
97 DISALLOW_COPY_AND_ASSIGN(DebugInfo); 96 DISALLOW_COPY_AND_ASSIGN(DebugInfo);
98 }; 97 };
99 98
100 } // namespace dart 99 } // namespace dart
101 100
102 #endif // VM_DEBUGINFO_H_ 101 #endif // VM_DEBUGINFO_H_
OLDNEW
« no previous file with comments | « runtime/vm/dart_api_message.cc ('k') | runtime/vm/megamorphic_cache_table.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698