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

Side by Side Diff: runtime/vm/object.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.cc ('k') | runtime/vm/pages.h » ('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/object.h" 5 #include "vm/object.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/cpu.h" 10 #include "vm/cpu.h"
(...skipping 933 matching lines...) Expand 10 before | Expand all | Expand 10 after
944 SET_CLASS_NAME(unhandled_exception, UnhandledException); 944 SET_CLASS_NAME(unhandled_exception, UnhandledException);
945 SET_CLASS_NAME(unwind_error, UnwindError); 945 SET_CLASS_NAME(unwind_error, UnwindError);
946 946
947 // Set up names for object array and one byte string class which are 947 // Set up names for object array and one byte string class which are
948 // pre-allocated in the vm isolate also. 948 // pre-allocated in the vm isolate also.
949 cls = isolate->object_store()->array_class(); 949 cls = isolate->object_store()->array_class();
950 cls.set_name(Symbols::_List()); 950 cls.set_name(Symbols::_List());
951 cls = isolate->object_store()->one_byte_string_class(); 951 cls = isolate->object_store()->one_byte_string_class();
952 cls.set_name(Symbols::OneByteString()); 952 cls.set_name(Symbols::OneByteString());
953 953
954 // Make the VM isolate read-only after setting all objects as marked. 954 {
955 PremarkingVisitor premarker(isolate); 955 ASSERT(isolate == Dart::vm_isolate());
956 isolate->heap()->WriteProtect(false); 956 WritableVMIsolateScope scope(Thread::Current());
957 ASSERT(isolate->heap()->UsedInWords(Heap::kNew) == 0); 957 PremarkingVisitor premarker(isolate);
958 isolate->heap()->IterateOldObjects(&premarker); 958 ASSERT(isolate->heap()->UsedInWords(Heap::kNew) == 0);
959 isolate->heap()->WriteProtect(true); 959 isolate->heap()->IterateOldObjects(&premarker);
960 // Make the VM isolate read-only again after setting all objects as marked.
961 }
960 } 962 }
961 963
962 964
963 void Object::InitVmIsolateSnapshotObjectTable(intptr_t len) { 965 void Object::InitVmIsolateSnapshotObjectTable(intptr_t len) {
964 ASSERT(Isolate::Current() == Dart::vm_isolate()); 966 ASSERT(Isolate::Current() == Dart::vm_isolate());
965 *vm_isolate_snapshot_object_table_ = Array::New(len, Heap::kOld); 967 *vm_isolate_snapshot_object_table_ = Array::New(len, Heap::kOld);
966 } 968 }
967 969
968 970
969 // Make unused space in an object whose type has been transformed safe 971 // Make unused space in an object whose type has been transformed safe
(...skipping 20474 matching lines...) Expand 10 before | Expand all | Expand 10 after
21444 return tag_label.ToCString(); 21446 return tag_label.ToCString();
21445 } 21447 }
21446 21448
21447 21449
21448 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { 21450 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const {
21449 Instance::PrintJSONImpl(stream, ref); 21451 Instance::PrintJSONImpl(stream, ref);
21450 } 21452 }
21451 21453
21452 21454
21453 } // namespace dart 21455 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/heap.cc ('k') | runtime/vm/pages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698