Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(176)

Side by Side Diff: runtime/vm/heap.cc

Issue 1433463002: Allocate some data structures in old instead of in new space. Early inlining bailout for native fun… (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Spelling error Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/flow_graph_inliner.cc ('k') | runtime/vm/isolate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 ASSERT(Thread::Current()->no_safepoint_scope_depth() == 0); 154 ASSERT(Thread::Current()->no_safepoint_scope_depth() == 0);
155 uword addr = old_space_.TryAllocateDataBump(size, PageSpace::kControlGrowth); 155 uword addr = old_space_.TryAllocateDataBump(size, PageSpace::kControlGrowth);
156 if (addr != 0) return addr; 156 if (addr != 0) return addr;
157 return AllocateOld(size, HeapPage::kData); 157 return AllocateOld(size, HeapPage::kData);
158 } 158 }
159 159
160 160
161 void Heap::AllocateExternal(intptr_t size, Space space) { 161 void Heap::AllocateExternal(intptr_t size, Space space) {
162 ASSERT(Thread::Current()->no_safepoint_scope_depth() == 0); 162 ASSERT(Thread::Current()->no_safepoint_scope_depth() == 0);
163 if (space == kNew) { 163 if (space == kNew) {
164 isolate()->AssertCurrentThreadIsMutator();
164 new_space_.AllocateExternal(size); 165 new_space_.AllocateExternal(size);
165 if (new_space_.ExternalInWords() > (FLAG_new_gen_ext_limit * MBInWords)) { 166 if (new_space_.ExternalInWords() > (FLAG_new_gen_ext_limit * MBInWords)) {
166 // Attempt to free some external allocation by a scavenge. (If the total 167 // Attempt to free some external allocation by a scavenge. (If the total
167 // remains above the limit, next external alloc will trigger another.) 168 // remains above the limit, next external alloc will trigger another.)
168 CollectGarbage(kNew); 169 CollectGarbage(kNew);
169 } 170 }
170 } else { 171 } else {
171 ASSERT(space == kOld); 172 ASSERT(space == kOld);
172 old_space_.AllocateExternal(size); 173 old_space_.AllocateExternal(size);
173 if (old_space_.NeedsGarbageCollection()) { 174 if (old_space_.NeedsGarbageCollection()) {
174 CollectAllGarbage(); 175 CollectAllGarbage();
175 } 176 }
176 } 177 }
177 } 178 }
178 179
179 void Heap::FreeExternal(intptr_t size, Space space) { 180 void Heap::FreeExternal(intptr_t size, Space space) {
180 if (space == kNew) { 181 if (space == kNew) {
182 isolate()->AssertCurrentThreadIsMutator();
181 new_space_.FreeExternal(size); 183 new_space_.FreeExternal(size);
182 } else { 184 } else {
183 ASSERT(space == kOld); 185 ASSERT(space == kOld);
184 old_space_.FreeExternal(size); 186 old_space_.FreeExternal(size);
185 } 187 }
186 } 188 }
187 189
188 void Heap::PromoteExternal(intptr_t size) { 190 void Heap::PromoteExternal(intptr_t size) {
189 new_space_.FreeExternal(size); 191 new_space_.FreeExternal(size);
190 old_space_.AllocateExternal(size); 192 old_space_.AllocateExternal(size);
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after
806 Dart::vm_isolate()->heap()->WriteProtect(false, include_code_pages_); 808 Dart::vm_isolate()->heap()->WriteProtect(false, include_code_pages_);
807 } 809 }
808 810
809 811
810 WritableVMIsolateScope::~WritableVMIsolateScope() { 812 WritableVMIsolateScope::~WritableVMIsolateScope() {
811 ASSERT(Dart::vm_isolate()->heap()->UsedInWords(Heap::kNew) == 0); 813 ASSERT(Dart::vm_isolate()->heap()->UsedInWords(Heap::kNew) == 0);
812 Dart::vm_isolate()->heap()->WriteProtect(true, include_code_pages_); 814 Dart::vm_isolate()->heap()->WriteProtect(true, include_code_pages_);
813 } 815 }
814 816
815 } // namespace dart 817 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_inliner.cc ('k') | runtime/vm/isolate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698