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

Unified Diff: runtime/vm/deferred_objects.cc

Issue 395943003: Support allocation sinking for compound objects. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: improve tests Created 6 years, 5 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
« no previous file with comments | « runtime/vm/deferred_objects.h ('k') | runtime/vm/deopt_instructions.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « runtime/vm/deferred_objects.h ('k') | runtime/vm/deopt_instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698