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

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

Issue 1119483003: Revert of [turbofan] add MachineType to AllocatedOperand (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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 | « no previous file | src/compiler/gap-resolver.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/bit-vector.h" 8 #include "src/bit-vector.h"
9 9
10 namespace v8 { 10 namespace v8 {
11 namespace internal { 11 namespace internal {
12 namespace compiler { 12 namespace compiler {
13 13
14 // Collects the spill slot requirements and the allocated general and double 14 // Collects the spill slot requirements and the allocated general and double
15 // registers for a compiled function. Frames are usually populated by the 15 // registers for a compiled function. Frames are usually populated by the
16 // register allocator and are used by Linkage to generate code for the prologue 16 // register allocator and are used by Linkage to generate code for the prologue
17 // and epilogue to compiled code. 17 // and epilogue to compiled code.
18 class Frame : public ZoneObject { 18 class Frame : public ZoneObject {
19 public: 19 public:
20 Frame() 20 Frame()
21 : register_save_area_size_(0), 21 : register_save_area_size_(0),
22 spill_slot_count_(0), 22 spill_slot_count_(0),
23 double_spill_slot_count_(0),
23 osr_stack_slot_count_(0), 24 osr_stack_slot_count_(0),
24 allocated_registers_(NULL), 25 allocated_registers_(NULL),
25 allocated_double_registers_(NULL) {} 26 allocated_double_registers_(NULL) {}
26 27
27 inline int GetSpillSlotCount() { return spill_slot_count_; } 28 inline int GetSpillSlotCount() { return spill_slot_count_; }
29 inline int GetDoubleSpillSlotCount() { return double_spill_slot_count_; }
28 30
29 void SetAllocatedRegisters(BitVector* regs) { 31 void SetAllocatedRegisters(BitVector* regs) {
30 DCHECK(allocated_registers_ == NULL); 32 DCHECK(allocated_registers_ == NULL);
31 allocated_registers_ = regs; 33 allocated_registers_ = regs;
32 } 34 }
33 35
34 void SetAllocatedDoubleRegisters(BitVector* regs) { 36 void SetAllocatedDoubleRegisters(BitVector* regs) {
35 DCHECK(allocated_double_registers_ == NULL); 37 DCHECK(allocated_double_registers_ == NULL);
36 allocated_double_registers_ = regs; 38 allocated_double_registers_ = regs;
37 } 39 }
(...skipping 10 matching lines...) Expand all
48 int GetRegisterSaveAreaSize() { return register_save_area_size_; } 50 int GetRegisterSaveAreaSize() { return register_save_area_size_; }
49 51
50 // OSR stack slots, including locals and expression stack slots. 52 // OSR stack slots, including locals and expression stack slots.
51 void SetOsrStackSlotCount(int slots) { 53 void SetOsrStackSlotCount(int slots) {
52 DCHECK(slots >= 0); 54 DCHECK(slots >= 0);
53 osr_stack_slot_count_ = slots; 55 osr_stack_slot_count_ = slots;
54 } 56 }
55 57
56 int GetOsrStackSlotCount() { return osr_stack_slot_count_; } 58 int GetOsrStackSlotCount() { return osr_stack_slot_count_; }
57 59
58 int AllocateSpillSlot(int width) { 60 int AllocateSpillSlot(bool is_double) {
59 DCHECK(width == 4 || width == 8); 61 // If 32-bit, skip one if the new slot is a double.
60 // Skip one slot if necessary. 62 if (is_double) {
61 if (width > kPointerSize) { 63 if (kDoubleSize > kPointerSize) {
62 DCHECK(width == kPointerSize * 2); 64 DCHECK(kDoubleSize == kPointerSize * 2);
63 spill_slot_count_++; 65 spill_slot_count_++;
64 spill_slot_count_ |= 1; 66 spill_slot_count_ |= 1;
67 }
68 double_spill_slot_count_++;
65 } 69 }
66 return spill_slot_count_++; 70 return spill_slot_count_++;
67 } 71 }
68 72
69 void ReserveSpillSlots(size_t slot_count) { 73 void ReserveSpillSlots(size_t slot_count) {
70 DCHECK_EQ(0, spill_slot_count_); // can only reserve before allocation. 74 DCHECK_EQ(0, spill_slot_count_); // can only reserve before allocation.
71 spill_slot_count_ = static_cast<int>(slot_count); 75 spill_slot_count_ = static_cast<int>(slot_count);
72 } 76 }
73 77
74 private: 78 private:
75 int register_save_area_size_; 79 int register_save_area_size_;
76 int spill_slot_count_; 80 int spill_slot_count_;
81 int double_spill_slot_count_;
77 int osr_stack_slot_count_; 82 int osr_stack_slot_count_;
78 BitVector* allocated_registers_; 83 BitVector* allocated_registers_;
79 BitVector* allocated_double_registers_; 84 BitVector* allocated_double_registers_;
80 85
81 DISALLOW_COPY_AND_ASSIGN(Frame); 86 DISALLOW_COPY_AND_ASSIGN(Frame);
82 }; 87 };
83 88
84 89
85 // Represents an offset from either the stack pointer or frame pointer. 90 // Represents an offset from either the stack pointer or frame pointer.
86 class FrameOffset { 91 class FrameOffset {
(...skipping 18 matching lines...) Expand all
105 int offset_; // Encodes SP or FP in the low order bit. 110 int offset_; // Encodes SP or FP in the low order bit.
106 111
107 static const int kFromSp = 1; 112 static const int kFromSp = 1;
108 static const int kFromFp = 0; 113 static const int kFromFp = 0;
109 }; 114 };
110 } 115 }
111 } 116 }
112 } // namespace v8::internal::compiler 117 } // namespace v8::internal::compiler
113 118
114 #endif // V8_COMPILER_FRAME_H_ 119 #endif // V8_COMPILER_FRAME_H_
OLDNEW
« no previous file with comments | « no previous file | src/compiler/gap-resolver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698