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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
253 va_end(args); | 253 va_end(args); |
254 return buffer; | 254 return buffer; |
255 } | 255 } |
256 | 256 |
257 | 257 |
258 char* Zone::VPrint(const char* format, va_list args) { | 258 char* Zone::VPrint(const char* format, va_list args) { |
259 return OS::VSCreate(this, format, args); | 259 return OS::VSCreate(this, format, args); |
260 } | 260 } |
261 | 261 |
262 | 262 |
263 #if defined(DEBUG) | |
zra
2016/12/08 18:54:13
ditto
bkonyi
2016/12/08 20:58:32
Done.
| |
264 void Zone::PrintJSON(JSONStream* stream, bool ref) const { | |
265 JSONObject jsobj(stream); | |
266 intptr_t capacity = SizeInBytes(); | |
267 intptr_t used_size = UsedSizeInBytes(); | |
268 jsobj.AddProperty("type", "_Zone"); | |
269 jsobj.AddProperty("capacity", capacity); | |
270 jsobj.AddProperty("used", used_size); | |
271 } | |
272 #endif | |
273 | |
zra
2016/12/08 18:54:14
two newlines between functions.
bkonyi
2016/12/08 20:58:32
Done.
| |
263 StackZone::StackZone(Thread* thread) : StackResource(thread), zone_() { | 274 StackZone::StackZone(Thread* thread) : StackResource(thread), zone_() { |
264 if (FLAG_trace_zones) { | 275 if (FLAG_trace_zones) { |
265 OS::PrintErr("*** Starting a new Stack zone 0x%" Px "(0x%" Px ")\n", | 276 OS::PrintErr("*** Starting a new Stack zone 0x%" Px "(0x%" Px ")\n", |
266 reinterpret_cast<intptr_t>(this), | 277 reinterpret_cast<intptr_t>(this), |
267 reinterpret_cast<intptr_t>(&zone_)); | 278 reinterpret_cast<intptr_t>(&zone_)); |
268 } | 279 } |
269 zone_.Link(thread->zone()); | 280 zone_.Link(thread->zone()); |
270 thread->set_zone(&zone_); | 281 thread->set_zone(&zone_); |
271 } | 282 } |
272 | 283 |
273 | 284 |
274 StackZone::~StackZone() { | 285 StackZone::~StackZone() { |
275 ASSERT(thread()->zone() == &zone_); | 286 ASSERT(thread()->zone() == &zone_); |
276 thread()->set_zone(zone_.previous_); | 287 thread()->set_zone(zone_.previous_); |
277 if (FLAG_trace_zones) { | 288 if (FLAG_trace_zones) { |
278 OS::PrintErr("*** Deleting Stack zone 0x%" Px "(0x%" Px ")\n", | 289 OS::PrintErr("*** Deleting Stack zone 0x%" Px "(0x%" Px ")\n", |
279 reinterpret_cast<intptr_t>(this), | 290 reinterpret_cast<intptr_t>(this), |
280 reinterpret_cast<intptr_t>(&zone_)); | 291 reinterpret_cast<intptr_t>(&zone_)); |
281 } | 292 } |
282 } | 293 } |
283 | 294 |
284 } // namespace dart | 295 } // namespace dart |
OLD | NEW |