| Index: src/lithium-allocator.h
|
| diff --git a/src/lithium-allocator.h b/src/lithium-allocator.h
|
| index dfe1953df6c15b5af01de5f89a3c7866a5780510..4febc2cbfe2336fa987f14abfbb4b26a17f1630d 100644
|
| --- a/src/lithium-allocator.h
|
| +++ b/src/lithium-allocator.h
|
| @@ -321,27 +321,46 @@ class LUnallocated: public LOperand {
|
|
|
| class LMoveOperands BASE_EMBEDDED {
|
| public:
|
| - LMoveOperands(LOperand* from, LOperand* to) : from_(from), to_(to) { }
|
| + LMoveOperands(LOperand* source, LOperand* destination)
|
| + : source_(source), destination_(destination) {
|
| + }
|
| +
|
| + LOperand* source() const { return source_; }
|
| + void set_source(LOperand* operand) { source_ = operand; }
|
| +
|
| + LOperand* destination() const { return destination_; }
|
| + void set_destination(LOperand* operand) { destination_ = operand; }
|
| +
|
| + // The gap resolver marks moves as "in-progress" by clearing the
|
| + // destination (but not the source).
|
| + bool IsPending() const {
|
| + return destination_ == NULL && source_ != NULL;
|
| + }
|
|
|
| - LOperand* from() const { return from_; }
|
| - LOperand* to() const { return to_; }
|
| + // True if this move a move into the given destination operand.
|
| + bool Blocks(LOperand* operand) const {
|
| + return !IsEliminated() && source()->Equals(operand);
|
| + }
|
| +
|
| + // A move is redundant if it's been eliminated, if its source and
|
| + // destination are the same, or if its destination is unneeded.
|
| bool IsRedundant() const {
|
| - return IsEliminated() || from_->Equals(to_) || IsIgnored();
|
| + return IsEliminated() || source_->Equals(destination_) || IsIgnored();
|
| }
|
| - bool IsEliminated() const { return from_ == NULL; }
|
| +
|
| bool IsIgnored() const {
|
| - if (to_ != NULL && to_->IsUnallocated() &&
|
| - LUnallocated::cast(to_)->HasIgnorePolicy()) {
|
| - return true;
|
| - }
|
| - return false;
|
| + return destination_ != NULL &&
|
| + destination_->IsUnallocated() &&
|
| + LUnallocated::cast(destination_)->HasIgnorePolicy();
|
| }
|
|
|
| - void Eliminate() { from_ = to_ = NULL; }
|
| + // We clear both operands to indicate move that's been eliminated.
|
| + void Eliminate() { source_ = destination_ = NULL; }
|
| + bool IsEliminated() const { return source_ == NULL; }
|
|
|
| private:
|
| - LOperand* from_;
|
| - LOperand* to_;
|
| + LOperand* source_;
|
| + LOperand* destination_;
|
| };
|
|
|
|
|
|
|