| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 uword addr = old_space_->TryAllocate(size); | 74 uword addr = old_space_->TryAllocate(size); |
| 75 if (addr == 0) { | 75 if (addr == 0) { |
| 76 CollectAllGarbage(); | 76 CollectAllGarbage(); |
| 77 if (FLAG_verbose_gc) { | 77 if (FLAG_verbose_gc) { |
| 78 OS::PrintErr("New space (%dk) Old space (%dk) Code space (%dk)\n", | 78 OS::PrintErr("New space (%dk) Old space (%dk) Code space (%dk)\n", |
| 79 (new_space_->in_use() / KB), | 79 (new_space_->in_use() / KB), |
| 80 (old_space_->in_use() / KB), | 80 (old_space_->in_use() / KB), |
| 81 (code_space_->in_use() / KB)); | 81 (code_space_->in_use() / KB)); |
| 82 } | 82 } |
| 83 addr = old_space_->TryAllocate(size); | 83 addr = old_space_->TryAllocate(size); |
| 84 if (addr == 0) { |
| 85 // TODO(iposva): Support possible heap growth. |
| 86 FATAL("Exhausted heap space."); |
| 87 } |
| 84 } | 88 } |
| 85 return addr; | 89 return addr; |
| 86 } | 90 } |
| 87 | 91 |
| 88 | 92 |
| 89 uword Heap::AllocateCode(intptr_t size) { | 93 uword Heap::AllocateCode(intptr_t size) { |
| 90 ASSERT(Isolate::Current()->no_gc_scope_depth() == 0); | 94 ASSERT(Isolate::Current()->no_gc_scope_depth() == 0); |
| 91 ASSERT(Utils::IsAligned(size, OS::PreferredCodeAlignment())); | 95 ASSERT(Utils::IsAligned(size, OS::PreferredCodeAlignment())); |
| 92 uword addr = code_space_->TryAllocate(size); | 96 uword addr = code_space_->TryAllocate(size); |
| 93 if (addr == 0) { | 97 if (addr == 0) { |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 isolate()->IncrementNoGCScopeDepth(); | 211 isolate()->IncrementNoGCScopeDepth(); |
| 208 } | 212 } |
| 209 | 213 |
| 210 | 214 |
| 211 NoGCScope::~NoGCScope() { | 215 NoGCScope::~NoGCScope() { |
| 212 isolate()->DecrementNoGCScopeDepth(); | 216 isolate()->DecrementNoGCScopeDepth(); |
| 213 } | 217 } |
| 214 #endif // defined(DEBUG) | 218 #endif // defined(DEBUG) |
| 215 | 219 |
| 216 } // namespace dart | 220 } // namespace dart |
| OLD | NEW |