| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 Segment::Delete(current); | 52 Segment::Delete(current); |
| 53 current = next; | 53 current = next; |
| 54 } | 54 } |
| 55 } | 55 } |
| 56 | 56 |
| 57 | 57 |
| 58 Zone::Segment* Zone::Segment::New(intptr_t size, Zone::Segment* next) { | 58 Zone::Segment* Zone::Segment::New(intptr_t size, Zone::Segment* next) { |
| 59 ASSERT(size >= 0); | 59 ASSERT(size >= 0); |
| 60 Segment* result = reinterpret_cast<Segment*>(malloc(size)); | 60 Segment* result = reinterpret_cast<Segment*>(malloc(size)); |
| 61 if (result == NULL) { | 61 if (result == NULL) { |
| 62 FATAL("Out of memory.\n"); | 62 OUT_OF_MEMORY(); |
| 63 } | 63 } |
| 64 ASSERT(Utils::IsAligned(result->start(), Zone::kAlignment)); | 64 ASSERT(Utils::IsAligned(result->start(), Zone::kAlignment)); |
| 65 #ifdef DEBUG | 65 #ifdef DEBUG |
| 66 // Zap the entire allocated segment (including the header). | 66 // Zap the entire allocated segment (including the header). |
| 67 memset(result, kZapUninitializedByte, size); | 67 memset(result, kZapUninitializedByte, size); |
| 68 #endif | 68 #endif |
| 69 result->next_ = next; | 69 result->next_ = next; |
| 70 result->size_ = size; | 70 result->size_ = size; |
| 71 return result; | 71 return result; |
| 72 } | 72 } |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 ASSERT(thread()->zone() == &zone_); | 274 ASSERT(thread()->zone() == &zone_); |
| 275 thread()->set_zone(zone_.previous_); | 275 thread()->set_zone(zone_.previous_); |
| 276 if (FLAG_trace_zones) { | 276 if (FLAG_trace_zones) { |
| 277 OS::PrintErr("*** Deleting Stack zone 0x%" Px "(0x%" Px ")\n", | 277 OS::PrintErr("*** Deleting Stack zone 0x%" Px "(0x%" Px ")\n", |
| 278 reinterpret_cast<intptr_t>(this), | 278 reinterpret_cast<intptr_t>(this), |
| 279 reinterpret_cast<intptr_t>(&zone_)); | 279 reinterpret_cast<intptr_t>(&zone_)); |
| 280 } | 280 } |
| 281 } | 281 } |
| 282 | 282 |
| 283 } // namespace dart | 283 } // namespace dart |
| OLD | NEW |