| 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 size += s->size(); | 107 size += s->size(); |
| 108 } | 108 } |
| 109 return size + (position_ - head_->start()); | 109 return size + (position_ - head_->start()); |
| 110 } | 110 } |
| 111 | 111 |
| 112 | 112 |
| 113 uword Zone::AllocateExpand(intptr_t size) { | 113 uword Zone::AllocateExpand(intptr_t size) { |
| 114 #if defined(DEBUG) | 114 #if defined(DEBUG) |
| 115 ASSERT(size >= 0); | 115 ASSERT(size >= 0); |
| 116 if (FLAG_trace_zones) { | 116 if (FLAG_trace_zones) { |
| 117 OS::PrintErr("*** Expanding zone 0x%"Px"\n", | 117 OS::PrintErr("*** Expanding zone 0x%" Px "\n", |
| 118 reinterpret_cast<intptr_t>(this)); | 118 reinterpret_cast<intptr_t>(this)); |
| 119 DumpZoneSizes(); | 119 DumpZoneSizes(); |
| 120 } | 120 } |
| 121 // Make sure the requested size is already properly aligned and that | 121 // Make sure the requested size is already properly aligned and that |
| 122 // there isn't enough room in the Zone to satisfy the request. | 122 // there isn't enough room in the Zone to satisfy the request. |
| 123 ASSERT(Utils::IsAligned(size, kAlignment)); | 123 ASSERT(Utils::IsAligned(size, kAlignment)); |
| 124 intptr_t free_size = (limit_ - position_); | 124 intptr_t free_size = (limit_ - position_); |
| 125 ASSERT(free_size < size); | 125 ASSERT(free_size < size); |
| 126 #endif | 126 #endif |
| 127 | 127 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 return copy; | 172 return copy; |
| 173 } | 173 } |
| 174 | 174 |
| 175 | 175 |
| 176 #if defined(DEBUG) | 176 #if defined(DEBUG) |
| 177 void Zone::DumpZoneSizes() { | 177 void Zone::DumpZoneSizes() { |
| 178 intptr_t size = 0; | 178 intptr_t size = 0; |
| 179 for (Segment* s = large_segments_; s != NULL; s = s->next()) { | 179 for (Segment* s = large_segments_; s != NULL; s = s->next()) { |
| 180 size += s->size(); | 180 size += s->size(); |
| 181 } | 181 } |
| 182 OS::PrintErr("*** Zone(0x%"Px") size in bytes," | 182 OS::PrintErr("*** Zone(0x%" Px ") size in bytes," |
| 183 " Total = %"Pd" Large Segments = %"Pd"\n", | 183 " Total = %" Pd " Large Segments = %" Pd "\n", |
| 184 reinterpret_cast<intptr_t>(this), SizeInBytes(), size); | 184 reinterpret_cast<intptr_t>(this), SizeInBytes(), size); |
| 185 } | 185 } |
| 186 #endif | 186 #endif |
| 187 | 187 |
| 188 | 188 |
| 189 void Zone::VisitObjectPointers(ObjectPointerVisitor* visitor) { | 189 void Zone::VisitObjectPointers(ObjectPointerVisitor* visitor) { |
| 190 Zone* zone = this; | 190 Zone* zone = this; |
| 191 while (zone != NULL) { | 191 while (zone != NULL) { |
| 192 zone->handles()->VisitObjectPointers(visitor); | 192 zone->handles()->VisitObjectPointers(visitor); |
| 193 zone = zone->previous_; | 193 zone = zone->previous_; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 205 va_list args2; | 205 va_list args2; |
| 206 va_start(args2, format); | 206 va_start(args2, format); |
| 207 OS::VSNPrint(buffer, (len + 1), format, args2); | 207 OS::VSNPrint(buffer, (len + 1), format, args2); |
| 208 va_end(args2); | 208 va_end(args2); |
| 209 | 209 |
| 210 return buffer; | 210 return buffer; |
| 211 } | 211 } |
| 212 | 212 |
| 213 | 213 |
| 214 } // namespace dart | 214 } // namespace dart |
| OLD | NEW |