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

Side by Side Diff: vm/heap.cc

Issue 10417046: - Enable throwing of OOM on allocation failure. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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/heap.h" 5 #include "vm/heap.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/compiler_stats.h" 9 #include "vm/compiler_stats.h"
10 #include "vm/flags.h" 10 #include "vm/flags.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 ASSERT(Isolate::Current()->no_gc_scope_depth() == 0); 71 ASSERT(Isolate::Current()->no_gc_scope_depth() == 0);
72 uword addr = old_space_->TryAllocate(size); 72 uword addr = old_space_->TryAllocate(size);
73 if (addr == 0) { 73 if (addr == 0) {
74 CollectAllGarbage(); 74 CollectAllGarbage();
75 if (FLAG_verbose_gc) { 75 if (FLAG_verbose_gc) {
76 PrintSizes(); 76 PrintSizes();
77 } 77 }
78 addr = old_space_->TryAllocate(size); 78 addr = old_space_->TryAllocate(size);
79 if (addr == 0) { 79 if (addr == 0) {
80 // TODO(cshapiro): Support possible heap growth and OOM exception. 80 // TODO(cshapiro): Support possible heap growth and OOM exception.
81 FATAL1("Exhausted heap space, trying to allocate %d bytes.", size); 81 OS::PrintErr("Exhausted heap space, trying to allocate %d bytes.\n",
82 size);
82 } 83 }
83 } 84 }
84 return addr; 85 return addr;
85 } 86 }
86 87
87 88
88 uword Heap::AllocateCode(PageSpace* space, intptr_t size) { 89 uword Heap::AllocateCode(PageSpace* space, intptr_t size) {
89 ASSERT(Isolate::Current()->no_gc_scope_depth() == 0); 90 ASSERT(Isolate::Current()->no_gc_scope_depth() == 0);
90 ASSERT(Utils::IsAligned(size, OS::PreferredCodeAlignment())); 91 ASSERT(Utils::IsAligned(size, OS::PreferredCodeAlignment()));
91 uword addr = space->TryAllocate(size); 92 uword addr = space->TryAllocate(size);
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 isolate()->IncrementNoGCScopeDepth(); 218 isolate()->IncrementNoGCScopeDepth();
218 } 219 }
219 220
220 221
221 NoGCScope::~NoGCScope() { 222 NoGCScope::~NoGCScope() {
222 isolate()->DecrementNoGCScopeDepth(); 223 isolate()->DecrementNoGCScopeDepth();
223 } 224 }
224 #endif // defined(DEBUG) 225 #endif // defined(DEBUG)
225 226
226 } // namespace dart 227 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698