OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 #ifndef VM_STACK_FRAME_H_ | 5 #ifndef VM_STACK_FRAME_H_ |
6 #define VM_STACK_FRAME_H_ | 6 #define VM_STACK_FRAME_H_ |
7 | 7 |
8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
9 #include "vm/object.h" | 9 #include "vm/object.h" |
10 #include "vm/stub_code.h" | 10 #include "vm/stub_code.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 static int SavedCallerPpSlotFromFp() { | 46 static int SavedCallerPpSlotFromFp() { |
47 if (kSavedCallerPpSlotFromFp != kSavedCallerFpSlotFromFp) { | 47 if (kSavedCallerPpSlotFromFp != kSavedCallerFpSlotFromFp) { |
48 return kSavedCallerPpSlotFromFp; | 48 return kSavedCallerPpSlotFromFp; |
49 } | 49 } |
50 UNREACHABLE(); | 50 UNREACHABLE(); |
51 return 0; | 51 return 0; |
52 } | 52 } |
53 | 53 |
54 void set_pc(uword value) { | 54 void set_pc(uword value) { |
55 *reinterpret_cast<uword*>(sp() + (kSavedPcSlotFromSp * kWordSize)) = value; | 55 *reinterpret_cast<uword*>(sp() + (kSavedPcSlotFromSp * kWordSize)) = value; |
| 56 pc_ = value; |
56 } | 57 } |
57 | 58 |
58 void set_pc_marker(RawCode* code) { | 59 void set_pc_marker(RawCode* code) { |
59 *reinterpret_cast<RawCode**>(fp() + (kPcMarkerSlotFromFp * kWordSize)) = | 60 *reinterpret_cast<RawCode**>(fp() + (kPcMarkerSlotFromFp * kWordSize)) = |
60 code; | 61 code; |
61 } | 62 } |
62 | 63 |
63 // Visit objects in the frame. | 64 // Visit objects in the frame. |
64 virtual void VisitObjectPointers(ObjectPointerVisitor* visitor); | 65 virtual void VisitObjectPointers(ObjectPointerVisitor* visitor); |
65 | 66 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 uword GetCallerSp() const { | 104 uword GetCallerSp() const { |
104 return fp() + (kCallerSpSlotFromFp * kWordSize); | 105 return fp() + (kCallerSpSlotFromFp * kWordSize); |
105 } | 106 } |
106 | 107 |
107 uword GetCallerFp() const { | 108 uword GetCallerFp() const { |
108 return *(reinterpret_cast<uword*>( | 109 return *(reinterpret_cast<uword*>( |
109 fp() + (kSavedCallerFpSlotFromFp * kWordSize))); | 110 fp() + (kSavedCallerFpSlotFromFp * kWordSize))); |
110 } | 111 } |
111 | 112 |
112 uword GetCallerPc() const { | 113 uword GetCallerPc() const { |
113 return *(reinterpret_cast<uword*>( | 114 uword raw_pc = *(reinterpret_cast<uword*>( |
114 fp() + (kSavedCallerPcSlotFromFp * kWordSize))); | 115 fp() + (kSavedCallerPcSlotFromFp * kWordSize))); |
| 116 ASSERT(raw_pc != StubCode::DeoptimizeLazyFromThrow_entry()->EntryPoint()); |
| 117 if (raw_pc == StubCode::DeoptimizeLazyFromReturn_entry()->EntryPoint()) { |
| 118 uword fp = GetCallerFp(); |
| 119 MallocGrowableArray<PendingLazyDeopt>* pending_deopts = |
| 120 isolate()->pending_deopts(); |
| 121 for (intptr_t i = 0; i < pending_deopts->length(); i++) { |
| 122 if ((*pending_deopts)[i].fp() == fp) { |
| 123 return (*pending_deopts)[i].pc(); |
| 124 } |
| 125 } |
| 126 UNREACHABLE(); |
| 127 } |
| 128 return raw_pc; |
115 } | 129 } |
116 | 130 |
117 uword fp_; | 131 uword fp_; |
118 uword sp_; | 132 uword sp_; |
119 uword pc_; | 133 uword pc_; |
120 Thread* thread_; | 134 Thread* thread_; |
121 | 135 |
122 // The iterators FrameSetIterator and StackFrameIterator set the private | 136 // The iterators FrameSetIterator and StackFrameIterator set the private |
123 // fields fp_ and sp_ when they return the respective frame objects. | 137 // fields fp_ and sp_ when they return the respective frame objects. |
124 friend class FrameSetIterator; | 138 friend class FrameSetIterator; |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 | 386 |
373 | 387 |
374 DART_FORCE_INLINE static uword LocalVarAddress(uword fp, intptr_t index) { | 388 DART_FORCE_INLINE static uword LocalVarAddress(uword fp, intptr_t index) { |
375 return fp + LocalVarIndex(0, index) * kWordSize; | 389 return fp + LocalVarIndex(0, index) * kWordSize; |
376 } | 390 } |
377 | 391 |
378 | 392 |
379 } // namespace dart | 393 } // namespace dart |
380 | 394 |
381 #endif // VM_STACK_FRAME_H_ | 395 #endif // VM_STACK_FRAME_H_ |
OLD | NEW |