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

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

Issue 342503002: Heap::AllocateExternal may trigger GC, so fix String::MakeExternal. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/dart_api_state.h ('k') | runtime/vm/object.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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 if (addr == 0) { 85 if (addr == 0) {
86 OS::PrintErr("Exhausted heap space, trying to allocate %" Pd " bytes.\n", 86 OS::PrintErr("Exhausted heap space, trying to allocate %" Pd " bytes.\n",
87 size); 87 size);
88 return 0; 88 return 0;
89 } 89 }
90 } 90 }
91 return addr; 91 return addr;
92 } 92 }
93 93
94 void Heap::AllocateExternal(intptr_t size, Space space) { 94 void Heap::AllocateExternal(intptr_t size, Space space) {
95 ASSERT(isolate()->no_gc_scope_depth() == 0);
95 if (space == kNew) { 96 if (space == kNew) {
96 new_space_->AllocateExternal(size); 97 new_space_->AllocateExternal(size);
97 if (new_space_->ExternalInWords() > (FLAG_new_gen_ext_limit * MBInWords)) { 98 if (new_space_->ExternalInWords() > (FLAG_new_gen_ext_limit * MBInWords)) {
98 // Attempt to free some external allocation by a scavenge. (If the total 99 // Attempt to free some external allocation by a scavenge. (If the total
99 // remains above the limit, next external alloc will trigger another.) 100 // remains above the limit, next external alloc will trigger another.)
100 CollectGarbage(kNew); 101 CollectGarbage(kNew);
101 } 102 }
102 } else { 103 } else {
103 ASSERT(space == kOld); 104 ASSERT(space == kOld);
104 old_space_->AllocateExternal(size); 105 old_space_->AllocateExternal(size);
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 heap->DisableGrowthControl(); 579 heap->DisableGrowthControl();
579 } 580 }
580 581
581 582
582 NoHeapGrowthControlScope::~NoHeapGrowthControlScope() { 583 NoHeapGrowthControlScope::~NoHeapGrowthControlScope() {
583 Heap* heap = reinterpret_cast<Isolate*>(isolate())->heap(); 584 Heap* heap = reinterpret_cast<Isolate*>(isolate())->heap();
584 heap->SetGrowthControlState(current_growth_controller_state_); 585 heap->SetGrowthControlState(current_growth_controller_state_);
585 } 586 }
586 587
587 } // namespace dart 588 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/dart_api_state.h ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698