| 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" |
| 11 #include "vm/heap_trace.h" |
| 10 #include "vm/isolate.h" | 12 #include "vm/isolate.h" |
| 11 #include "vm/os.h" | 13 #include "vm/os.h" |
| 12 | 14 |
| 13 namespace dart { | 15 namespace dart { |
| 14 | 16 |
| 15 DEFINE_DEBUG_FLAG(bool, trace_zone_sizes, | 17 DEFINE_DEBUG_FLAG(bool, trace_zone_sizes, |
| 16 false, "Traces allocation sizes in the zone."); | 18 false, "Traces allocation sizes in the zone."); |
| 17 | 19 |
| 18 | 20 |
| 19 // Zone segments represent chunks of memory: They have starting | 21 // Zone segments represent chunks of memory: They have starting |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 #ifdef DEBUG | 86 #ifdef DEBUG |
| 85 // Zap the entire initial buffer. | 87 // Zap the entire initial buffer. |
| 86 memset(initial_buffer_.pointer(), kZapUninitializedByte, | 88 memset(initial_buffer_.pointer(), kZapUninitializedByte, |
| 87 initial_buffer_.size()); | 89 initial_buffer_.size()); |
| 88 #endif | 90 #endif |
| 89 } | 91 } |
| 90 | 92 |
| 91 | 93 |
| 92 Zone::~Zone() { | 94 Zone::~Zone() { |
| 93 DeleteAll(); | 95 DeleteAll(); |
| 96 if (HeapTrace::is_enabled()) { |
| 97 Isolate* isolate = Isolate::Current(); |
| 98 isolate->heap()->trace()->TraceDeleteZone(this); |
| 99 } |
| 94 #if defined(DEBUG) | 100 #if defined(DEBUG) |
| 95 if (FLAG_trace_zone_sizes) { | 101 if (FLAG_trace_zone_sizes) { |
| 96 DumpZoneSizes(); | 102 DumpZoneSizes(); |
| 97 } | 103 } |
| 98 #endif | 104 #endif |
| 99 } | 105 } |
| 100 | 106 |
| 101 | 107 |
| 102 void Zone::DeleteAll() { | 108 void Zone::DeleteAll() { |
| 103 // Traverse the chained list of segments, zapping (in debug mode) | 109 // Traverse the chained list of segments, zapping (in debug mode) |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 va_list args2; | 244 va_list args2; |
| 239 va_start(args2, format); | 245 va_start(args2, format); |
| 240 OS::VSNPrint(buffer, (len + 1), format, args2); | 246 OS::VSNPrint(buffer, (len + 1), format, args2); |
| 241 va_end(args2); | 247 va_end(args2); |
| 242 | 248 |
| 243 return buffer; | 249 return buffer; |
| 244 } | 250 } |
| 245 | 251 |
| 246 | 252 |
| 247 } // namespace dart | 253 } // namespace dart |
| OLD | NEW |