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

Unified Diff: runtime/vm/object.cc

Issue 1168933002: Fixes crashes in VM isolate shutdown. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« runtime/vm/debugger.cc ('K') | « runtime/vm/object.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index d95d307668ba37b42e9980ae11f4ba5dfb406bae..ba35f868122b9002bc03e655c4bdbe3870be8dce 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -378,12 +378,31 @@ static type SpecialCharacter(type value) {
}
-void Object::InitOnce(Isolate* isolate) {
+void Object::InitNull(Isolate* isolate) {
// Should only be run by the vm isolate.
ASSERT(isolate == Dart::vm_isolate());
// TODO(iposva): NoSafepointScope needs to be added here.
ASSERT(class_class() == null_);
+
+ Heap* heap = isolate->heap();
+
+ // Allocate and initialize the null instance.
+ // 'null_' must be the first object allocated as it is used in allocation to
+ // clear the object.
+ {
+ uword address = heap->Allocate(Instance::InstanceSize(), Heap::kOld);
+ null_ = reinterpret_cast<RawInstance*>(address + kHeapObjectTag);
+ // The call below is using 'null_' to initialize itself.
+ InitializeObject(address, kNullCid, Instance::InstanceSize());
+ }
+}
+
+
+void Object::InitOnce(Isolate* isolate) {
+ // Should only be run by the vm isolate.
+ ASSERT(isolate == Dart::vm_isolate());
+
// Initialize the static vtable values.
{
Object fake_object;
@@ -418,17 +437,6 @@ void Object::InitOnce(Isolate* isolate) {
branch_offset_error_ = LanguageError::ReadOnlyHandle();
vm_isolate_snapshot_object_table_ = Array::ReadOnlyHandle();
-
- // Allocate and initialize the null instance.
- // 'null_' must be the first object allocated as it is used in allocation to
- // clear the object.
- {
- uword address = heap->Allocate(Instance::InstanceSize(), Heap::kOld);
- null_ = reinterpret_cast<RawInstance*>(address + kHeapObjectTag);
- // The call below is using 'null_' to initialize itself.
- InitializeObject(address, kNullCid, Instance::InstanceSize());
- }
-
*null_object_ = Object::null();
*null_array_ = Array::null();
*null_string_ = String::null();
« runtime/vm/debugger.cc ('K') | « runtime/vm/object.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698