diff options
Diffstat (limited to 'deps/v8/src/compiler/move-optimizer.cc')
-rw-r--r-- | deps/v8/src/compiler/move-optimizer.cc | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/deps/v8/src/compiler/move-optimizer.cc b/deps/v8/src/compiler/move-optimizer.cc index 477f139a14..482c254de1 100644 --- a/deps/v8/src/compiler/move-optimizer.cc +++ b/deps/v8/src/compiler/move-optimizer.cc @@ -24,16 +24,12 @@ struct MoveKeyCompare { } }; -struct OperandCompare { - bool operator()(const InstructionOperand& a, - const InstructionOperand& b) const { - return a.CompareCanonicalized(b); - } -}; - typedef ZoneMap<MoveKey, unsigned, MoveKeyCompare> MoveMap; typedef ZoneSet<InstructionOperand, CompareOperandModuloType> OperandSet; +bool Blocks(const OperandSet& set, const InstructionOperand& operand) { + return set.find(operand) != set.end(); +} int FindFirstNonEmptySlot(const Instruction* instr) { int i = Instruction::FIRST_GAP_POSITION; @@ -123,7 +119,7 @@ void MoveOptimizer::RemoveClobberedDestinations(Instruction* instruction) { // The ret instruction makes any assignment before it unnecessary, except for // the one for its input. - if (instruction->opcode() == ArchOpcode::kArchRet) { + if (instruction->IsRet() || instruction->IsTailCall()) { for (MoveOperands* move : *moves) { if (inputs.find(move->destination()) == inputs.end()) { move->Eliminate(); @@ -138,8 +134,8 @@ void MoveOptimizer::MigrateMoves(Instruction* to, Instruction* from) { ParallelMove* from_moves = from->parallel_moves()[0]; if (from_moves == nullptr || from_moves->empty()) return; - ZoneSet<InstructionOperand, OperandCompare> dst_cant_be(local_zone()); - ZoneSet<InstructionOperand, OperandCompare> src_cant_be(local_zone()); + OperandSet dst_cant_be(local_zone()); + OperandSet src_cant_be(local_zone()); // If an operand is an input to the instruction, we cannot move assignments // where it appears on the LHS. @@ -172,7 +168,7 @@ void MoveOptimizer::MigrateMoves(Instruction* to, Instruction* from) { // destination operands are eligible for being moved down. for (MoveOperands* move : *from_moves) { if (move->IsRedundant()) continue; - if (dst_cant_be.find(move->destination()) == dst_cant_be.end()) { + if (!Blocks(dst_cant_be, move->destination())) { MoveKey key = {move->source(), move->destination()}; move_candidates.insert(key); } @@ -187,7 +183,7 @@ void MoveOptimizer::MigrateMoves(Instruction* to, Instruction* from) { auto current = iter; ++iter; InstructionOperand src = current->source; - if (src_cant_be.find(src) != src_cant_be.end()) { + if (Blocks(src_cant_be, src)) { src_cant_be.insert(current->destination); move_candidates.erase(current); changed = true; |