diff --git a/runtime/vm/heap/heap.cc b/runtime/vm/heap/heap.cc index d58c7112aa5..23cff41008a 100644 --- a/runtime/vm/heap/heap.cc +++ b/runtime/vm/heap/heap.cc @@ -54,7 +54,6 @@ Heap::Heap(IsolateGroup* isolate_group, : isolate_group_(isolate_group), new_space_(this, max_new_gen_semi_words), old_space_(this, max_old_gen_words), - read_only_(false), assume_scavenge_will_fail_(false), gc_on_nth_allocation_(kNoForcedGarbageCollection) { UpdateGlobalMaxUsed(); @@ -683,12 +682,6 @@ void Heap::UpdateGlobalMaxUsed() { (UsedInWords(Heap::kOld) * kWordSize)); } -void Heap::WriteProtect(bool read_only) { - read_only_ = read_only; - new_space_.WriteProtect(read_only); - old_space_.WriteProtect(read_only); -} - void Heap::Init(IsolateGroup* isolate_group, intptr_t max_new_gen_words, intptr_t max_old_gen_words) { diff --git a/runtime/vm/heap/heap.h b/runtime/vm/heap/heap.h index 4c6f671ccf9..15676170d9c 100644 --- a/runtime/vm/heap/heap.h +++ b/runtime/vm/heap/heap.h @@ -73,7 +73,6 @@ class Heap { PageSpace* old_space() { return &old_space_; } uword Allocate(Thread* thread, intptr_t size, Space space) { - ASSERT(!read_only_); switch (space) { case kNew: // Do not attempt to allocate very large objects in new space. @@ -129,7 +128,6 @@ class Heap { // Protect access to the heap. Note: Code pages are made // executable/non-executable when 'read_only' is true/false, respectively. - void WriteProtect(bool read_only); void WriteProtectCode(bool read_only) { old_space_.WriteProtectCode(read_only); } @@ -373,9 +371,6 @@ class Heap { RelaxedAtomic mode_ = {Dart_PerformanceMode_Default}; - // This heap is in read-only mode: No allocation is allowed. - bool read_only_; - bool assume_scavenge_will_fail_; static constexpr intptr_t kNoForcedGarbageCollection = -1; diff --git a/runtime/vm/heap/heap_test.cc b/runtime/vm/heap/heap_test.cc index 315791ca989..6b11d4f583a 100644 --- a/runtime/vm/heap/heap_test.cc +++ b/runtime/vm/heap/heap_test.cc @@ -190,21 +190,6 @@ TEST_CASE(ClassHeapStats) { } #endif // !PRODUCT -ISOLATE_UNIT_TEST_CASE(IterateReadOnly) { - const String& obj = String::Handle(String::New("x", Heap::kOld)); - - // It is not safe to make the heap read-only if marking or sweeping is in - // progress. - GCTestHelper::WaitForGCTasks(); - - Heap* heap = IsolateGroup::Current()->heap(); - EXPECT(heap->Contains(UntaggedObject::ToAddr(obj.ptr()))); - heap->WriteProtect(true); - EXPECT(heap->Contains(UntaggedObject::ToAddr(obj.ptr()))); - heap->WriteProtect(false); - EXPECT(heap->Contains(UntaggedObject::ToAddr(obj.ptr()))); -} - ISOLATE_UNIT_TEST_CASE(CollectAllGarbage_DeadOldToNew) { Heap* heap = IsolateGroup::Current()->heap();