Index: runtime/vm/deferred_objects.cc |
diff --git a/runtime/vm/deferred_objects.cc b/runtime/vm/deferred_objects.cc |
index d0efc36fc84b6f780de45c9efd107d114bc95a4c..a275a5c9b62f4538635b24ddb076a5692adc5a49 100644 |
--- a/runtime/vm/deferred_objects.cc |
+++ b/runtime/vm/deferred_objects.cc |
@@ -97,13 +97,17 @@ void DeferredObjectRef::Materialize(DeoptContext* deopt_context) { |
RawInstance* DeferredObject::object() { |
if (object_ == NULL) { |
- Materialize(); |
+ Create(); |
} |
return object_->raw(); |
} |
-void DeferredObject::Materialize() { |
+void DeferredObject::Create() { |
+ if (object_ != NULL) { |
+ return; |
+ } |
+ |
Class& cls = Class::Handle(); |
cls ^= GetClass(); |
@@ -114,7 +118,17 @@ void DeferredObject::Materialize() { |
field_count_); |
} |
- const Instance& obj = Instance::ZoneHandle(Instance::New(cls)); |
+ object_ = &Instance::ZoneHandle(Instance::New(cls)); |
+} |
+ |
+ |
+void DeferredObject::Fill() { |
+ Create(); // Ensure instance is created. |
+ |
+ Class& cls = Class::Handle(); |
+ cls ^= GetClass(); |
+ |
+ const Instance& obj = *object_; |
Smi& offset = Smi::Handle(); |
Field& field = Field::Handle(); |
@@ -143,8 +157,6 @@ void DeferredObject::Materialize() { |
} |
} |
} |
- |
- object_ = &obj; |
} |
} // namespace dart |