| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/stack_frame.h" | 5 #include "vm/stack_frame.h" |
| 6 | 6 |
| 7 #include "vm/assembler_macros.h" | 7 #include "vm/assembler_macros.h" |
| 8 #include "vm/isolate.h" | 8 #include "vm/isolate.h" |
| 9 #include "vm/object.h" | 9 #include "vm/object.h" |
| 10 #include "vm/object_store.h" | 10 #include "vm/object_store.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 RawObject** end_addr = reinterpret_cast<RawObject**>(fp()) + | 57 RawObject** end_addr = reinterpret_cast<RawObject**>(fp()) + |
| 58 ParsedFunction::kFirstLocalSlotIndex; | 58 ParsedFunction::kFirstLocalSlotIndex; |
| 59 Code code; | 59 Code code; |
| 60 code = LookupDartCode(); | 60 code = LookupDartCode(); |
| 61 if (!code.IsNull()) { | 61 if (!code.IsNull()) { |
| 62 Array maps; | 62 Array maps; |
| 63 maps = Array::null(); | 63 maps = Array::null(); |
| 64 Stackmap map; | 64 Stackmap map; |
| 65 map = code.GetStackmap(pc(), &maps, &map); | 65 map = code.GetStackmap(pc(), &maps, &map); |
| 66 if (!map.IsNull()) { | 66 if (!map.IsNull()) { |
| 67 // A stack map is present in the code object, use the stack map to visit | 67 // A stack map is present in the code object, use the stack map to |
| 68 // frame slots which are marked as having objects. | 68 // visit frame slots which are marked as having objects. |
| 69 // |
| 70 // The layout of the frame is (lower addresses to the right): |
| 71 // | spill slots | outgoing arguments | saved registers | |
| 72 // |XXXXXXXXXXXXX|--------------------|XXXXXXXXXXXXXXXXX| |
| 73 // |
| 74 // The splill slots and any saved registers are described in the stack |
| 75 // map. The outgoing arguments are assumed to be tagged; the number |
| 76 // of outgoing arguments is not explicitly tracked. |
| 77 // |
| 78 // TODO(kmillikin): This does not handle slow path calls with |
| 79 // arguments, where the arguments are pushed after the live registers. |
| 80 // Enable such calls. |
| 69 intptr_t length = map.Length(); | 81 intptr_t length = map.Length(); |
| 70 for (intptr_t bit_index = 0; bit_index < length; ++bit_index) { | 82 // Spill slots are at the 'bottom' of the frame. |
| 71 if (map.IsObject(bit_index)) { | 83 intptr_t spill_slot_count = length - map.RegisterBitCount(); |
| 72 visitor->VisitPointer(end_addr - bit_index); | 84 for (intptr_t bit = 0; bit < spill_slot_count; ++bit) { |
| 73 } | 85 if (map.IsObject(bit)) visitor->VisitPointer(end_addr); |
| 86 --end_addr; |
| 74 } | 87 } |
| 75 // The stack slots that are not spill slots (i.e., outgoing arguments) | 88 |
| 76 // are tagged objects. | 89 // The live registers at the 'top' of the frame comprise the rest of the |
| 77 end_addr -= length; | 90 // stack map. |
| 91 for (intptr_t bit = length - 1; bit >= spill_slot_count; --bit) { |
| 92 if (map.IsObject(bit)) visitor->VisitPointer(start_addr); |
| 93 ++start_addr; |
| 94 } |
| 95 |
| 78 // The end address can be one slot (but not more) past the start | 96 // The end address can be one slot (but not more) past the start |
| 79 // address in the case that all slots were covered by the stack map. | 97 // address in the case that all slots were covered by the stack map. |
| 80 ASSERT((end_addr + 1) >= start_addr); | 98 ASSERT((end_addr + 1) >= start_addr); |
| 81 } | 99 } |
| 82 } | 100 } |
| 83 // Each slot between the start and end address are tagged objects. | 101 // Each slot between the start and end address are tagged objects. |
| 84 visitor->VisitPointers(start_addr, end_addr); | 102 visitor->VisitPointers(start_addr, end_addr); |
| 85 } | 103 } |
| 86 | 104 |
| 87 | 105 |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 EntryFrame* StackFrameIterator::NextEntryFrame() { | 262 EntryFrame* StackFrameIterator::NextEntryFrame() { |
| 245 ASSERT(!frames_.HasNext()); | 263 ASSERT(!frames_.HasNext()); |
| 246 entry_.sp_ = frames_.sp_; | 264 entry_.sp_ = frames_.sp_; |
| 247 entry_.fp_ = frames_.fp_; | 265 entry_.fp_ = frames_.fp_; |
| 248 SetupNextExitFrameData(); // Setup data for next exit frame in chain. | 266 SetupNextExitFrameData(); // Setup data for next exit frame in chain. |
| 249 ASSERT(entry_.IsValid()); | 267 ASSERT(entry_.IsValid()); |
| 250 return &entry_; | 268 return &entry_; |
| 251 } | 269 } |
| 252 | 270 |
| 253 } // namespace dart | 271 } // namespace dart |
| OLD | NEW |