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/heap.h" | 10 #include "vm/heap.h" |
11 #include "vm/heap_trace.h" | |
12 #include "vm/isolate.h" | 11 #include "vm/isolate.h" |
13 #include "vm/os.h" | 12 #include "vm/os.h" |
14 | 13 |
15 namespace dart { | 14 namespace dart { |
16 | 15 |
17 DEFINE_DEBUG_FLAG(bool, trace_zones, | 16 DEFINE_DEBUG_FLAG(bool, trace_zones, |
18 false, "Traces allocation sizes in the zone."); | 17 false, "Traces allocation sizes in the zone."); |
19 | 18 |
20 | 19 |
21 // Zone segments represent chunks of memory: They have starting | 20 // Zone segments represent chunks of memory: They have starting |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 } | 90 } |
92 | 91 |
93 | 92 |
94 Zone::~Zone() { | 93 Zone::~Zone() { |
95 #if defined(DEBUG) | 94 #if defined(DEBUG) |
96 if (FLAG_trace_zones) { | 95 if (FLAG_trace_zones) { |
97 DumpZoneSizes(); | 96 DumpZoneSizes(); |
98 } | 97 } |
99 #endif | 98 #endif |
100 DeleteAll(); | 99 DeleteAll(); |
101 if (HeapTrace::is_enabled()) { | |
102 Isolate* isolate = Isolate::Current(); | |
103 isolate->heap()->trace()->TraceDeleteZone(this); | |
104 } | |
105 } | 100 } |
106 | 101 |
107 | 102 |
108 void Zone::DeleteAll() { | 103 void Zone::DeleteAll() { |
109 // Traverse the chained list of segments, zapping (in debug mode) | 104 // Traverse the chained list of segments, zapping (in debug mode) |
110 // and freeing every zone segment. | 105 // and freeing every zone segment. |
111 Segment::DeleteSegmentList(head_); | 106 Segment::DeleteSegmentList(head_); |
112 Segment::DeleteSegmentList(large_segments_); | 107 Segment::DeleteSegmentList(large_segments_); |
113 | 108 |
114 // Reset zone state. | 109 // Reset zone state. |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 va_list args2; | 256 va_list args2; |
262 va_start(args2, format); | 257 va_start(args2, format); |
263 OS::VSNPrint(buffer, (len + 1), format, args2); | 258 OS::VSNPrint(buffer, (len + 1), format, args2); |
264 va_end(args2); | 259 va_end(args2); |
265 | 260 |
266 return buffer; | 261 return buffer; |
267 } | 262 } |
268 | 263 |
269 | 264 |
270 } // namespace dart | 265 } // namespace dart |
OLD | NEW |