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

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

Issue 1533723002: [turbofan] More thorough validation of LiveRanges. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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/ostreams.h" 9 #include "src/ostreams.h"
10 #include "src/register-configuration.h" 10 #include "src/register-configuration.h"
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 LifetimePosition End() const { 389 LifetimePosition End() const {
390 DCHECK(!IsEmpty()); 390 DCHECK(!IsEmpty());
391 return last_interval_->end(); 391 return last_interval_->end();
392 } 392 }
393 393
394 bool ShouldBeAllocatedBefore(const LiveRange* other) const; 394 bool ShouldBeAllocatedBefore(const LiveRange* other) const;
395 bool CanCover(LifetimePosition position) const; 395 bool CanCover(LifetimePosition position) const;
396 bool Covers(LifetimePosition position) const; 396 bool Covers(LifetimePosition position) const;
397 LifetimePosition FirstIntersection(LiveRange* other) const; 397 LifetimePosition FirstIntersection(LiveRange* other) const;
398 398
399 void Verify() const; 399 void VerifyChildStructure() const {
400 VerifyIntervals();
401 VerifyPositions();
402 }
400 403
401 void ConvertUsesToOperand(const InstructionOperand& op, 404 void ConvertUsesToOperand(const InstructionOperand& op,
402 const InstructionOperand& spill_op); 405 const InstructionOperand& spill_op);
403 void SetUseHints(int register_index); 406 void SetUseHints(int register_index);
404 void UnsetUseHints() { SetUseHints(kUnassignedRegister); } 407 void UnsetUseHints() { SetUseHints(kUnassignedRegister); }
405 408
406 // Used solely by the Greedy Allocator: 409 // Used solely by the Greedy Allocator:
407 unsigned GetSize(); 410 unsigned GetSize();
408 float weight() const { return weight_; } 411 float weight() const { return weight_; }
409 void set_weight(float weight) { weight_ = weight; } 412 void set_weight(float weight) { weight_ = weight; }
(...skipping 11 matching lines...) Expand all
421 424
422 void AppendAsChild(TopLevelLiveRange* other); 425 void AppendAsChild(TopLevelLiveRange* other);
423 void UpdateParentForAllChildren(TopLevelLiveRange* new_top_level); 426 void UpdateParentForAllChildren(TopLevelLiveRange* new_top_level);
424 427
425 void set_spilled(bool value) { bits_ = SpilledField::update(bits_, value); } 428 void set_spilled(bool value) { bits_ = SpilledField::update(bits_, value); }
426 429
427 UseInterval* FirstSearchIntervalForPosition(LifetimePosition position) const; 430 UseInterval* FirstSearchIntervalForPosition(LifetimePosition position) const;
428 void AdvanceLastProcessedMarker(UseInterval* to_start_of, 431 void AdvanceLastProcessedMarker(UseInterval* to_start_of,
429 LifetimePosition but_not_past) const; 432 LifetimePosition but_not_past) const;
430 433
434 void VerifyPositions() const;
435 void VerifyIntervals() const;
436
431 typedef BitField<bool, 0, 1> SpilledField; 437 typedef BitField<bool, 0, 1> SpilledField;
432 typedef BitField<int32_t, 6, 6> AssignedRegisterField; 438 typedef BitField<int32_t, 6, 6> AssignedRegisterField;
433 typedef BitField<MachineRepresentation, 12, 8> RepresentationField; 439 typedef BitField<MachineRepresentation, 12, 8> RepresentationField;
434 440
435 // Unique among children and splinters of the same virtual register. 441 // Unique among children and splinters of the same virtual register.
436 int relative_id_; 442 int relative_id_;
437 uint32_t bits_; 443 uint32_t bits_;
438 UseInterval* last_interval_; 444 UseInterval* last_interval_;
439 UseInterval* first_interval_; 445 UseInterval* first_interval_;
440 UsePosition* first_pos_; 446 UsePosition* first_pos_;
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 DCHECK(!IsSplinter()); 589 DCHECK(!IsSplinter());
584 return !HasSpillOperand() && spill_range_ == nullptr; 590 return !HasSpillOperand() && spill_range_ == nullptr;
585 } 591 }
586 void UpdateSpillRangePostMerge(TopLevelLiveRange* merged); 592 void UpdateSpillRangePostMerge(TopLevelLiveRange* merged);
587 int vreg() const { return vreg_; } 593 int vreg() const { return vreg_; }
588 594
589 #if DEBUG 595 #if DEBUG
590 int debug_virt_reg() const; 596 int debug_virt_reg() const;
591 #endif 597 #endif
592 598
599 void Verify() const;
600 void VerifyChildrenInOrder() const;
601
593 int GetNextChildId() { 602 int GetNextChildId() {
594 return IsSplinter() ? splintered_from()->GetNextChildId() 603 return IsSplinter() ? splintered_from()->GetNextChildId()
595 : ++last_child_id_; 604 : ++last_child_id_;
596 } 605 }
597 606
598 int GetChildCount() const { return last_child_id_ + 1; } 607 int GetChildCount() const { return last_child_id_ + 1; }
599 608
600 bool IsSpilledOnlyInDeferredBlocks() const { 609 bool IsSpilledOnlyInDeferredBlocks() const {
601 return spilled_in_deferred_blocks_; 610 return spilled_in_deferred_blocks_;
602 } 611 }
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
1155 RegisterAllocationData* const data_; 1164 RegisterAllocationData* const data_;
1156 1165
1157 DISALLOW_COPY_AND_ASSIGN(LiveRangeConnector); 1166 DISALLOW_COPY_AND_ASSIGN(LiveRangeConnector);
1158 }; 1167 };
1159 1168
1160 } // namespace compiler 1169 } // namespace compiler
1161 } // namespace internal 1170 } // namespace internal
1162 } // namespace v8 1171 } // namespace v8
1163 1172
1164 #endif // V8_REGISTER_ALLOCATOR_H_ 1173 #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