| 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/v8.h" | 8 #include "src/v8.h" |
| 9 | 9 |
| 10 #include "src/bit-vector.h" | 10 #include "src/bit-vector.h" |
| 11 | 11 |
| 12 namespace v8 { | 12 namespace v8 { |
| 13 namespace internal { | 13 namespace internal { |
| 14 namespace compiler { | 14 namespace compiler { |
| 15 | 15 |
| 16 // Collects the spill slot requirements and the allocated general and double | 16 // Collects the spill slot requirements and the allocated general and double |
| 17 // registers for a compiled function. Frames are usually populated by the | 17 // registers for a compiled function. Frames are usually populated by the |
| 18 // register allocator and are used by Linkage to generate code for the prologue | 18 // register allocator and are used by Linkage to generate code for the prologue |
| 19 // and epilogue to compiled code. | 19 // and epilogue to compiled code. |
| 20 class Frame { | 20 class Frame : public ZoneObject { |
| 21 public: | 21 public: |
| 22 Frame() | 22 Frame() |
| 23 : register_save_area_size_(0), | 23 : register_save_area_size_(0), |
| 24 spill_slot_count_(0), | 24 spill_slot_count_(0), |
| 25 double_spill_slot_count_(0), | 25 double_spill_slot_count_(0), |
| 26 allocated_registers_(NULL), | 26 allocated_registers_(NULL), |
| 27 allocated_double_registers_(NULL) {} | 27 allocated_double_registers_(NULL) {} |
| 28 | 28 |
| 29 inline int GetSpillSlotCount() { return spill_slot_count_; } | 29 inline int GetSpillSlotCount() { return spill_slot_count_; } |
| 30 inline int GetDoubleSpillSlotCount() { return double_spill_slot_count_; } | 30 inline int GetDoubleSpillSlotCount() { return double_spill_slot_count_; } |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 } | 62 } |
| 63 return spill_slot_count_++; | 63 return spill_slot_count_++; |
| 64 } | 64 } |
| 65 | 65 |
| 66 private: | 66 private: |
| 67 int register_save_area_size_; | 67 int register_save_area_size_; |
| 68 int spill_slot_count_; | 68 int spill_slot_count_; |
| 69 int double_spill_slot_count_; | 69 int double_spill_slot_count_; |
| 70 BitVector* allocated_registers_; | 70 BitVector* allocated_registers_; |
| 71 BitVector* allocated_double_registers_; | 71 BitVector* allocated_double_registers_; |
| 72 |
| 73 DISALLOW_COPY_AND_ASSIGN(Frame); |
| 72 }; | 74 }; |
| 73 | 75 |
| 74 | 76 |
| 75 // Represents an offset from either the stack pointer or frame pointer. | 77 // Represents an offset from either the stack pointer or frame pointer. |
| 76 class FrameOffset { | 78 class FrameOffset { |
| 77 public: | 79 public: |
| 78 inline bool from_stack_pointer() { return (offset_ & 1) == kFromSp; } | 80 inline bool from_stack_pointer() { return (offset_ & 1) == kFromSp; } |
| 79 inline bool from_frame_pointer() { return (offset_ & 1) == kFromFp; } | 81 inline bool from_frame_pointer() { return (offset_ & 1) == kFromFp; } |
| 80 inline int offset() { return offset_ & ~1; } | 82 inline int offset() { return offset_ & ~1; } |
| 81 | 83 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 95 int offset_; // Encodes SP or FP in the low order bit. | 97 int offset_; // Encodes SP or FP in the low order bit. |
| 96 | 98 |
| 97 static const int kFromSp = 1; | 99 static const int kFromSp = 1; |
| 98 static const int kFromFp = 0; | 100 static const int kFromFp = 0; |
| 99 }; | 101 }; |
| 100 } | 102 } |
| 101 } | 103 } |
| 102 } // namespace v8::internal::compiler | 104 } // namespace v8::internal::compiler |
| 103 | 105 |
| 104 #endif // V8_COMPILER_FRAME_H_ | 106 #endif // V8_COMPILER_FRAME_H_ |
| OLD | NEW |