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

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

Issue 1056063004: [turbofan] make live ranges stateless (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 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/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/compiler/instruction.h" 8 #include "src/compiler/instruction.h"
9 #include "src/zone-containers.h" 9 #include "src/zone-containers.h"
10 10
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 void set_is_phi(bool is_phi) { is_phi_ = is_phi; } 239 void set_is_phi(bool is_phi) { is_phi_ = is_phi; }
240 bool is_non_loop_phi() const { return is_non_loop_phi_; } 240 bool is_non_loop_phi() const { return is_non_loop_phi_; }
241 void set_is_non_loop_phi(bool is_non_loop_phi) { 241 void set_is_non_loop_phi(bool is_non_loop_phi) {
242 is_non_loop_phi_ = is_non_loop_phi; 242 is_non_loop_phi_ = is_non_loop_phi;
243 } 243 }
244 bool has_slot_use() const { return has_slot_use_; } 244 bool has_slot_use() const { return has_slot_use_; }
245 void set_has_slot_use(bool has_slot_use) { has_slot_use_ = has_slot_use; } 245 void set_has_slot_use(bool has_slot_use) { has_slot_use_ = has_slot_use; }
246 246
247 // Returns use position in this live range that follows both start 247 // Returns use position in this live range that follows both start
248 // and last processed use position. 248 // and last processed use position.
249 // Modifies internal state of live range! 249 UsePosition* NextUsePosition(LifetimePosition start) const;
250 UsePosition* NextUsePosition(LifetimePosition start);
251 250
252 // Returns use position for which register is required in this live 251 // Returns use position for which register is required in this live
253 // range and which follows both start and last processed use position 252 // range and which follows both start and last processed use position
254 // Modifies internal state of live range! 253 UsePosition* NextRegisterPosition(LifetimePosition start) const;
255 UsePosition* NextRegisterPosition(LifetimePosition start);
256 254
257 // Returns use position for which register is beneficial in this live 255 // Returns use position for which register is beneficial in this live
258 // range and which follows both start and last processed use position 256 // range and which follows both start and last processed use position
259 // Modifies internal state of live range! 257 UsePosition* NextUsePositionRegisterIsBeneficial(
260 UsePosition* NextUsePositionRegisterIsBeneficial(LifetimePosition start); 258 LifetimePosition start) const;
261 259
262 // Returns use position for which register is beneficial in this live 260 // Returns use position for which register is beneficial in this live
263 // range and which precedes start. 261 // range and which precedes start.
264 UsePosition* PreviousUsePositionRegisterIsBeneficial(LifetimePosition start); 262 UsePosition* PreviousUsePositionRegisterIsBeneficial(
263 LifetimePosition start) const;
265 264
266 // Can this live range be spilled at this position. 265 // Can this live range be spilled at this position.
267 bool CanBeSpilled(LifetimePosition pos); 266 bool CanBeSpilled(LifetimePosition pos) const;
268 267
269 // Split this live range at the given position which must follow the start of 268 // Split this live range at the given position which must follow the start of
270 // the range. 269 // the range.
271 // All uses following the given position will be moved from this 270 // All uses following the given position will be moved from this
272 // live range to the result live range. 271 // live range to the result live range.
273 void SplitAt(LifetimePosition position, LiveRange* result, Zone* zone); 272 void SplitAt(LifetimePosition position, LiveRange* result, Zone* zone);
274 273
275 RegisterKind Kind() const { return kind_; } 274 RegisterKind Kind() const { return kind_; }
276 bool HasRegisterAssigned() const { 275 bool HasRegisterAssigned() const {
277 return assigned_register_ != kInvalidAssignment; 276 return assigned_register_ != kInvalidAssignment;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 void CommitSpillsAtDefinition(InstructionSequence* sequence, 322 void CommitSpillsAtDefinition(InstructionSequence* sequence,
324 InstructionOperand* operand, 323 InstructionOperand* operand,
325 bool might_be_duplicated); 324 bool might_be_duplicated);
326 325
327 void SetSpillStartIndex(int start) { 326 void SetSpillStartIndex(int start) {
328 spill_start_index_ = Min(start, spill_start_index_); 327 spill_start_index_ = Min(start, spill_start_index_);
329 } 328 }
330 329
331 bool ShouldBeAllocatedBefore(const LiveRange* other) const; 330 bool ShouldBeAllocatedBefore(const LiveRange* other) const;
332 bool CanCover(LifetimePosition position) const; 331 bool CanCover(LifetimePosition position) const;
333 bool Covers(LifetimePosition position); 332 bool Covers(LifetimePosition position) const;
334 LifetimePosition FirstIntersection(LiveRange* other); 333 LifetimePosition FirstIntersection(LiveRange* other) const;
335 334
336 // Add a new interval or a new use position to this live range. 335 // Add a new interval or a new use position to this live range.
337 void EnsureInterval(LifetimePosition start, LifetimePosition end, Zone* zone); 336 void EnsureInterval(LifetimePosition start, LifetimePosition end, Zone* zone);
338 void AddUseInterval(LifetimePosition start, LifetimePosition end, Zone* zone); 337 void AddUseInterval(LifetimePosition start, LifetimePosition end, Zone* zone);
339 void AddUsePosition(LifetimePosition pos, InstructionOperand* operand, 338 void AddUsePosition(LifetimePosition pos, InstructionOperand* operand,
340 InstructionOperand* hint, Zone* zone); 339 InstructionOperand* hint, Zone* zone);
341 340
342 // Shorten the most recently added interval by setting a new start. 341 // Shorten the most recently added interval by setting a new start.
343 void ShortenTo(LifetimePosition start); 342 void ShortenTo(LifetimePosition start);
344 343
(...skipping 21 matching lines...) Expand all
366 bool is_non_loop_phi_ : 1; 365 bool is_non_loop_phi_ : 1;
367 RegisterKind kind_; 366 RegisterKind kind_;
368 int assigned_register_; 367 int assigned_register_;
369 UseInterval* last_interval_; 368 UseInterval* last_interval_;
370 UseInterval* first_interval_; 369 UseInterval* first_interval_;
371 UsePosition* first_pos_; 370 UsePosition* first_pos_;
372 LiveRange* parent_; 371 LiveRange* parent_;
373 LiveRange* next_; 372 LiveRange* next_;
374 // This is used as a cache, it doesn't affect correctness. 373 // This is used as a cache, it doesn't affect correctness.
375 mutable UseInterval* current_interval_; 374 mutable UseInterval* current_interval_;
376 UsePosition* last_processed_use_; 375 // This is used as a cache, it doesn't affect correctness.
376 mutable UsePosition* last_processed_use_;
377 // This is used as a cache, it's invalid outside of BuildLiveRanges. 377 // This is used as a cache, it's invalid outside of BuildLiveRanges.
378 InstructionOperand* current_hint_operand_; 378 mutable InstructionOperand* current_hint_operand_;
379 int spill_start_index_; 379 int spill_start_index_;
380 SpillType spill_type_; 380 SpillType spill_type_;
381 union { 381 union {
382 InstructionOperand* spill_operand_; 382 InstructionOperand* spill_operand_;
383 SpillRange* spill_range_; 383 SpillRange* spill_range_;
384 }; 384 };
385 SpillAtDefinitionList* spills_at_definition_; 385 SpillAtDefinitionList* spills_at_definition_;
386 386
387 DISALLOW_COPY_AND_ASSIGN(LiveRange); 387 DISALLOW_COPY_AND_ASSIGN(LiveRange);
388 }; 388 };
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
753 RegisterAllocationData* const data_; 753 RegisterAllocationData* const data_;
754 754
755 DISALLOW_COPY_AND_ASSIGN(LiveRangeConnector); 755 DISALLOW_COPY_AND_ASSIGN(LiveRangeConnector);
756 }; 756 };
757 757
758 } // namespace compiler 758 } // namespace compiler
759 } // namespace internal 759 } // namespace internal
760 } // namespace v8 760 } // namespace v8
761 761
762 #endif // V8_REGISTER_ALLOCATOR_H_ 762 #endif // V8_REGISTER_ALLOCATOR_H_
OLDNEW
« no previous file with comments | « no previous file | src/compiler/register-allocator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698