| 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/flags.h" | 9 #include "vm/flags.h" |
| 10 #include "vm/isolate.h" | 10 #include "vm/isolate.h" |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 ASSERT(space == kOld); | 172 ASSERT(space == kOld); |
| 173 old_space_.AllocateExternal(size); | 173 old_space_.AllocateExternal(size); |
| 174 if (old_space_.NeedsGarbageCollection()) { | 174 if (old_space_.NeedsGarbageCollection()) { |
| 175 CollectAllGarbage(); | 175 CollectAllGarbage(); |
| 176 } | 176 } |
| 177 } | 177 } |
| 178 } | 178 } |
| 179 | 179 |
| 180 void Heap::FreeExternal(intptr_t size, Space space) { | 180 void Heap::FreeExternal(intptr_t size, Space space) { |
| 181 if (space == kNew) { | 181 if (space == kNew) { |
| 182 isolate()->AssertCurrentThreadIsMutator(); | |
| 183 new_space_.FreeExternal(size); | 182 new_space_.FreeExternal(size); |
| 184 } else { | 183 } else { |
| 185 ASSERT(space == kOld); | 184 ASSERT(space == kOld); |
| 186 old_space_.FreeExternal(size); | 185 old_space_.FreeExternal(size); |
| 187 } | 186 } |
| 188 } | 187 } |
| 189 | 188 |
| 190 void Heap::PromoteExternal(intptr_t size) { | 189 void Heap::PromoteExternal(intptr_t size) { |
| 191 new_space_.FreeExternal(size); | 190 new_space_.FreeExternal(size); |
| 192 old_space_.AllocateExternal(size); | 191 old_space_.AllocateExternal(size); |
| (...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 808 Dart::vm_isolate()->heap()->WriteProtect(false, include_code_pages_); | 807 Dart::vm_isolate()->heap()->WriteProtect(false, include_code_pages_); |
| 809 } | 808 } |
| 810 | 809 |
| 811 | 810 |
| 812 WritableVMIsolateScope::~WritableVMIsolateScope() { | 811 WritableVMIsolateScope::~WritableVMIsolateScope() { |
| 813 ASSERT(Dart::vm_isolate()->heap()->UsedInWords(Heap::kNew) == 0); | 812 ASSERT(Dart::vm_isolate()->heap()->UsedInWords(Heap::kNew) == 0); |
| 814 Dart::vm_isolate()->heap()->WriteProtect(true, include_code_pages_); | 813 Dart::vm_isolate()->heap()->WriteProtect(true, include_code_pages_); |
| 815 } | 814 } |
| 816 | 815 |
| 817 } // namespace dart | 816 } // namespace dart |
| OLD | NEW |