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

Unified Diff: runtime/vm/object.cc

Issue 566053002: Save more memory by compacting LocalVarDescriptors (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
Index: runtime/vm/object.cc
===================================================================
--- runtime/vm/object.cc (revision 40213)
+++ runtime/vm/object.cc (working copy)
@@ -669,17 +669,15 @@
// Allocate and initialize the canonical empty variable descriptor object.
{
- uword address = heap->Allocate(
- LocalVarDescriptors::InstanceSize(0), Heap::kOld);
- InitializeObject(address, kLocalVarDescriptorsCid,
- LocalVarDescriptors::InstanceSize(0));
+ 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();
+ empty_var_descriptors_->raw_ptr()->num_entries_ = 0;
}
cls = Class::New<Instance>(kDynamicCid);
@@ -10800,11 +10798,7 @@
RawString* LocalVarDescriptors::GetName(intptr_t var_index) const {
ASSERT(var_index < Length());
- const Array& names = Array::Handle(raw_ptr()->names_);
- ASSERT(Length() == names.Length());
- String& name = String::Handle();
- name ^= names.At(var_index);
- return name.raw();
+ return raw_ptr()->names()[var_index];
siva 2014/09/12 22:08:39 return raw_ptr()->nameAt(var_index); (see raw_obj
hausner 2014/09/12 23:48:04 Done.
}
@@ -10812,9 +10806,7 @@
const String& name,
RawLocalVarDescriptors::VarInfo* info) const {
ASSERT(var_index < Length());
- const Array& names = Array::Handle(raw_ptr()->names_);
- ASSERT(Length() == names.Length());
- names.SetAt(var_index, name);
+ StorePointer(raw_ptr()->names() + var_index, name.raw());
siva 2014/09/12 22:08:39 StorePointer(&(raw_ptr()->nameAt(var_index)), name
hausner 2014/09/12 23:48:04 Done.
raw_ptr()->data()[var_index] = *info;
}
@@ -10994,17 +10986,14 @@
Heap::kOld);
NoGCScope no_gc;
result ^= raw;
- result.raw_ptr()->length_ = num_variables;
+ result.raw_ptr()->num_entries_ = num_variables;
}
- const Array& names = (num_variables == 0) ? Object::empty_array() :
- Array::Handle(Array::New(num_variables, Heap::kOld));
- result.raw_ptr()->names_ = names.raw();
return result.raw();
}
intptr_t LocalVarDescriptors::Length() const {
- return raw_ptr()->length_;
+ return raw_ptr()->num_entries_;
}
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/raw_object.h » ('j') | runtime/vm/raw_object.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698