Index: runtime/vm/stack_frame.cc |
diff --git a/runtime/vm/stack_frame.cc b/runtime/vm/stack_frame.cc |
index 53e66170e0d6b5909ed37a2dc0b807047082b8cf..01a67359e704d6a986aeebdec790a61575a57144 100644 |
--- a/runtime/vm/stack_frame.cc |
+++ b/runtime/vm/stack_frame.cc |
@@ -54,8 +54,8 @@ void StackFrame::VisitObjectPointers(ObjectPointerVisitor* visitor) { |
ASSERT(visitor != NULL); |
NoGCScope no_gc; |
RawObject** start_addr = reinterpret_cast<RawObject**>(sp()); |
- RawObject** end_addr = reinterpret_cast<RawObject**>( |
- fp() + (ParsedFunction::kFirstLocalSlotIndex * kWordSize)); |
+ RawObject** end_addr = reinterpret_cast<RawObject**>(fp()) + |
+ ParsedFunction::kFirstLocalSlotIndex; |
Code code; |
code = LookupDartCode(); |
if (!code.IsNull()) { |
@@ -66,24 +66,18 @@ void StackFrame::VisitObjectPointers(ObjectPointerVisitor* visitor) { |
if (!map.IsNull()) { |
// A stack map is present in the code object, use the stack map to visit |
// frame slots which are marked as having objects. |
- intptr_t end_bit_index = map.MaximumBitIndex(); |
- // It's possible that no bits are set. |
- if (end_bit_index != Stackmap::kNoMaximum) { |
- intptr_t bit_index = map.MinimumBitIndex(); |
- ASSERT(bit_index != Stackmap::kNoMinimum); |
- ASSERT(bit_index <= end_bit_index); |
- ASSERT(end_bit_index <= (end_addr - start_addr)); |
- while (bit_index <= end_bit_index) { |
- if (map.IsObject(bit_index)) { |
- visitor->VisitPointer(end_addr - bit_index); |
- } |
- ++bit_index; |
+ intptr_t length = map.Length(); |
+ for (intptr_t bit_index = 0; bit_index < length; ++bit_index) { |
+ if (map.IsObject(bit_index)) { |
+ visitor->VisitPointer(end_addr - bit_index); |
} |
} |
// The stack slots that are not spill slots (i.e., outgoing arguments) |
// are tagged objects. |
- end_addr = end_addr - (code.spill_slot_count() - 1); |
- ASSERT(end_addr >= start_addr); |
+ end_addr -= length; |
+ // The end address can be one slot (but not more) past the start |
+ // address in the case that all slots were covered by the stack map. |
+ ASSERT((end_addr + 1) >= start_addr); |
} |
} |
// Each slot between the start and end address are tagged objects. |