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

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

Issue 1087793002: [turbofan] add MachineType to AllocatedOperand (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: no flag 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),
24 osr_stack_slot_count_(0), 23 osr_stack_slot_count_(0),
25 allocated_registers_(NULL), 24 allocated_registers_(NULL),
26 allocated_double_registers_(NULL) {} 25 allocated_double_registers_(NULL) {}
27 26
28 inline int GetSpillSlotCount() { return spill_slot_count_; } 27 inline int GetSpillSlotCount() { return spill_slot_count_; }
29 inline int GetDoubleSpillSlotCount() { return double_spill_slot_count_; }
30 28
31 void SetAllocatedRegisters(BitVector* regs) { 29 void SetAllocatedRegisters(BitVector* regs) {
32 DCHECK(allocated_registers_ == NULL); 30 DCHECK(allocated_registers_ == NULL);
33 allocated_registers_ = regs; 31 allocated_registers_ = regs;
34 } 32 }
35 33
36 void SetAllocatedDoubleRegisters(BitVector* regs) { 34 void SetAllocatedDoubleRegisters(BitVector* regs) {
37 DCHECK(allocated_double_registers_ == NULL); 35 DCHECK(allocated_double_registers_ == NULL);
38 allocated_double_registers_ = regs; 36 allocated_double_registers_ = regs;
39 } 37 }
(...skipping 10 matching lines...) Expand all
50 int GetRegisterSaveAreaSize() { return register_save_area_size_; } 48 int GetRegisterSaveAreaSize() { return register_save_area_size_; }
51 49
52 // OSR stack slots, including locals and expression stack slots. 50 // OSR stack slots, including locals and expression stack slots.
53 void SetOsrStackSlotCount(int slots) { 51 void SetOsrStackSlotCount(int slots) {
54 DCHECK(slots >= 0); 52 DCHECK(slots >= 0);
55 osr_stack_slot_count_ = slots; 53 osr_stack_slot_count_ = slots;
56 } 54 }
57 55
58 int GetOsrStackSlotCount() { return osr_stack_slot_count_; } 56 int GetOsrStackSlotCount() { return osr_stack_slot_count_; }
59 57
60 int AllocateSpillSlot(bool is_double) { 58 int AllocateSpillSlot(int width) {
61 // If 32-bit, skip one if the new slot is a double. 59 DCHECK(width == 4 || width == 8);
62 if (is_double) { 60 // Skip one slot if necessary.
63 if (kDoubleSize > kPointerSize) { 61 if (width > kPointerSize) {
64 DCHECK(kDoubleSize == kPointerSize * 2); 62 DCHECK(width == kPointerSize * 2);
65 spill_slot_count_++; 63 spill_slot_count_++;
66 spill_slot_count_ |= 1; 64 spill_slot_count_ |= 1;
67 }
68 double_spill_slot_count_++;
69 } 65 }
70 return spill_slot_count_++; 66 return spill_slot_count_++;
71 } 67 }
72 68
73 void ReserveSpillSlots(size_t slot_count) { 69 void ReserveSpillSlots(size_t slot_count) {
74 DCHECK_EQ(0, spill_slot_count_); // can only reserve before allocation. 70 DCHECK_EQ(0, spill_slot_count_); // can only reserve before allocation.
75 spill_slot_count_ = static_cast<int>(slot_count); 71 spill_slot_count_ = static_cast<int>(slot_count);
76 } 72 }
77 73
78 private: 74 private:
79 int register_save_area_size_; 75 int register_save_area_size_;
80 int spill_slot_count_; 76 int spill_slot_count_;
81 int double_spill_slot_count_;
82 int osr_stack_slot_count_; 77 int osr_stack_slot_count_;
83 BitVector* allocated_registers_; 78 BitVector* allocated_registers_;
84 BitVector* allocated_double_registers_; 79 BitVector* allocated_double_registers_;
85 80
86 DISALLOW_COPY_AND_ASSIGN(Frame); 81 DISALLOW_COPY_AND_ASSIGN(Frame);
87 }; 82 };
88 83
89 84
90 // Represents an offset from either the stack pointer or frame pointer. 85 // Represents an offset from either the stack pointer or frame pointer.
91 class FrameOffset { 86 class FrameOffset {
(...skipping 18 matching lines...) Expand all
110 int offset_; // Encodes SP or FP in the low order bit. 105 int offset_; // Encodes SP or FP in the low order bit.
111 106
112 static const int kFromSp = 1; 107 static const int kFromSp = 1;
113 static const int kFromFp = 0; 108 static const int kFromFp = 0;
114 }; 109 };
115 } 110 }
116 } 111 }
117 } // namespace v8::internal::compiler 112 } // namespace v8::internal::compiler
118 113
119 #endif // V8_COMPILER_FRAME_H_ 114 #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