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

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

Issue 2995063002: [VM-GC] Add a flag to abort on allocation failure (Closed)
Patch Set: Explain flag use better Created 3 years, 4 months 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/flag_list.h ('k') | no next file » | 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/pages.h" 5 #include "vm/pages.h"
6 6
7 #include "platform/address_sanitizer.h" 7 #include "platform/address_sanitizer.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/compiler_stats.h" 9 #include "vm/compiler_stats.h"
10 #include "vm/gc_marker.h" 10 #include "vm/gc_marker.h"
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 } 225 }
226 226
227 HeapPage* PageSpace::AllocatePage(HeapPage::PageType type) { 227 HeapPage* PageSpace::AllocatePage(HeapPage::PageType type) {
228 const bool is_exec = (type == HeapPage::kExecutable); 228 const bool is_exec = (type == HeapPage::kExecutable);
229 const intptr_t kVmNameSize = 128; 229 const intptr_t kVmNameSize = 128;
230 char vm_name[kVmNameSize]; 230 char vm_name[kVmNameSize];
231 Heap::RegionName(heap_, is_exec ? Heap::kCode : Heap::kOld, vm_name, 231 Heap::RegionName(heap_, is_exec ? Heap::kCode : Heap::kOld, vm_name,
232 kVmNameSize); 232 kVmNameSize);
233 HeapPage* page = HeapPage::Allocate(kPageSizeInWords, type, vm_name); 233 HeapPage* page = HeapPage::Allocate(kPageSizeInWords, type, vm_name);
234 if (page == NULL) { 234 if (page == NULL) {
235 RELEASE_ASSERT(!FLAG_abort_on_oom);
235 return NULL; 236 return NULL;
236 } 237 }
237 238
238 MutexLocker ml(pages_lock_); 239 MutexLocker ml(pages_lock_);
239 if (!is_exec) { 240 if (!is_exec) {
240 if (pages_ == NULL) { 241 if (pages_ == NULL) {
241 pages_ = page; 242 pages_ = page;
242 } else { 243 } else {
243 pages_tail_->set_next(page); 244 pages_tail_->set_next(page);
244 } 245 }
(...skipping 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after
1276 return 0; 1277 return 0;
1277 } else { 1278 } else {
1278 ASSERT(total_time >= gc_time); 1279 ASSERT(total_time >= gc_time);
1279 int result = static_cast<int>( 1280 int result = static_cast<int>(
1280 (static_cast<double>(gc_time) / static_cast<double>(total_time)) * 100); 1281 (static_cast<double>(gc_time) / static_cast<double>(total_time)) * 100);
1281 return result; 1282 return result;
1282 } 1283 }
1283 } 1284 }
1284 1285
1285 } // namespace dart 1286 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/flag_list.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698