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; | |
57 } | 56 } |
58 | 57 |
59 void set_pc_marker(RawCode* code) { | 58 void set_pc_marker(RawCode* code) { |
60 *reinterpret_cast<RawCode**>(fp() + (kPcMarkerSlotFromFp * kWordSize)) = | 59 *reinterpret_cast<RawCode**>(fp() + (kPcMarkerSlotFromFp * kWordSize)) = |
61 code; | 60 code; |
62 } | 61 } |
63 | 62 |
64 // Visit objects in the frame. | 63 // Visit objects in the frame. |
65 virtual void VisitObjectPointers(ObjectPointerVisitor* visitor); | 64 virtual void VisitObjectPointers(ObjectPointerVisitor* visitor); |
66 | 65 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 uword GetCallerSp() const { | 103 uword GetCallerSp() const { |
105 return fp() + (kCallerSpSlotFromFp * kWordSize); | 104 return fp() + (kCallerSpSlotFromFp * kWordSize); |
106 } | 105 } |
107 | 106 |
108 uword GetCallerFp() const { | 107 uword GetCallerFp() const { |
109 return *(reinterpret_cast<uword*>( | 108 return *(reinterpret_cast<uword*>( |
110 fp() + (kSavedCallerFpSlotFromFp * kWordSize))); | 109 fp() + (kSavedCallerFpSlotFromFp * kWordSize))); |
111 } | 110 } |
112 | 111 |
113 uword GetCallerPc() const { | 112 uword GetCallerPc() const { |
114 uword raw_pc = *(reinterpret_cast<uword*>( | 113 return *(reinterpret_cast<uword*>( |
115 fp() + (kSavedCallerPcSlotFromFp * kWordSize))); | 114 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; | |
129 } | 115 } |
130 | 116 |
131 uword fp_; | 117 uword fp_; |
132 uword sp_; | 118 uword sp_; |
133 uword pc_; | 119 uword pc_; |
134 Thread* thread_; | 120 Thread* thread_; |
135 | 121 |
136 // The iterators FrameSetIterator and StackFrameIterator set the private | 122 // The iterators FrameSetIterator and StackFrameIterator set the private |
137 // fields fp_ and sp_ when they return the respective frame objects. | 123 // fields fp_ and sp_ when they return the respective frame objects. |
138 friend class FrameSetIterator; | 124 friend class FrameSetIterator; |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 | 372 |
387 | 373 |
388 DART_FORCE_INLINE static uword LocalVarAddress(uword fp, intptr_t index) { | 374 DART_FORCE_INLINE static uword LocalVarAddress(uword fp, intptr_t index) { |
389 return fp + LocalVarIndex(0, index) * kWordSize; | 375 return fp + LocalVarIndex(0, index) * kWordSize; |
390 } | 376 } |
391 | 377 |
392 | 378 |
393 } // namespace dart | 379 } // namespace dart |
394 | 380 |
395 #endif // VM_STACK_FRAME_H_ | 381 #endif // VM_STACK_FRAME_H_ |
OLD | NEW |