Make HCompareNumericAndBranch safe for snapshots on ia32.
authorbmeurer@chromium.org <bmeurer@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Mon, 16 Sep 2013 12:38:41 +0000 (12:38 +0000)
committerbmeurer@chromium.org <bmeurer@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Mon, 16 Sep 2013 12:38:41 +0000 (12:38 +0000)
R=danno@chromium.org

Review URL: https://codereview.chromium.org/24078012

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16730 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/ia32/lithium-codegen-ia32.cc

index 7d7b51d..ec0d042 100644 (file)
@@ -2556,10 +2556,18 @@ void LCodeGen::DoCompareNumericAndBranch(LCompareNumericAndBranch* instr) {
     EmitGoto(next_block);
   } else {
     if (instr->is_double()) {
-      CpuFeatureScope scope(masm(), SSE2);
+      if (CpuFeatures::IsSafeForSnapshot(SSE2)) {
+        CpuFeatureScope scope(masm(), SSE2);
+        __ ucomisd(ToDoubleRegister(left), ToDoubleRegister(right));
+      } else {
+        X87Fxch(ToX87Register(right));
+        X87Fxch(ToX87Register(left), 1);
+        __ fld(0);
+        __ fld(2);
+        __ FCmp();
+      }
       // Don't base result on EFLAGS when a NaN is involved. Instead
       // jump to the false block.
-      __ ucomisd(ToDoubleRegister(left), ToDoubleRegister(right));
       __ j(parity_even, instr->FalseLabel(chunk_));
     } else {
       if (right->IsConstantOperand()) {