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

Side by Side Diff: src/compiler/frame.h

Issue 890903002: [turbofan] Fix OSR into functions where the expression stack is not empty. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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 unified diff | Download patch
« no previous file with comments | « src/compiler/ast-graph-builder.cc ('k') | src/compiler/ia32/code-generator-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 : public ZoneObject { 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 osr_stack_slot_count_(0),
26 allocated_registers_(NULL), 27 allocated_registers_(NULL),
27 allocated_double_registers_(NULL) {} 28 allocated_double_registers_(NULL) {}
28 29
29 inline int GetSpillSlotCount() { return spill_slot_count_; } 30 inline int GetSpillSlotCount() { return spill_slot_count_; }
30 inline int GetDoubleSpillSlotCount() { return double_spill_slot_count_; } 31 inline int GetDoubleSpillSlotCount() { return double_spill_slot_count_; }
31 32
32 void SetAllocatedRegisters(BitVector* regs) { 33 void SetAllocatedRegisters(BitVector* regs) {
33 DCHECK(allocated_registers_ == NULL); 34 DCHECK(allocated_registers_ == NULL);
34 allocated_registers_ = regs; 35 allocated_registers_ = regs;
35 } 36 }
36 37
37 void SetAllocatedDoubleRegisters(BitVector* regs) { 38 void SetAllocatedDoubleRegisters(BitVector* regs) {
38 DCHECK(allocated_double_registers_ == NULL); 39 DCHECK(allocated_double_registers_ == NULL);
39 allocated_double_registers_ = regs; 40 allocated_double_registers_ = regs;
40 } 41 }
41 42
42 bool DidAllocateDoubleRegisters() { 43 bool DidAllocateDoubleRegisters() {
43 return !allocated_double_registers_->IsEmpty(); 44 return !allocated_double_registers_->IsEmpty();
44 } 45 }
45 46
46 void SetRegisterSaveAreaSize(int size) { 47 void SetRegisterSaveAreaSize(int size) {
47 DCHECK(IsAligned(size, kPointerSize)); 48 DCHECK(IsAligned(size, kPointerSize));
48 register_save_area_size_ = size; 49 register_save_area_size_ = size;
49 } 50 }
50 51
51 int GetRegisterSaveAreaSize() { return register_save_area_size_; } 52 int GetRegisterSaveAreaSize() { return register_save_area_size_; }
52 53
54 // OSR stack slots, including locals and expression stack slots.
55 void SetOsrStackSlotCount(int slots) {
56 DCHECK(slots >= 0);
57 osr_stack_slot_count_ = slots;
58 }
59
60 int GetOsrStackSlotCount() { return osr_stack_slot_count_; }
61
53 int AllocateSpillSlot(bool is_double) { 62 int AllocateSpillSlot(bool is_double) {
54 // If 32-bit, skip one if the new slot is a double. 63 // If 32-bit, skip one if the new slot is a double.
55 if (is_double) { 64 if (is_double) {
56 if (kDoubleSize > kPointerSize) { 65 if (kDoubleSize > kPointerSize) {
57 DCHECK(kDoubleSize == kPointerSize * 2); 66 DCHECK(kDoubleSize == kPointerSize * 2);
58 spill_slot_count_++; 67 spill_slot_count_++;
59 spill_slot_count_ |= 1; 68 spill_slot_count_ |= 1;
60 } 69 }
61 double_spill_slot_count_++; 70 double_spill_slot_count_++;
62 } 71 }
63 return spill_slot_count_++; 72 return spill_slot_count_++;
64 } 73 }
65 74
66 void ReserveSpillSlots(size_t slot_count) { 75 void ReserveSpillSlots(size_t slot_count) {
67 DCHECK_EQ(0, spill_slot_count_); // can only reserve before allocation. 76 DCHECK_EQ(0, spill_slot_count_); // can only reserve before allocation.
68 spill_slot_count_ = static_cast<int>(slot_count); 77 spill_slot_count_ = static_cast<int>(slot_count);
69 } 78 }
70 79
71 private: 80 private:
72 int register_save_area_size_; 81 int register_save_area_size_;
73 int spill_slot_count_; 82 int spill_slot_count_;
74 int double_spill_slot_count_; 83 int double_spill_slot_count_;
84 int osr_stack_slot_count_;
75 BitVector* allocated_registers_; 85 BitVector* allocated_registers_;
76 BitVector* allocated_double_registers_; 86 BitVector* allocated_double_registers_;
77 87
78 DISALLOW_COPY_AND_ASSIGN(Frame); 88 DISALLOW_COPY_AND_ASSIGN(Frame);
79 }; 89 };
80 90
81 91
82 // Represents an offset from either the stack pointer or frame pointer. 92 // Represents an offset from either the stack pointer or frame pointer.
83 class FrameOffset { 93 class FrameOffset {
84 public: 94 public:
(...skipping 17 matching lines...) Expand all
102 int offset_; // Encodes SP or FP in the low order bit. 112 int offset_; // Encodes SP or FP in the low order bit.
103 113
104 static const int kFromSp = 1; 114 static const int kFromSp = 1;
105 static const int kFromFp = 0; 115 static const int kFromFp = 0;
106 }; 116 };
107 } 117 }
108 } 118 }
109 } // namespace v8::internal::compiler 119 } // namespace v8::internal::compiler
110 120
111 #endif // V8_COMPILER_FRAME_H_ 121 #endif // V8_COMPILER_FRAME_H_
OLDNEW
« no previous file with comments | « src/compiler/ast-graph-builder.cc ('k') | src/compiler/ia32/code-generator-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698