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

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: Add asserts 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
Index: runtime/vm/object.cc
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 7aa09d38e61253480baf76438fc4513c81f61e3f..6d473df09d6c5021f3807145082701f8d38ed0f4 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();
@@ -5096,6 +5104,7 @@ void PatchClass::set_source_class(const Class& value) const {
bool Function::HasBreakpoint() const {
+ ASSERT(Isolate::Current()->debugger() != NULL);
return Isolate::Current()->debugger()->HasBreakpoint(*this);
}
@@ -5627,6 +5636,7 @@ void Function::SetIsNativeAutoSetupScope(bool value) const {
bool Function::CanBeInlined() const {
+ ASSERT(Isolate::Current()->debugger() != NULL);
return is_inlinable() &&
!is_generated_body() &&
HasCode() &&
@@ -12229,6 +12239,7 @@ void Code::set_static_calls_target_table(const Array& value) const {
bool Code::HasBreakpoint() const {
+ ASSERT(Isolate::Current()->debugger() != NULL);
return Isolate::Current()->debugger()->HasBreakpoint(*this);
}
« runtime/vm/isolate.cc ('K') | « runtime/vm/object.h ('k') | runtime/vm/object_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698