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

Unified Diff: runtime/vm/stack_frame.cc

Issue 10835034: Fix an off-by-one error in the stack frame iteration. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Renaming per review comments. Created 8 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
« no previous file with comments | « runtime/vm/raw_object.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/stack_frame.cc
diff --git a/runtime/vm/stack_frame.cc b/runtime/vm/stack_frame.cc
index 806cbec5d1f3038dfc0b591a87cc3cc1a9a9d62e..a7b01e843b57c9cbd8bed413b6092415c021da3b 100644
--- a/runtime/vm/stack_frame.cc
+++ b/runtime/vm/stack_frame.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@@ -62,15 +62,19 @@ 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 bit_offset = map.MinimumBitOffset();
- intptr_t end_bit_offset = map.MaximumBitOffset();
- while (bit_offset <= end_bit_offset) {
- uword addr = (fp() - ((bit_offset + 1) * kWordSize));
+ intptr_t bit_index = map.MinimumBitIndex();
+ ASSERT(bit_index != Stackmap::kNoMinimum);
+ intptr_t end_bit_index = map.MaximumBitIndex();
+ ASSERT(end_bit_index != Stackmap::kNoMaximum);
+ uword base_addr =
+ fp() + (ParsedFunction::kFirstLocalSlotIndex * kWordSize);
+ while (bit_index <= end_bit_index) {
+ uword addr = base_addr - (bit_index * kWordSize);
ASSERT(addr >= sp());
- if (map.IsObject(bit_offset)) {
+ if (map.IsObject(bit_index)) {
visitor->VisitPointer(reinterpret_cast<RawObject**>(addr));
}
- bit_offset += 1;
+ ++bit_index;
}
return;
}
« no previous file with comments | « runtime/vm/raw_object.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698