Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(105)

Unified Diff: src/compiler/frame.h

Issue 1259203002: [turbofan] Implement tail calls with differing stack parameter counts (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix bugs in frameless tail calls Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/compiler/frame.h
diff --git a/src/compiler/frame.h b/src/compiler/frame.h
index 2850a8c1a152e74f287bbf60129bf71e2109a9b5..32a3ea1f14885db50098a2b483d3e6cfac889961 100644
--- a/src/compiler/frame.h
+++ b/src/compiler/frame.h
@@ -17,14 +17,26 @@ namespace compiler {
// and epilogue to compiled code.
class Frame : public ZoneObject {
public:
- Frame()
- : register_save_area_size_(0),
+ explicit Frame(bool needs_frame)
+ : needs_frame_(needs_frame),
+ register_save_area_size_(0),
spill_slot_count_(0),
+ max_tail_call_stack_delta_(0),
osr_stack_slot_count_(0),
allocated_registers_(NULL),
allocated_double_registers_(NULL) {}
- inline int GetSpillSlotCount() { return spill_slot_count_; }
+ inline int GetSpillSlotCount() const { return spill_slot_count_; }
+
+ inline int GetFrameSlotCount() const {
+ if (needs_frame_ || spill_slot_count_ > 0) {
+ return std::max(spill_slot_count_, max_tail_call_stack_delta_);
+ }
+ return 0;
+ }
+
+ inline void MarkNeedsFrame() { needs_frame_ = true; }
+ inline bool NeedsFrame() const { return needs_frame_; }
void SetAllocatedRegisters(BitVector* regs) {
DCHECK(allocated_registers_ == NULL);
@@ -57,6 +69,7 @@ class Frame : public ZoneObject {
int AllocateSpillSlot(int width) {
DCHECK(width == 4 || width == 8);
+ needs_frame_ = true;
// Skip one slot if necessary.
if (width > kPointerSize) {
DCHECK(width == kPointerSize * 2);
@@ -68,12 +81,22 @@ class Frame : public ZoneObject {
void ReserveSpillSlots(size_t slot_count) {
DCHECK_EQ(0, spill_slot_count_); // can only reserve before allocation.
+ needs_frame_ = true;
spill_slot_count_ = static_cast<int>(slot_count);
}
+ void UpdateMaxTailCallStackDelta(int stack_delta) {
+ if (stack_delta > max_tail_call_stack_delta_) {
+ max_tail_call_stack_delta_ = stack_delta;
+ }
+ }
+ int max_tail_call_stack_delta() { return max_tail_call_stack_delta_; }
+
private:
+ bool needs_frame_;
int register_save_area_size_;
int spill_slot_count_;
+ int max_tail_call_stack_delta_;
int osr_stack_slot_count_;
BitVector* allocated_registers_;
BitVector* allocated_double_registers_;

Powered by Google App Engine
This is Rietveld 408576698