Fix usage of EmitBranch in compare-minus-zero-and-branch.
authoryangguo@chromium.org <yangguo@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 12 Nov 2013 17:18:05 +0000 (17:18 +0000)
committeryangguo@chromium.org <yangguo@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 12 Nov 2013 17:18:05 +0000 (17:18 +0000)
R=jkummerow@chromium.org
BUG=

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

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

src/arm/lithium-codegen-arm.cc
src/arm/lithium-codegen-arm.h
src/ia32/lithium-codegen-ia32.cc
src/ia32/lithium-codegen-ia32.h
src/x64/lithium-codegen-x64.cc
src/x64/lithium-codegen-x64.h

index 9533d03..207dd8c 100644 (file)
@@ -2475,28 +2475,27 @@ void LCodeGen::DoCmpHoleAndBranch(LCmpHoleAndBranch* instr) {
 void LCodeGen::DoCompareMinusZeroAndBranch(LCompareMinusZeroAndBranch* instr) {
   Representation rep = instr->hydrogen()->value()->representation();
   ASSERT(!rep.IsInteger32());
-  Label if_false;
   Register scratch = ToRegister(instr->temp());
 
   if (rep.IsDouble()) {
     DwVfpRegister value = ToDoubleRegister(instr->value());
     __ VFPCompareAndSetFlags(value, 0.0);
-    __ b(ne, &if_false);
+    EmitFalseBranch(instr, ne);
     __ VmovHigh(scratch, value);
     __ cmp(scratch, Operand(0x80000000));
   } else {
     Register value = ToRegister(instr->value());
-    __ CheckMap(
-        value, scratch, Heap::kHeapNumberMapRootIndex, &if_false, DO_SMI_CHECK);
+    __ CheckMap(value,
+                scratch,
+                Heap::kHeapNumberMapRootIndex,
+                instr->FalseLabel(chunk()),
+                DO_SMI_CHECK);
     __ ldr(scratch, FieldMemOperand(value, HeapNumber::kExponentOffset));
     __ ldr(ip, FieldMemOperand(value, HeapNumber::kMantissaOffset));
     __ cmp(scratch, Operand(0x80000000));
     __ cmp(ip, Operand(0x00000000), eq);
   }
   EmitBranch(instr, eq);
-
-  __ bind(&if_false);
-  EmitFalseBranch(instr, al);
 }
 
 
index cbd6b9c..7390a48 100644 (file)
@@ -297,6 +297,8 @@ class LCodeGen: public LCodeGenBase {
 
   static Condition TokenToCondition(Token::Value op, bool is_unsigned);
   void EmitGoto(int block);
+
+  // EmitBranch expects to be the last instruction of a block.
   template<class InstrType>
   void EmitBranch(InstrType instr, Condition condition);
   template<class InstrType>
index bc46113..de52fad 100644 (file)
@@ -2673,7 +2673,6 @@ void LCodeGen::DoCmpHoleAndBranch(LCmpHoleAndBranch* instr) {
 void LCodeGen::DoCompareMinusZeroAndBranch(LCompareMinusZeroAndBranch* instr) {
   Representation rep = instr->hydrogen()->value()->representation();
   ASSERT(!rep.IsInteger32());
-  Label if_false;
   Register scratch = ToRegister(instr->temp());
 
   if (rep.IsDouble()) {
@@ -2682,24 +2681,21 @@ void LCodeGen::DoCompareMinusZeroAndBranch(LCompareMinusZeroAndBranch* instr) {
     XMMRegister xmm_scratch = double_scratch0();
     __ xorps(xmm_scratch, xmm_scratch);
     __ ucomisd(xmm_scratch, value);
-    __ j(not_equal, &if_false);
+    EmitFalseBranch(instr, not_equal);
     __ movmskpd(scratch, value);
     __ test(scratch, Immediate(1));
     EmitBranch(instr, not_zero);
   } else {
     Register value = ToRegister(instr->value());
     Handle<Map> map = masm()->isolate()->factory()->heap_number_map();
-    __ CheckMap(value, map, &if_false, DO_SMI_CHECK);
+    __ CheckMap(value, map, instr->FalseLabel(chunk()), DO_SMI_CHECK);
     __ cmp(FieldOperand(value, HeapNumber::kExponentOffset),
            Immediate(0x80000000));
-    __ j(not_equal, &if_false);
+    EmitFalseBranch(instr, not_equal);
     __ cmp(FieldOperand(value, HeapNumber::kMantissaOffset),
            Immediate(0x00000000));
     EmitBranch(instr, equal);
   }
-
-  __ bind(&if_false);
-  EmitFalseBranch(instr, no_condition);
 }
 
 
index 6c9cde3..514b42e 100644 (file)
@@ -320,6 +320,8 @@ class LCodeGen: public LCodeGenBase {
 
   static Condition TokenToCondition(Token::Value op, bool is_unsigned);
   void EmitGoto(int block);
+
+  // EmitBranch expects to be the last instruction of a block.
   template<class InstrType>
   void EmitBranch(InstrType instr, Condition cc);
   template<class InstrType>
index 986cf83..dc6ddf9 100644 (file)
@@ -2249,31 +2249,27 @@ void LCodeGen::DoCmpHoleAndBranch(LCmpHoleAndBranch* instr) {
 void LCodeGen::DoCompareMinusZeroAndBranch(LCompareMinusZeroAndBranch* instr) {
   Representation rep = instr->hydrogen()->value()->representation();
   ASSERT(!rep.IsInteger32());
-  Label if_false;
 
   if (rep.IsDouble()) {
     XMMRegister value = ToDoubleRegister(instr->value());
     XMMRegister xmm_scratch = double_scratch0();
     __ xorps(xmm_scratch, xmm_scratch);
     __ ucomisd(xmm_scratch, value);
-    __ j(not_equal, &if_false);
+    EmitFalseBranch(instr, not_equal);
     __ movmskpd(kScratchRegister, value);
     __ testl(kScratchRegister, Immediate(1));
     EmitBranch(instr, not_zero);
   } else {
     Register value = ToRegister(instr->value());
     Handle<Map> map = masm()->isolate()->factory()->heap_number_map();
-    __ CheckMap(value, map, &if_false, DO_SMI_CHECK);
+    __ CheckMap(value, map, instr->FalseLabel(chunk()), DO_SMI_CHECK);
     __ cmpl(FieldOperand(value, HeapNumber::kExponentOffset),
             Immediate(0x80000000));
-    __ j(not_equal, &if_false);
+    EmitFalseBranch(instr, not_equal);
     __ cmpl(FieldOperand(value, HeapNumber::kMantissaOffset),
             Immediate(0x00000000));
     EmitBranch(instr, equal);
   }
-
-  __ bind(&if_false);
-  EmitFalseBranch(instr, always);
 }
 
 
index 060cbe8..ac238d0 100644 (file)
@@ -270,6 +270,8 @@ class LCodeGen: public LCodeGenBase {
 
   static Condition TokenToCondition(Token::Value op, bool is_unsigned);
   void EmitGoto(int block);
+
+  // EmitBranch expects to be the last instruction of a block.
   template<class InstrType>
   void EmitBranch(InstrType instr, Condition cc);
   template<class InstrType>