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

Unified Diff: runtime/vm/isolate.cc

Issue 14935005: Implement a variation of scalar replacement for non-escaping allocations. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: address comments Created 7 years, 7 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/isolate.h ('k') | runtime/vm/object.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/isolate.cc
diff --git a/runtime/vm/isolate.cc b/runtime/vm/isolate.cc
index 473f0010f0298b6b4b1027018fbded63d7b84391..d445f17fa55bd6c4166cc92721859f8a06f4e45d 100644
--- a/runtime/vm/isolate.cc
+++ b/runtime/vm/isolate.cc
@@ -311,6 +311,56 @@ void DeferredUint32x4::Materialize() {
}
+void DeferredObjectRef::Materialize() {
+ DeferredObject* obj = Isolate::Current()->GetDeferredObject(index());
+ *slot() = obj->object();
+ if (FLAG_trace_deoptimization_verbose) {
+ OS::PrintErr("writing instance ref at %"Px": %s\n",
+ reinterpret_cast<uword>(slot()),
+ Instance::Handle(obj->object()).ToCString());
+ }
+}
+
+
+RawInstance* DeferredObject::object() {
+ if (object_ == NULL) {
+ Materialize();
+ }
+ return object_->raw();
+}
+
+
+void DeferredObject::Materialize() {
+ Class& cls = Class::Handle();
+ cls ^= GetClass();
+
+ if (FLAG_trace_deoptimization_verbose) {
+ OS::PrintErr("materializing instance of %s (%"Px", %"Pd" fields)\n",
+ cls.ToCString(),
+ reinterpret_cast<uword>(args_),
+ field_count_);
+ }
+
+ const Instance& obj = Instance::ZoneHandle(Instance::New(cls));
+
+ Field& field = Field::Handle();
+ Object& value = Object::Handle();
+ for (intptr_t i = 0; i < field_count_; i++) {
+ field ^= GetField(i);
+ value = GetValue(i);
+ obj.SetField(field, value);
+
+ if (FLAG_trace_deoptimization_verbose) {
+ OS::PrintErr(" %s <- %s\n",
+ String::Handle(field.name()).ToCString(),
+ value.ToCString());
+ }
+ }
+
+ object_ = &obj;
+}
+
+
Isolate::Isolate()
: store_buffer_(),
message_notify_callback_(NULL),
@@ -344,6 +394,9 @@ Isolate::Isolate()
deopt_fpu_registers_copy_(NULL),
deopt_frame_copy_(NULL),
deopt_frame_copy_size_(0),
+ deferred_boxes_(NULL),
+ deferred_object_refs_(NULL),
+ deferred_objects_count_(0),
deferred_objects_(NULL),
stacktrace_(NULL),
stack_frame_index_(-1) {
@@ -994,6 +1047,31 @@ char* Isolate::GetStatus(const char* request) {
}
+static void FillDeferredSlots(DeferredSlot** slot_list) {
+ DeferredSlot* slot = *slot_list;
+ *slot_list = NULL;
+
+ while (slot != NULL) {
+ DeferredSlot* current = slot;
+ slot = slot->next();
+
+ current->Materialize();
+
+ delete current;
+ }
+}
+
+
+void Isolate::MaterializeDeferredBoxes() {
+ FillDeferredSlots(&deferred_boxes_);
+}
+
+
+void Isolate::MaterializeDeferredObjects() {
+ FillDeferredSlots(&deferred_object_refs_);
+}
+
+
static char* GetRootScriptUri(Isolate* isolate) {
const Library& library =
Library::Handle(isolate->object_store()->root_library());
« no previous file with comments | « runtime/vm/isolate.h ('k') | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698