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

Unified Diff: vm/raw_object.cc

Issue 9791048: - Wire the stack frame iterator to use stack maps for traversing objects if there are stack maps in… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 9 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: vm/raw_object.cc
===================================================================
--- vm/raw_object.cc (revision 5921)
+++ vm/raw_object.cc (working copy)
@@ -228,6 +228,19 @@
}
+bool RawObject::FindObject(FindObjectVisitor* visitor) {
+ ASSERT(visitor != NULL);
+ return visitor->FindObject(const_cast<RawObject*>(this));
+}
+
+
+bool RawObject::IsRawInstruction(RawObject* raw_obj) {
+ RawClass* raw_class = raw_obj->ptr()->class_;
+ ObjectKind instance_kind = raw_class->ptr()->instance_kind_;
+ return (instance_kind == kInstructions);
+}
+
+
intptr_t RawClass::VisitClassPointers(RawClass* raw_obj,
ObjectPointerVisitor* visitor) {
visitor->VisitPointers(raw_obj->from(), raw_obj->to());
@@ -361,6 +374,35 @@
}
+RawStackmap* RawCode::GetStackmap(uword pc) const {
+ RawArray* stackmaps = ptr()->stackmaps_;
+ if (stackmaps == Array::null()) {
+ // No stack maps are present in the code object which means this
+ // frame relies on tagged pointers.
+ return Stackmap::null();
+ }
+ // A stack map is present in the code object, use the stack map to visit
+ // frame slots which are marked as having objects.
+ RawStackmap* previous_map = Stackmap::null();
+ RawStackmap* map = Stackmap::null();
+ for (intptr_t i = 0; i < stackmaps->Length(); i++) {
+ map = reinterpret_cast<RawStackmap*>(stackmaps->DataAt(i));
+ ASSERT(map != Stackmap::null());
+ if (map->PC() == pc) {
+ break; // We found a stack map for this frame.
+ }
+ if (map->PC() > pc) {
+ // We have not found a stackmap corresponding to the PC of this frame,
+ // we will use the closest previous stack map.
+ map = previous_map;
+ break;
+ }
+ previous_map = map;
+ }
+ return map;
+}
+
+
intptr_t RawInstructions::VisitInstructionsPointers(
RawInstructions* raw_obj, ObjectPointerVisitor* visitor) {
RawInstructions* obj = raw_obj->ptr();
@@ -369,6 +411,21 @@
}
+bool RawInstructions::ContainsPC(RawObject* raw_obj, uword pc) {
+ if (IsRawInstruction(raw_obj)) {
+ RawInstructions* raw_instr = reinterpret_cast<RawInstructions*>(raw_obj);
+ uword start_pc =
+ reinterpret_cast<uword>(raw_instr->ptr()) + Instructions::HeaderSize();
+ uword end_pc = start_pc + raw_instr->ptr()->size_;
+ ASSERT(end_pc > start_pc);
+ if (pc >= start_pc && pc < end_pc) {
srdjan 2012/03/28 21:56:36 Add parentheses. Maybe: return (pc >= start_pc) &
siva 2012/03/29 19:01:27 Done.
+ return true;
+ }
+ }
+ return false;
+}
+
+
intptr_t RawPcDescriptors::VisitPcDescriptorsPointers(
RawPcDescriptors* raw_obj, ObjectPointerVisitor* visitor) {
RawPcDescriptors* obj = raw_obj->ptr();
@@ -387,6 +444,20 @@
}
+bool RawStackmap::IsObject(intptr_t bit_offset) const {
+ int byte_offset = bit_offset >> kBitsPerByteLog2;
+ int bit_remainder = bit_offset & (kBitsPerByte - 1);
+ uint8_t byte_mask = 1U << bit_remainder;
+ uint8_t byte = ptr()->data_[byte_offset];
srdjan 2012/03/28 21:56:36 All of locals can be const.
siva 2012/03/29 19:01:27 Done.
+ return (byte & byte_mask);
+}
+
+
+intptr_t RawStackmap::SizeInBits() const {
+ return (Smi::Value(ptr()->bitmap_size_in_bytes_) * kBitsPerByte);
+}
+
+
intptr_t RawLocalVarDescriptors::VisitLocalVarDescriptorsPointers(
RawLocalVarDescriptors* raw_obj, ObjectPointerVisitor* visitor) {
RawLocalVarDescriptors* obj = raw_obj->ptr();
@@ -609,6 +680,11 @@
}
+intptr_t RawArray::Length() const {
+ return Smi::Value(ptr()->length_);
+}
+
+
intptr_t RawImmutableArray::VisitImmutableArrayPointers(
RawImmutableArray* raw_obj, ObjectPointerVisitor* visitor) {
return RawArray::VisitArrayPointers(raw_obj, visitor);

Powered by Google App Engine
This is Rietveld 408576698