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

Unified Diff: runtime/vm/object.cc

Issue 565513002: Optimize LocalVarDescriptor objects for functions that have no local variables (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 3 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/object.h ('k') | runtime/vm/raw_object.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
===================================================================
--- runtime/vm/object.cc (revision 40154)
+++ runtime/vm/object.cc (working copy)
@@ -98,6 +98,7 @@
Array* Object::empty_array_ = NULL;
Array* Object::zero_array_ = NULL;
PcDescriptors* Object::empty_descriptors_ = NULL;
+LocalVarDescriptors* Object::empty_var_descriptors_ = NULL;
Instance* Object::sentinel_ = NULL;
Instance* Object::transition_sentinel_ = NULL;
Instance* Object::unknown_constant_ = NULL;
@@ -435,6 +436,7 @@
empty_array_ = Array::ReadOnlyHandle();
zero_array_ = Array::ReadOnlyHandle();
empty_descriptors_ = PcDescriptors::ReadOnlyHandle();
+ empty_var_descriptors_ = LocalVarDescriptors::ReadOnlyHandle();
sentinel_ = Instance::ReadOnlyHandle();
transition_sentinel_ = Instance::ReadOnlyHandle();
unknown_constant_ = Instance::ReadOnlyHandle();
@@ -665,6 +667,20 @@
empty_descriptors_->raw_ptr()->length_ = 0;
}
+ // Allocate and initialize the canonical empty variable descriptor object.
+ {
+ uword address = heap->Allocate(
+ LocalVarDescriptors::InstanceSize(0), Heap::kOld);
+ InitializeObject(address, kLocalVarDescriptorsCid,
+ LocalVarDescriptors::InstanceSize(0));
+ LocalVarDescriptors::initializeHandle(
+ empty_var_descriptors_,
+ reinterpret_cast<RawLocalVarDescriptors*>(address + kHeapObjectTag));
+ empty_var_descriptors_->raw_ptr()->length_ = 0;
+ // Can't use instance mentod StorePointer() here, but this pointer
+ // assignment is safe (from old space to old space).
+ empty_var_descriptors_->raw_ptr()->names_ = empty_array_->raw_ptr();
+ }
cls = Class::New<Instance>(kDynamicCid);
cls.set_is_abstract();
« no previous file with comments | « 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