Reviewers: danno,

Message:
PTAL

Description:
Fix CmpHoleAndBranch on no-sse2

Please review this at https://chromiumcodereview.appspot.com/22810005/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M src/ia32/lithium-codegen-ia32.cc


Index: src/ia32/lithium-codegen-ia32.cc
diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc index 7753e1d37f362b29655a2513a89e91a608a6e991..1f7af0cdaf599f5f21547e4c31a71e8f0657112c 100644
--- a/src/ia32/lithium-codegen-ia32.cc
+++ b/src/ia32/lithium-codegen-ia32.cc
@@ -360,6 +360,7 @@ bool LCodeGen::GenerateBody() {
     instr->CompileToNative(this);

     if (!CpuFeatures::IsSupported(SSE2)) {
+      if (instr->ClobbersDoubleRegisters()) x87_stack_depth_ = 0;
       if (FLAG_debug_code && FLAG_enable_slow_asserts) {
         __ VerifyX87StackDepth(x87_stack_depth_);
       }
@@ -2236,7 +2237,11 @@ void LCodeGen::EmitBranch(InstrType instr, Condition cc) {
 template<class InstrType>
 void LCodeGen::EmitFalseBranch(InstrType instr, Condition cc) {
   int false_block = instr->FalseDestination(chunk_);
-  __ j(cc, chunk_->GetAssemblyLabel(false_block));
+  if (cc == no_condition) {
+    __ jmp(chunk_->GetAssemblyLabel(false_block));
+  } else {
+    __ j(cc, chunk_->GetAssemblyLabel(false_block));
+  }
 }


@@ -2503,6 +2508,7 @@ void LCodeGen::DoCmpHoleAndBranch(LCmpHoleAndBranch* instr) {
     CpuFeatureScope scope(masm(), SSE2);
     XMMRegister input_reg = ToDoubleRegister(instr->object());
     __ ucomisd(input_reg, input_reg);
+    EmitFalseBranch(instr, parity_odd);
   } else {
     // Put the value to the top of stack
     X87Register src = ToX87Register(instr->object());
@@ -2510,9 +2516,13 @@ void LCodeGen::DoCmpHoleAndBranch(LCmpHoleAndBranch* instr) {
     __ fld(0);
     __ fld(0);
     __ FCmp();
+    Label ok;
+    __ j(parity_even, &ok);
+    __ fstp(0);
+    EmitFalseBranch(instr, no_condition);
+    __ bind(&ok);
   }

-  EmitFalseBranch(instr, parity_odd);

   __ sub(esp, Immediate(kDoubleSize));
   if (use_sse2) {
@@ -2520,7 +2530,6 @@ void LCodeGen::DoCmpHoleAndBranch(LCmpHoleAndBranch* instr) {
     XMMRegister input_reg = ToDoubleRegister(instr->object());
     __ movdbl(MemOperand(esp, 0), input_reg);
   } else {
-    __ fld(0);
     __ fstp_d(MemOperand(esp, 0));
   }



--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to