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

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

Issue 1374373004: Clarify heap write protection interface and use WritableVMIsolateScope to resolve issue 23217. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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/heap.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 761 matching lines...) Expand 10 before | Expand all | Expand 10 after
772 current_growth_controller_state_ = heap->GrowthControlState(); 772 current_growth_controller_state_ = heap->GrowthControlState();
773 heap->DisableGrowthControl(); 773 heap->DisableGrowthControl();
774 } 774 }
775 775
776 776
777 NoHeapGrowthControlScope::~NoHeapGrowthControlScope() { 777 NoHeapGrowthControlScope::~NoHeapGrowthControlScope() {
778 Heap* heap = reinterpret_cast<Isolate*>(isolate())->heap(); 778 Heap* heap = reinterpret_cast<Isolate*>(isolate())->heap();
779 heap->SetGrowthControlState(current_growth_controller_state_); 779 heap->SetGrowthControlState(current_growth_controller_state_);
780 } 780 }
781 781
782
783 WritableVMIsolateScope::WritableVMIsolateScope(Thread* thread)
784 : StackResource(thread) {
785 Dart::vm_isolate()->heap()->WriteProtect(false);
786 }
787
788
789 WritableVMIsolateScope::~WritableVMIsolateScope() {
790 ASSERT(Dart::vm_isolate()->heap()->UsedInWords(Heap::kNew) == 0);
791 Dart::vm_isolate()->heap()->WriteProtect(true);
792 }
793
782 } // namespace dart 794 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/heap.h ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698