OLD | NEW |
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 Loading... |
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 = Utils::Realloc(data_, capacity_, new_capacity); | 53 uint8_t* new_data = |
| 54 reinterpret_cast<uint8_t*>(realloc(data_, new_capacity)); |
54 ASSERT(new_data != NULL); | 55 ASSERT(new_data != NULL); |
55 data_ = new_data; | 56 data_ = new_data; |
56 capacity_ = new_capacity; | 57 capacity_ = new_capacity; |
57 } | 58 } |
58 size_ = new_size; | 59 size_ = new_size; |
59 } | 60 } |
60 | 61 |
61 int size_; | 62 int size_; |
62 int capacity_; | 63 int capacity_; |
63 uint8_t* data_; | 64 uint8_t* data_; |
(...skipping 28 matching lines...) Expand all Loading... |
92 private: | 93 private: |
93 void* handle_; | 94 void* handle_; |
94 DebugInfo(); | 95 DebugInfo(); |
95 | 96 |
96 DISALLOW_COPY_AND_ASSIGN(DebugInfo); | 97 DISALLOW_COPY_AND_ASSIGN(DebugInfo); |
97 }; | 98 }; |
98 | 99 |
99 } // namespace dart | 100 } // namespace dart |
100 | 101 |
101 #endif // VM_DEBUGINFO_H_ | 102 #endif // VM_DEBUGINFO_H_ |
OLD | NEW |