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 #include "vm/zone.h" | 5 #include "vm/zone.h" |
6 | 6 |
7 #include "platform/assert.h" | 7 #include "platform/assert.h" |
8 #include "platform/utils.h" | 8 #include "platform/utils.h" |
9 #include "vm/flags.h" | 9 #include "vm/flags.h" |
10 #include "vm/handles_impl.h" | 10 #include "vm/handles_impl.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 #endif | 56 #endif |
57 Segment::Delete(current); | 57 Segment::Delete(current); |
58 current = next; | 58 current = next; |
59 } | 59 } |
60 } | 60 } |
61 | 61 |
62 | 62 |
63 Zone::Segment* Zone::Segment::New(intptr_t size, Zone::Segment* next) { | 63 Zone::Segment* Zone::Segment::New(intptr_t size, Zone::Segment* next) { |
64 ASSERT(size >= 0); | 64 ASSERT(size >= 0); |
65 Segment* result = reinterpret_cast<Segment*>(new uint8_t[size]); | 65 Segment* result = reinterpret_cast<Segment*>(new uint8_t[size]); |
| 66 ASSERT(Utils::IsAligned(result->start(), Zone::kAlignment)); |
66 if (result != NULL) { | 67 if (result != NULL) { |
67 #ifdef DEBUG | 68 #ifdef DEBUG |
68 // Zap the entire allocated segment (including the header). | 69 // Zap the entire allocated segment (including the header). |
69 memset(result, kZapUninitializedByte, size); | 70 memset(result, kZapUninitializedByte, size); |
70 #endif | 71 #endif |
71 result->next_ = next; | 72 result->next_ = next; |
72 result->size_ = size; | 73 result->size_ = size; |
73 } | 74 } |
74 return result; | 75 return result; |
75 } | 76 } |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 va_list args2; | 210 va_list args2; |
210 va_start(args2, format); | 211 va_start(args2, format); |
211 OS::VSNPrint(buffer, (len + 1), format, args2); | 212 OS::VSNPrint(buffer, (len + 1), format, args2); |
212 va_end(args2); | 213 va_end(args2); |
213 | 214 |
214 return buffer; | 215 return buffer; |
215 } | 216 } |
216 | 217 |
217 | 218 |
218 } // namespace dart | 219 } // namespace dart |
OLD | NEW |