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

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

Issue 1408653002: Skip making code pages temporarily writable when finalizing the VM isolate loaded from precompiled … (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
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 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 void Heap::SetGrowthControlState(bool state) { 466 void Heap::SetGrowthControlState(bool state) {
467 old_space_.SetGrowthControlState(state); 467 old_space_.SetGrowthControlState(state);
468 } 468 }
469 469
470 470
471 bool Heap::GrowthControlState() { 471 bool Heap::GrowthControlState() {
472 return old_space_.GrowthControlState(); 472 return old_space_.GrowthControlState();
473 } 473 }
474 474
475 475
476 void Heap::WriteProtect(bool read_only) { 476 void Heap::WriteProtect(bool read_only, bool include_code_pages) {
477 read_only_ = read_only; 477 read_only_ = read_only;
478 new_space_.WriteProtect(read_only); 478 new_space_.WriteProtect(read_only);
479 old_space_.WriteProtect(read_only); 479 old_space_.WriteProtect(read_only, include_code_pages);
480 } 480 }
481 481
482 482
483 Heap::Space Heap::SpaceForAllocation(intptr_t cid) { 483 Heap::Space Heap::SpaceForAllocation(intptr_t cid) {
484 return FLAG_pretenure_all ? kPretenured : kNew; 484 return FLAG_pretenure_all ? kPretenured : kNew;
485 } 485 }
486 486
487 487
488 intptr_t Heap::TopOffset(Heap::Space space) { 488 intptr_t Heap::TopOffset(Heap::Space space) {
489 if (space == kNew) { 489 if (space == kNew) {
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
793 heap->DisableGrowthControl(); 793 heap->DisableGrowthControl();
794 } 794 }
795 795
796 796
797 NoHeapGrowthControlScope::~NoHeapGrowthControlScope() { 797 NoHeapGrowthControlScope::~NoHeapGrowthControlScope() {
798 Heap* heap = reinterpret_cast<Isolate*>(isolate())->heap(); 798 Heap* heap = reinterpret_cast<Isolate*>(isolate())->heap();
799 heap->SetGrowthControlState(current_growth_controller_state_); 799 heap->SetGrowthControlState(current_growth_controller_state_);
800 } 800 }
801 801
802 802
803 WritableVMIsolateScope::WritableVMIsolateScope(Thread* thread) 803 WritableVMIsolateScope::WritableVMIsolateScope(Thread* thread,
804 : StackResource(thread) { 804 bool include_code_pages)
805 Dart::vm_isolate()->heap()->WriteProtect(false); 805 : StackResource(thread), include_code_pages_(include_code_pages) {
806 Dart::vm_isolate()->heap()->WriteProtect(false, include_code_pages_);
806 } 807 }
807 808
808 809
809 WritableVMIsolateScope::~WritableVMIsolateScope() { 810 WritableVMIsolateScope::~WritableVMIsolateScope() {
810 ASSERT(Dart::vm_isolate()->heap()->UsedInWords(Heap::kNew) == 0); 811 ASSERT(Dart::vm_isolate()->heap()->UsedInWords(Heap::kNew) == 0);
811 Dart::vm_isolate()->heap()->WriteProtect(true); 812 Dart::vm_isolate()->heap()->WriteProtect(true, include_code_pages_);
812 } 813 }
813 814
814 } // namespace dart 815 } // namespace dart
OLDNEW
« runtime/vm/heap.h ('K') | « runtime/vm/heap.h ('k') | runtime/vm/heap_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698