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

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
« no previous file with comments | « vm/raw_object.h ('k') | vm/runtime_entry_test.cc » ('j') | vm/stack_frame.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_;
Ivan Posva 2012/04/03 23:28:50 This code could be inlined into the ContainsPC met
siva 2012/04/07 01:22:55 Done.
+ 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 {
Ivan Posva 2012/04/03 23:28:50 Move this code into the Code object?
siva 2012/04/07 01:22:55 Done. Used special stack handles in the DartFrame
+ 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)) {
+ return true;
+ }
+ }
+ return false;
+}
+
+
intptr_t RawPcDescriptors::VisitPcDescriptorsPointers(
RawPcDescriptors* raw_obj, ObjectPointerVisitor* visitor) {
RawPcDescriptors* obj = raw_obj->ptr();
@@ -387,6 +444,15 @@
}
+bool RawStackmap::IsObject(intptr_t bit_offset) const {
+ const int byte_offset = bit_offset >> kBitsPerByteLog2;
+ const int bit_remainder = bit_offset & (kBitsPerByte - 1);
+ const uint8_t byte_mask = 1U << bit_remainder;
+ const uint8_t byte = ptr()->data_[byte_offset];
+ return (byte & byte_mask);
+}
+
+
intptr_t RawLocalVarDescriptors::VisitLocalVarDescriptorsPointers(
RawLocalVarDescriptors* raw_obj, ObjectPointerVisitor* visitor) {
RawLocalVarDescriptors* obj = raw_obj->ptr();
@@ -609,6 +675,11 @@
}
+intptr_t RawArray::Length() const {
Ivan Posva 2012/04/03 23:28:50 inline into uses
siva 2012/04/07 01:22:55 Not needed any more as the GetStackmap code was mo
+ return Smi::Value(ptr()->length_);
+}
+
+
intptr_t RawImmutableArray::VisitImmutableArrayPointers(
RawImmutableArray* raw_obj, ObjectPointerVisitor* visitor) {
return RawArray::VisitArrayPointers(raw_obj, visitor);
« no previous file with comments | « vm/raw_object.h ('k') | vm/runtime_entry_test.cc » ('j') | vm/stack_frame.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698