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

Unified Diff: runtime/vm/object.cc

Issue 142233002: Make sure all new Code objects have a non-null PcDescriptors (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 11 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 711140949112522c953cb854200bf5160b61f488..77ac8be00780b83583f17765404e8f6aa0194242 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -89,6 +89,7 @@ String* Object::null_string_ = NULL;
Instance* Object::null_instance_ = NULL;
AbstractTypeArguments* Object::null_abstract_type_arguments_ = NULL;
Array* Object::empty_array_ = NULL;
+PcDescriptors* Object::empty_descriptors_ = NULL;
Instance* Object::sentinel_ = NULL;
Instance* Object::transition_sentinel_ = NULL;
Instance* Object::unknown_constant_ = NULL;
@@ -435,6 +436,7 @@ void Object::InitOnce() {
null_instance_ = Instance::ReadOnlyHandle();
null_abstract_type_arguments_ = AbstractTypeArguments::ReadOnlyHandle();
empty_array_ = Array::ReadOnlyHandle();
+ empty_descriptors_ = PcDescriptors::ReadOnlyHandle();
sentinel_ = Instance::ReadOnlyHandle();
transition_sentinel_ = Instance::ReadOnlyHandle();
unknown_constant_ = Instance::ReadOnlyHandle();
@@ -645,6 +647,18 @@ void Object::InitOnce() {
empty_array_->raw()->ptr()->length_ = Smi::New(0);
}
+ // Allocate and initialize the empty_descriptors instance.
+ {
+ uword address = heap->Allocate(PcDescriptors::InstanceSize(0), Heap::kOld);
+ InitializeObject(address, kPcDescriptorsCid,
+ PcDescriptors::InstanceSize(0));
+ PcDescriptors::initializeHandle(
+ empty_descriptors_,
+ reinterpret_cast<RawPcDescriptors*>(address + kHeapObjectTag));
+ empty_descriptors_->raw()->ptr()->length_ = Smi::New(0);
Ivan Posva 2014/01/21 06:36:05 Can't you use raw_ptr() instead of raw()->ptr()? S
Cutch 2014/01/21 15:49:58 Done here and above.
+ }
+
+
cls = Class::New<Instance>(kDynamicCid);
cls.set_is_abstract();
cls.set_num_type_arguments(0);
@@ -9882,6 +9896,7 @@ RawCode* Code::New(intptr_t pointer_offsets_length) {
result.set_is_optimized(false);
result.set_is_alive(true);
result.set_comments(Comments::New(0));
+ result.set_pc_descriptors(Object::empty_descriptors());
}
return result.raw();
}
« runtime/vm/object.h ('K') | « runtime/vm/object.h ('k') | runtime/vm/raw_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698