Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(82)

Side by Side Diff: runtime/vm/zone.cc

Issue 2418323002: Make fatal out of memory messages uniform. (Closed)
Patch Set: macro Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/service.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « runtime/vm/service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698