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_ZONE_H_ | 5 #ifndef VM_ZONE_H_ |
6 #define VM_ZONE_H_ | 6 #define VM_ZONE_H_ |
7 | 7 |
8 #include "platform/utils.h" | 8 #include "platform/utils.h" |
9 #include "vm/allocation.h" | 9 #include "vm/allocation.h" |
10 #include "vm/handles.h" | 10 #include "vm/handles.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 // | 39 // |
40 // It is preferred to use Alloc<T>() instead, as that function can | 40 // It is preferred to use Alloc<T>() instead, as that function can |
41 // check for integer overflow. If you use AllocUnsafe, you are | 41 // check for integer overflow. If you use AllocUnsafe, you are |
42 // responsible for avoiding integer overflow yourself. | 42 // responsible for avoiding integer overflow yourself. |
43 inline uword AllocUnsafe(intptr_t size); | 43 inline uword AllocUnsafe(intptr_t size); |
44 | 44 |
45 | 45 |
46 // Make a copy of the string in the zone allocated area. | 46 // Make a copy of the string in the zone allocated area. |
47 char* MakeCopyOfString(const char* str); | 47 char* MakeCopyOfString(const char* str); |
48 | 48 |
| 49 // Concatenate strings |a| and |b|. |a| may be NULL. If |a| is not NULL, |
| 50 // |join| will be inserted between |a| and |b|. |
| 51 char* ConcatStrings(const char* a, const char* b, char join = ','); |
| 52 |
49 // TODO(zra): Remove these calls and replace them with calls to OS::SCreate | 53 // TODO(zra): Remove these calls and replace them with calls to OS::SCreate |
50 // and OS::VSCreate. | 54 // and OS::VSCreate. |
51 // These calls are deprecated. Do not add further calls to these functions. | 55 // These calls are deprecated. Do not add further calls to these functions. |
52 // instead use OS::SCreate and OS::VSCreate. | 56 // instead use OS::SCreate and OS::VSCreate. |
53 // Make a zone-allocated string based on printf format and args. | 57 // Make a zone-allocated string based on printf format and args. |
54 char* PrintToString(const char* format, ...) PRINTF_ATTRIBUTE(2, 3); | 58 char* PrintToString(const char* format, ...) PRINTF_ATTRIBUTE(2, 3); |
55 char* VPrint(const char* format, va_list args); | 59 char* VPrint(const char* format, va_list args); |
56 | 60 |
57 // Compute the total size of this zone. This includes wasted space that is | 61 // Compute the total size of this zone. This includes wasted space that is |
58 // due to internal fragmentation in the segments. | 62 // due to internal fragmentation in the segments. |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 memmove(reinterpret_cast<void*>(new_data), | 290 memmove(reinterpret_cast<void*>(new_data), |
287 reinterpret_cast<void*>(old_data), | 291 reinterpret_cast<void*>(old_data), |
288 old_len * kElementSize); | 292 old_len * kElementSize); |
289 } | 293 } |
290 return new_data; | 294 return new_data; |
291 } | 295 } |
292 | 296 |
293 } // namespace dart | 297 } // namespace dart |
294 | 298 |
295 #endif // VM_ZONE_H_ | 299 #endif // VM_ZONE_H_ |
OLD | NEW |