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

Unified Diff: runtime/vm/object.cc

Issue 382993003: More PcDescriptor cleanups. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: 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
Index: runtime/vm/object.cc
===================================================================
--- runtime/vm/object.cc (revision 38196)
+++ runtime/vm/object.cc (working copy)
@@ -660,9 +660,11 @@
// Allocate and initialize the empty_descriptors instance.
{
- uword address = heap->Allocate(PcDescriptors::InstanceSize(0), Heap::kOld);
+ uword address = heap->Allocate(
+ PcDescriptors::InstanceSize(0, RawPcDescriptors::kCompressedRecSize),
+ Heap::kOld);
InitializeObject(address, kPcDescriptorsCid,
- PcDescriptors::InstanceSize(0));
+ PcDescriptors::InstanceSize(0, RawPcDescriptors::kCompressedRecSize));
PcDescriptors::initializeHandle(
empty_descriptors_,
reinterpret_cast<RawPcDescriptors*>(address + kHeapObjectTag));
@@ -10219,7 +10221,18 @@
}
-RawPcDescriptors* PcDescriptors::New(intptr_t num_descriptors) {
+intptr_t PcDescriptors::RecordSizeInBytes() const {
+ return raw_ptr()->record_size_in_bytes_;
+}
+
+
+void PcDescriptors::SetRecordSizeInBytes(intptr_t value) const {
+ raw_ptr()->record_size_in_bytes_ = value;
+}
+
+
+RawPcDescriptors* PcDescriptors::New(intptr_t num_descriptors,
+ bool has_try_index) {
ASSERT(Object::pc_descriptors_class() != Class::null());
if (num_descriptors < 0 || num_descriptors > kMaxElements) {
// This should be caught before we reach here.
@@ -10228,13 +10241,20 @@
}
PcDescriptors& result = PcDescriptors::Handle();
{
- uword size = PcDescriptors::InstanceSize(num_descriptors);
+ uword size = PcDescriptors::InstanceSize(num_descriptors,
+ has_try_index ? RawPcDescriptors::kFullRecSize
+ : RawPcDescriptors::kCompressedRecSize);
RawObject* raw = Object::Allocate(PcDescriptors::kClassId,
size,
Heap::kOld);
NoGCScope no_gc;
result ^= raw;
result.SetLength(num_descriptors);
+ if (has_try_index) {
+ result.SetRecordSizeInBytes(RawPcDescriptors::kFullRecSize);
+ } else {
+ result.SetRecordSizeInBytes(RawPcDescriptors::kCompressedRecSize);
+ }
}
return result.raw();
}
@@ -10285,9 +10305,9 @@
len += OS::SNPrint(NULL, 0, kFormat, addr_width,
rec.pc,
KindAsStr(rec.kind()),
- rec.deopt_id,
- rec.token_pos,
- rec.try_index);
+ rec.deopt_id(),
+ rec.token_pos(),
+ rec.try_index());
}
// Allocate the buffer.
char* buffer = Isolate::Current()->current_zone()->Alloc<char>(len);
@@ -10299,9 +10319,9 @@
index += OS::SNPrint((buffer + index), (len - index), kFormat, addr_width,
rec.pc,
KindAsStr(rec.kind()),
- rec.deopt_id,
- rec.token_pos,
- rec.try_index);
+ rec.deopt_id(),
+ rec.token_pos(),
+ rec.try_index());
}
return buffer;
}
@@ -10320,9 +10340,9 @@
JSONObject descriptor(&members);
descriptor.AddPropertyF("pc", "%" Px "", rec.pc);
descriptor.AddProperty("kind", KindAsStr(rec.kind()));
- descriptor.AddProperty("deoptId", static_cast<intptr_t>(rec.deopt_id));
- descriptor.AddProperty("tokenPos", static_cast<intptr_t>(rec.token_pos));
- descriptor.AddProperty("tryIndex", static_cast<intptr_t>(rec.try_index));
+ descriptor.AddProperty("deoptId", static_cast<intptr_t>(rec.deopt_id()));
+ descriptor.AddProperty("tokenPos", static_cast<intptr_t>(rec.token_pos()));
+ descriptor.AddProperty("tryIndex", static_cast<intptr_t>(rec.try_index()));
}
}
@@ -10359,7 +10379,7 @@
// 'deopt_id' is set for kDeopt and kIcCall and must be unique for one kind.
intptr_t deopt_id = Isolate::kNoDeoptId;
- deopt_id = rec.deopt_id;
+ deopt_id = rec.deopt_id();
if (Isolate::IsDeoptAfter(deopt_id)) {
// TODO(vegorov): some instructions contain multiple calls and have
// multiple "after" targets recorded. Right now it is benign but might
@@ -10372,7 +10392,7 @@
const RawPcDescriptors::PcDescriptorRec& nested_rec = nested.Next();
if (kind == nested_rec.kind()) {
if (deopt_id != Isolate::kNoDeoptId) {
- ASSERT(nested_rec.deopt_id != deopt_id);
+ ASSERT(nested_rec.deopt_id() != deopt_id);
}
}
}
@@ -11888,7 +11908,7 @@
while (iter.HasNext()) {
const RawPcDescriptors::PcDescriptorRec& rec = iter.Next();
if (rec.pc == pc) {
- return rec.token_pos;
+ return rec.token_pos();
}
}
return -1;
@@ -11901,7 +11921,7 @@
PcDescriptors::Iterator iter(descriptors, kind);
while (iter.HasNext()) {
const RawPcDescriptors::PcDescriptorRec& rec = iter.Next();
- if (rec.deopt_id == deopt_id) {
+ if (rec.deopt_id() == deopt_id) {
uword pc = rec.pc;
ASSERT(ContainsInstructionAt(pc));
return pc;
@@ -11917,7 +11937,7 @@
while (iter.HasNext()) {
const RawPcDescriptors::PcDescriptorRec& rec = iter.Next();
if (rec.pc == pc) {
- return rec.deopt_id;
+ return rec.deopt_id();
}
}
return Isolate::kNoDeoptId;

Powered by Google App Engine
This is Rietveld 408576698