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

Side by Side Diff: src/compiler/register-allocator.h

Issue 430503007: Rename ASSERT* to DCHECK*. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: REBASE and fixes Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « src/compiler/raw-machine-assembler.cc ('k') | src/compiler/register-allocator.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_REGISTER_ALLOCATOR_H_ 5 #ifndef V8_REGISTER_ALLOCATOR_H_
6 #define V8_REGISTER_ALLOCATOR_H_ 6 #define V8_REGISTER_ALLOCATOR_H_
7 7
8 #include "src/allocation.h" 8 #include "src/allocation.h"
9 #include "src/compiler/instruction.h" 9 #include "src/compiler/instruction.h"
10 #include "src/compiler/node.h" 10 #include "src/compiler/node.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 static LifetimePosition FromInstructionIndex(int index) { 42 static LifetimePosition FromInstructionIndex(int index) {
43 return LifetimePosition(index * kStep); 43 return LifetimePosition(index * kStep);
44 } 44 }
45 45
46 // Returns a numeric representation of this lifetime position. 46 // Returns a numeric representation of this lifetime position.
47 int Value() const { return value_; } 47 int Value() const { return value_; }
48 48
49 // Returns the index of the instruction to which this lifetime position 49 // Returns the index of the instruction to which this lifetime position
50 // corresponds. 50 // corresponds.
51 int InstructionIndex() const { 51 int InstructionIndex() const {
52 ASSERT(IsValid()); 52 DCHECK(IsValid());
53 return value_ / kStep; 53 return value_ / kStep;
54 } 54 }
55 55
56 // Returns true if this lifetime position corresponds to the instruction 56 // Returns true if this lifetime position corresponds to the instruction
57 // start. 57 // start.
58 bool IsInstructionStart() const { return (value_ & (kStep - 1)) == 0; } 58 bool IsInstructionStart() const { return (value_ & (kStep - 1)) == 0; }
59 59
60 // Returns the lifetime position for the start of the instruction which 60 // Returns the lifetime position for the start of the instruction which
61 // corresponds to this lifetime position. 61 // corresponds to this lifetime position.
62 LifetimePosition InstructionStart() const { 62 LifetimePosition InstructionStart() const {
63 ASSERT(IsValid()); 63 DCHECK(IsValid());
64 return LifetimePosition(value_ & ~(kStep - 1)); 64 return LifetimePosition(value_ & ~(kStep - 1));
65 } 65 }
66 66
67 // Returns the lifetime position for the end of the instruction which 67 // Returns the lifetime position for the end of the instruction which
68 // corresponds to this lifetime position. 68 // corresponds to this lifetime position.
69 LifetimePosition InstructionEnd() const { 69 LifetimePosition InstructionEnd() const {
70 ASSERT(IsValid()); 70 DCHECK(IsValid());
71 return LifetimePosition(InstructionStart().Value() + kStep / 2); 71 return LifetimePosition(InstructionStart().Value() + kStep / 2);
72 } 72 }
73 73
74 // Returns the lifetime position for the beginning of the next instruction. 74 // Returns the lifetime position for the beginning of the next instruction.
75 LifetimePosition NextInstruction() const { 75 LifetimePosition NextInstruction() const {
76 ASSERT(IsValid()); 76 DCHECK(IsValid());
77 return LifetimePosition(InstructionStart().Value() + kStep); 77 return LifetimePosition(InstructionStart().Value() + kStep);
78 } 78 }
79 79
80 // Returns the lifetime position for the beginning of the previous 80 // Returns the lifetime position for the beginning of the previous
81 // instruction. 81 // instruction.
82 LifetimePosition PrevInstruction() const { 82 LifetimePosition PrevInstruction() const {
83 ASSERT(IsValid()); 83 DCHECK(IsValid());
84 ASSERT(value_ > 1); 84 DCHECK(value_ > 1);
85 return LifetimePosition(InstructionStart().Value() - kStep); 85 return LifetimePosition(InstructionStart().Value() - kStep);
86 } 86 }
87 87
88 // Constructs the lifetime position which does not correspond to any 88 // Constructs the lifetime position which does not correspond to any
89 // instruction. 89 // instruction.
90 LifetimePosition() : value_(-1) {} 90 LifetimePosition() : value_(-1) {}
91 91
92 // Returns true if this lifetime positions corrensponds to some 92 // Returns true if this lifetime positions corrensponds to some
93 // instruction. 93 // instruction.
94 bool IsValid() const { return value_ != -1; } 94 bool IsValid() const { return value_ != -1; }
(...skipping 16 matching lines...) Expand all
111 111
112 int value_; 112 int value_;
113 }; 113 };
114 114
115 115
116 // Representation of the non-empty interval [start,end[. 116 // Representation of the non-empty interval [start,end[.
117 class UseInterval : public ZoneObject { 117 class UseInterval : public ZoneObject {
118 public: 118 public:
119 UseInterval(LifetimePosition start, LifetimePosition end) 119 UseInterval(LifetimePosition start, LifetimePosition end)
120 : start_(start), end_(end), next_(NULL) { 120 : start_(start), end_(end), next_(NULL) {
121 ASSERT(start.Value() < end.Value()); 121 DCHECK(start.Value() < end.Value());
122 } 122 }
123 123
124 LifetimePosition start() const { return start_; } 124 LifetimePosition start() const { return start_; }
125 LifetimePosition end() const { return end_; } 125 LifetimePosition end() const { return end_; }
126 UseInterval* next() const { return next_; } 126 UseInterval* next() const { return next_; }
127 127
128 // Split this interval at the given position without effecting the 128 // Split this interval at the given position without effecting the
129 // live range that owns it. The interval must contain the position. 129 // live range that owns it. The interval must contain the position.
130 void SplitAt(LifetimePosition pos, Zone* zone); 130 void SplitAt(LifetimePosition pos, Zone* zone);
131 131
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 // live range to the result live range. 233 // live range to the result live range.
234 void SplitAt(LifetimePosition position, LiveRange* result, Zone* zone); 234 void SplitAt(LifetimePosition position, LiveRange* result, Zone* zone);
235 235
236 RegisterKind Kind() const { return kind_; } 236 RegisterKind Kind() const { return kind_; }
237 bool HasRegisterAssigned() const { 237 bool HasRegisterAssigned() const {
238 return assigned_register_ != kInvalidAssignment; 238 return assigned_register_ != kInvalidAssignment;
239 } 239 }
240 bool IsSpilled() const { return spilled_; } 240 bool IsSpilled() const { return spilled_; }
241 241
242 InstructionOperand* current_hint_operand() const { 242 InstructionOperand* current_hint_operand() const {
243 ASSERT(current_hint_operand_ == FirstHint()); 243 DCHECK(current_hint_operand_ == FirstHint());
244 return current_hint_operand_; 244 return current_hint_operand_;
245 } 245 }
246 InstructionOperand* FirstHint() const { 246 InstructionOperand* FirstHint() const {
247 UsePosition* pos = first_pos_; 247 UsePosition* pos = first_pos_;
248 while (pos != NULL && !pos->HasHint()) pos = pos->next(); 248 while (pos != NULL && !pos->HasHint()) pos = pos->next();
249 if (pos != NULL) return pos->hint(); 249 if (pos != NULL) return pos->hint();
250 return NULL; 250 return NULL;
251 } 251 }
252 252
253 LifetimePosition Start() const { 253 LifetimePosition Start() const {
254 ASSERT(!IsEmpty()); 254 DCHECK(!IsEmpty());
255 return first_interval()->start(); 255 return first_interval()->start();
256 } 256 }
257 257
258 LifetimePosition End() const { 258 LifetimePosition End() const {
259 ASSERT(!IsEmpty()); 259 DCHECK(!IsEmpty());
260 return last_interval_->end(); 260 return last_interval_->end();
261 } 261 }
262 262
263 bool HasAllocatedSpillOperand() const; 263 bool HasAllocatedSpillOperand() const;
264 InstructionOperand* GetSpillOperand() const { return spill_operand_; } 264 InstructionOperand* GetSpillOperand() const { return spill_operand_; }
265 void SetSpillOperand(InstructionOperand* operand); 265 void SetSpillOperand(InstructionOperand* operand);
266 266
267 void SetSpillStartIndex(int start) { 267 void SetSpillStartIndex(int start) {
268 spill_start_index_ = Min(start, spill_start_index_); 268 spill_start_index_ = Min(start, spill_start_index_);
269 } 269 }
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 RegisterAllocator* allocator_; 538 RegisterAllocator* allocator_;
539 unsigned allocator_zone_start_allocation_size_; 539 unsigned allocator_zone_start_allocation_size_;
540 540
541 DISALLOW_COPY_AND_ASSIGN(RegisterAllocatorPhase); 541 DISALLOW_COPY_AND_ASSIGN(RegisterAllocatorPhase);
542 }; 542 };
543 } 543 }
544 } 544 }
545 } // namespace v8::internal::compiler 545 } // namespace v8::internal::compiler
546 546
547 #endif // V8_REGISTER_ALLOCATOR_H_ 547 #endif // V8_REGISTER_ALLOCATOR_H_
OLDNEW
« no previous file with comments | « src/compiler/raw-machine-assembler.cc ('k') | src/compiler/register-allocator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698