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/heap.h" | 11 #include "vm/heap.h" |
11 #include "vm/isolate.h" | 12 #include "vm/isolate.h" |
12 #include "vm/os.h" | 13 #include "vm/os.h" |
13 | 14 |
14 namespace dart { | 15 namespace dart { |
15 | 16 |
16 DEFINE_DEBUG_FLAG(bool, trace_zones, | 17 DEFINE_DEBUG_FLAG(bool, trace_zones, |
17 false, "Traces allocation sizes in the zone."); | 18 false, "Traces allocation sizes in the zone."); |
18 | 19 |
19 | 20 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 Segment::DeleteSegmentList(large_segments_); | 108 Segment::DeleteSegmentList(large_segments_); |
108 | 109 |
109 // Reset zone state. | 110 // Reset zone state. |
110 #ifdef DEBUG | 111 #ifdef DEBUG |
111 memset(initial_buffer_.pointer(), kZapDeletedByte, initial_buffer_.size()); | 112 memset(initial_buffer_.pointer(), kZapDeletedByte, initial_buffer_.size()); |
112 #endif | 113 #endif |
113 position_ = initial_buffer_.start(); | 114 position_ = initial_buffer_.start(); |
114 limit_ = initial_buffer_.end(); | 115 limit_ = initial_buffer_.end(); |
115 head_ = NULL; | 116 head_ = NULL; |
116 large_segments_ = NULL; | 117 large_segments_ = NULL; |
| 118 previous_ = NULL; |
| 119 handles_.Reset(); |
117 } | 120 } |
118 | 121 |
119 | 122 |
120 intptr_t Zone::SizeInBytes() const { | 123 intptr_t Zone::SizeInBytes() const { |
121 intptr_t size = 0; | 124 intptr_t size = 0; |
122 for (Segment* s = large_segments_; s != NULL; s = s->next()) { | 125 for (Segment* s = large_segments_; s != NULL; s = s->next()) { |
123 size += s->size(); | 126 size += s->size(); |
124 } | 127 } |
125 if (head_ == NULL) { | 128 if (head_ == NULL) { |
126 return size + (position_ - initial_buffer_.start()); | 129 return size + (position_ - initial_buffer_.start()); |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 va_list args2; | 259 va_list args2; |
257 va_start(args2, format); | 260 va_start(args2, format); |
258 OS::VSNPrint(buffer, (len + 1), format, args2); | 261 OS::VSNPrint(buffer, (len + 1), format, args2); |
259 va_end(args2); | 262 va_end(args2); |
260 | 263 |
261 return buffer; | 264 return buffer; |
262 } | 265 } |
263 | 266 |
264 | 267 |
265 } // namespace dart | 268 } // namespace dart |
OLD | NEW |