| 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 OS::PrintErr("New space (%dk) Old space (%dk) " | 86 OS::PrintErr("New space (%dk) Old space (%dk) " |
| 87 "Code space (%dk) Stub Code space(%dk)\n", | 87 "Code space (%dk) Stub Code space(%dk)\n", |
| 88 (new_space_->in_use() / KB), | 88 (new_space_->in_use() / KB), |
| 89 (old_space_->in_use() / KB), | 89 (old_space_->in_use() / KB), |
| 90 (code_space_->in_use() / KB), | 90 (code_space_->in_use() / KB), |
| 91 (stub_code_space_->in_use() / KB)); | 91 (stub_code_space_->in_use() / KB)); |
| 92 } | 92 } |
| 93 addr = old_space_->TryAllocate(size); | 93 addr = old_space_->TryAllocate(size); |
| 94 if (addr == 0) { | 94 if (addr == 0) { |
| 95 // TODO(cshapiro): Support possible heap growth and OOM exception. | 95 // TODO(cshapiro): Support possible heap growth and OOM exception. |
| 96 FATAL("Exhausted heap space."); | 96 FATAL1("Exhausted heap space, trying to allocate %d bytes.", size); |
| 97 } | 97 } |
| 98 } | 98 } |
| 99 return addr; | 99 return addr; |
| 100 } | 100 } |
| 101 | 101 |
| 102 | 102 |
| 103 uword Heap::AllocateCode(PageSpace* space, intptr_t size) { | 103 uword Heap::AllocateCode(PageSpace* space, intptr_t size) { |
| 104 ASSERT(Isolate::Current()->no_gc_scope_depth() == 0); | 104 ASSERT(Isolate::Current()->no_gc_scope_depth() == 0); |
| 105 ASSERT(Utils::IsAligned(size, OS::PreferredCodeAlignment())); | 105 ASSERT(Utils::IsAligned(size, OS::PreferredCodeAlignment())); |
| 106 uword addr = space->TryAllocate(size); | 106 uword addr = space->TryAllocate(size); |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 isolate()->IncrementNoGCScopeDepth(); | 249 isolate()->IncrementNoGCScopeDepth(); |
| 250 } | 250 } |
| 251 | 251 |
| 252 | 252 |
| 253 NoGCScope::~NoGCScope() { | 253 NoGCScope::~NoGCScope() { |
| 254 isolate()->DecrementNoGCScopeDepth(); | 254 isolate()->DecrementNoGCScopeDepth(); |
| 255 } | 255 } |
| 256 #endif // defined(DEBUG) | 256 #endif // defined(DEBUG) |
| 257 | 257 |
| 258 } // namespace dart | 258 } // namespace dart |
| OLD | NEW |