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

Unified Diff: runtime/vm/object.cc

Issue 564143003: Revert revision 40228 (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 40230)
+++ runtime/vm/object.cc (working copy)
@@ -669,15 +669,17 @@
// 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()->num_entries_ = 0;
+ 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);
@@ -10798,8 +10800,11 @@
RawString* LocalVarDescriptors::GetName(intptr_t var_index) const {
ASSERT(var_index < Length());
- ASSERT(Object::Handle(*raw()->nameAddrAt(var_index)).IsString());
- return *raw()->nameAddrAt(var_index);
+ const Array& names = Array::Handle(raw_ptr()->names_);
+ ASSERT(Length() == names.Length());
+ String& name = String::Handle();
+ name ^= names.At(var_index);
+ return name.raw();
}
@@ -10807,15 +10812,17 @@
const String& name,
RawLocalVarDescriptors::VarInfo* info) const {
ASSERT(var_index < Length());
- StorePointer(raw()->nameAddrAt(var_index), name.raw());
- raw()->data()[var_index] = *info;
+ const Array& names = Array::Handle(raw_ptr()->names_);
+ ASSERT(Length() == names.Length());
+ names.SetAt(var_index, name);
+ raw_ptr()->data()[var_index] = *info;
}
void LocalVarDescriptors::GetInfo(intptr_t var_index,
RawLocalVarDescriptors::VarInfo* info) const {
ASSERT(var_index < Length());
- *info = raw()->data()[var_index];
+ *info = raw_ptr()->data()[var_index];
}
@@ -10987,14 +10994,17 @@
Heap::kOld);
NoGCScope no_gc;
result ^= raw;
- result.raw_ptr()->num_entries_ = num_variables;
+ result.raw_ptr()->length_ = 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()->num_entries_;
+ return raw_ptr()->length_;
}
« 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