| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 return addr; | 66 return addr; |
| 67 } | 67 } |
| 68 return AllocateOld(size); | 68 return AllocateOld(size); |
| 69 } | 69 } |
| 70 | 70 |
| 71 | 71 |
| 72 uword Heap::AllocateOld(intptr_t size) { | 72 uword Heap::AllocateOld(intptr_t size) { |
| 73 ASSERT(Isolate::Current()->no_gc_scope_depth() == 0); | 73 ASSERT(Isolate::Current()->no_gc_scope_depth() == 0); |
| 74 uword addr = old_space_->TryAllocate(size); | 74 uword addr = old_space_->TryAllocate(size); |
| 75 if (addr == 0) { | 75 if (addr == 0) { |
| 76 CollectGarbage(kOld); | 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 } | 84 } |
| 85 return addr; | 85 return addr; |
| 86 } | 86 } |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 isolate()->IncrementNoGCScopeDepth(); | 187 isolate()->IncrementNoGCScopeDepth(); |
| 188 } | 188 } |
| 189 | 189 |
| 190 | 190 |
| 191 NoGCScope::~NoGCScope() { | 191 NoGCScope::~NoGCScope() { |
| 192 isolate()->DecrementNoGCScopeDepth(); | 192 isolate()->DecrementNoGCScopeDepth(); |
| 193 } | 193 } |
| 194 #endif // defined(DEBUG) | 194 #endif // defined(DEBUG) |
| 195 | 195 |
| 196 } // namespace dart | 196 } // namespace dart |
| OLD | NEW |