From: iposva@chromium.org Date: Mon, 13 Oct 2008 20:15:17 +0000 (+0000) Subject: Fix a missing peephole optimization in ia32 code exposed with Kevin's X-Git-Tag: upstream/4.7.83~25204 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=49c5ed0029bd085c798daa27ba95e518f1ff75d9;p=platform%2Fupstream%2Fv8.git Fix a missing peephole optimization in ia32 code exposed with Kevin's change. Review URL: http://codereview.chromium.org/7117 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@491 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/src/assembler-ia32.cc b/src/assembler-ia32.cc index 27ed246..bacee5a 100644 --- a/src/assembler-ia32.cc +++ b/src/assembler-ia32.cc @@ -720,6 +720,23 @@ void Assembler::add(Register dst, const Operand& src) { void Assembler::add(const Operand& dst, const Immediate& x) { + ASSERT(reloc_info_writer.last_pc() != NULL); + if (FLAG_push_pop_elimination && (reloc_info_writer.last_pc() <= last_pc_)) { + byte instr = last_pc_[0]; + if ((instr & 0xf8) == 0x50) { + // Last instruction was a push. Check whether this is a pop without a + // result. + if ((dst.is_reg(esp)) && + (x.x_ == kPointerSize) && (x.rmode_ == RelocInfo::NONE)) { + pc_ = last_pc_; + last_pc_ = NULL; + if (FLAG_print_push_pop_elimination) { + PrintF("%d push/pop(noreg) eliminated\n", pc_offset()); + } + return; + } + } + } EnsureSpace ensure_space(this); last_pc_ = pc_; emit_arith(0, dst, x);