OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_COMPILER_FRAME_H_ | 5 #ifndef V8_COMPILER_FRAME_H_ |
6 #define V8_COMPILER_FRAME_H_ | 6 #define V8_COMPILER_FRAME_H_ |
7 | 7 |
8 #include "src/bit-vector.h" | 8 #include "src/bit-vector.h" |
9 #include "src/frames.h" | 9 #include "src/frames.h" |
10 | 10 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 class Frame : public ZoneObject { | 79 class Frame : public ZoneObject { |
80 public: | 80 public: |
81 explicit Frame(int fixed_frame_size_in_slots, | 81 explicit Frame(int fixed_frame_size_in_slots, |
82 const CallDescriptor* descriptor); | 82 const CallDescriptor* descriptor); |
83 | 83 |
84 inline bool needs_frame() const { return needs_frame_; } | 84 inline bool needs_frame() const { return needs_frame_; } |
85 inline void MarkNeedsFrame() { needs_frame_ = true; } | 85 inline void MarkNeedsFrame() { needs_frame_ = true; } |
86 | 86 |
87 inline int GetTotalFrameSlotCount() const { return frame_slot_count_; } | 87 inline int GetTotalFrameSlotCount() const { return frame_slot_count_; } |
88 | 88 |
89 inline int GetSpToFpSlotCount() const { | 89 inline int GetSPToFPSlotCount() const { |
90 return GetTotalFrameSlotCount() - | 90 return GetTotalFrameSlotCount() - |
91 StandardFrameConstants::kFixedSlotCountAboveFp; | 91 StandardFrameConstants::kFixedSlotCountAboveFp; |
92 } | 92 } |
93 inline int GetSavedCalleeRegisterSlotCount() const { | 93 inline int GetSavedCalleeRegisterSlotCount() const { |
94 return callee_saved_slot_count_; | 94 return callee_saved_slot_count_; |
95 } | 95 } |
96 inline int GetSpillSlotCount() const { return spill_slot_count_; } | 96 inline int GetSpillSlotCount() const { return spill_slot_count_; } |
97 | 97 |
98 inline void SetElidedFrameSizeInSlots(int slots) { | 98 inline void SetElidedFrameSizeInSlots(int slots) { |
99 DCHECK_EQ(0, callee_saved_slot_count_); | 99 DCHECK_EQ(0, callee_saved_slot_count_); |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 | 218 |
219 int sp_delta() const { return sp_delta_; } | 219 int sp_delta() const { return sp_delta_; } |
220 void ClearSPDelta() { sp_delta_ = 0; } | 220 void ClearSPDelta() { sp_delta_ = 0; } |
221 void IncreaseSPDelta(int amount) { sp_delta_ += amount; } | 221 void IncreaseSPDelta(int amount) { sp_delta_ += amount; } |
222 | 222 |
223 bool access_frame_with_fp() const { return access_frame_with_fp_; } | 223 bool access_frame_with_fp() const { return access_frame_with_fp_; } |
224 void SetFrameAccessToDefault(); | 224 void SetFrameAccessToDefault(); |
225 void SetFrameAccessToFP() { access_frame_with_fp_ = true; } | 225 void SetFrameAccessToFP() { access_frame_with_fp_ = true; } |
226 void SetFrameAccessToSP() { access_frame_with_fp_ = false; } | 226 void SetFrameAccessToSP() { access_frame_with_fp_ = false; } |
227 | 227 |
| 228 int GetSPToFPSlotCount() const { |
| 229 return frame_->GetSPToFPSlotCount() + sp_delta(); |
| 230 } |
| 231 int GetSPToFPOffset() const { return GetSPToFPSlotCount() * kPointerSize; } |
| 232 |
228 // Get the frame offset for a given spill slot. The location depends on the | 233 // Get the frame offset for a given spill slot. The location depends on the |
229 // calling convention and the specific frame layout, and may thus be | 234 // calling convention and the specific frame layout, and may thus be |
230 // architecture-specific. Negative spill slots indicate arguments on the | 235 // architecture-specific. Negative spill slots indicate arguments on the |
231 // caller's frame. | 236 // caller's frame. |
232 FrameOffset GetFrameOffset(int spill_slot) const; | 237 FrameOffset GetFrameOffset(int spill_slot) const; |
233 | 238 |
234 private: | 239 private: |
235 Frame* const frame_; | 240 Frame* const frame_; |
236 bool access_frame_with_fp_; | 241 bool access_frame_with_fp_; |
237 int sp_delta_; | 242 int sp_delta_; |
238 }; | 243 }; |
239 } // namespace compiler | 244 } // namespace compiler |
240 } // namespace internal | 245 } // namespace internal |
241 } // namespace v8 | 246 } // namespace v8 |
242 | 247 |
243 #endif // V8_COMPILER_FRAME_H_ | 248 #endif // V8_COMPILER_FRAME_H_ |
OLD | NEW |