| 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/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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |