Commit 108538f1 authored by yangguo@chromium.org's avatar yangguo@chromium.org

Fix usage of EmitBranch in compare-minus-zero-and-branch.

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
parent cbdd8963
...@@ -2475,28 +2475,27 @@ void LCodeGen::DoCmpHoleAndBranch(LCmpHoleAndBranch* instr) { ...@@ -2475,28 +2475,27 @@ void LCodeGen::DoCmpHoleAndBranch(LCmpHoleAndBranch* instr) {
void LCodeGen::DoCompareMinusZeroAndBranch(LCompareMinusZeroAndBranch* instr) { void LCodeGen::DoCompareMinusZeroAndBranch(LCompareMinusZeroAndBranch* instr) {
Representation rep = instr->hydrogen()->value()->representation(); Representation rep = instr->hydrogen()->value()->representation();
ASSERT(!rep.IsInteger32()); ASSERT(!rep.IsInteger32());
Label if_false;
Register scratch = ToRegister(instr->temp()); Register scratch = ToRegister(instr->temp());
if (rep.IsDouble()) { if (rep.IsDouble()) {
DwVfpRegister value = ToDoubleRegister(instr->value()); DwVfpRegister value = ToDoubleRegister(instr->value());
__ VFPCompareAndSetFlags(value, 0.0); __ VFPCompareAndSetFlags(value, 0.0);
__ b(ne, &if_false); EmitFalseBranch(instr, ne);
__ VmovHigh(scratch, value); __ VmovHigh(scratch, value);
__ cmp(scratch, Operand(0x80000000)); __ cmp(scratch, Operand(0x80000000));
} else { } else {
Register value = ToRegister(instr->value()); Register value = ToRegister(instr->value());
__ CheckMap( __ CheckMap(value,
value, scratch, Heap::kHeapNumberMapRootIndex, &if_false, DO_SMI_CHECK); scratch,
Heap::kHeapNumberMapRootIndex,
instr->FalseLabel(chunk()),
DO_SMI_CHECK);
__ ldr(scratch, FieldMemOperand(value, HeapNumber::kExponentOffset)); __ ldr(scratch, FieldMemOperand(value, HeapNumber::kExponentOffset));
__ ldr(ip, FieldMemOperand(value, HeapNumber::kMantissaOffset)); __ ldr(ip, FieldMemOperand(value, HeapNumber::kMantissaOffset));
__ cmp(scratch, Operand(0x80000000)); __ cmp(scratch, Operand(0x80000000));
__ cmp(ip, Operand(0x00000000), eq); __ cmp(ip, Operand(0x00000000), eq);
} }
EmitBranch(instr, eq); EmitBranch(instr, eq);
__ bind(&if_false);
EmitFalseBranch(instr, al);
} }
......
...@@ -297,6 +297,8 @@ class LCodeGen: public LCodeGenBase { ...@@ -297,6 +297,8 @@ class LCodeGen: public LCodeGenBase {
static Condition TokenToCondition(Token::Value op, bool is_unsigned); static Condition TokenToCondition(Token::Value op, bool is_unsigned);
void EmitGoto(int block); void EmitGoto(int block);
// EmitBranch expects to be the last instruction of a block.
template<class InstrType> template<class InstrType>
void EmitBranch(InstrType instr, Condition condition); void EmitBranch(InstrType instr, Condition condition);
template<class InstrType> template<class InstrType>
......
...@@ -2673,7 +2673,6 @@ void LCodeGen::DoCmpHoleAndBranch(LCmpHoleAndBranch* instr) { ...@@ -2673,7 +2673,6 @@ void LCodeGen::DoCmpHoleAndBranch(LCmpHoleAndBranch* instr) {
void LCodeGen::DoCompareMinusZeroAndBranch(LCompareMinusZeroAndBranch* instr) { void LCodeGen::DoCompareMinusZeroAndBranch(LCompareMinusZeroAndBranch* instr) {
Representation rep = instr->hydrogen()->value()->representation(); Representation rep = instr->hydrogen()->value()->representation();
ASSERT(!rep.IsInteger32()); ASSERT(!rep.IsInteger32());
Label if_false;
Register scratch = ToRegister(instr->temp()); Register scratch = ToRegister(instr->temp());
if (rep.IsDouble()) { if (rep.IsDouble()) {
...@@ -2682,24 +2681,21 @@ void LCodeGen::DoCompareMinusZeroAndBranch(LCompareMinusZeroAndBranch* instr) { ...@@ -2682,24 +2681,21 @@ void LCodeGen::DoCompareMinusZeroAndBranch(LCompareMinusZeroAndBranch* instr) {
XMMRegister xmm_scratch = double_scratch0(); XMMRegister xmm_scratch = double_scratch0();
__ xorps(xmm_scratch, xmm_scratch); __ xorps(xmm_scratch, xmm_scratch);
__ ucomisd(xmm_scratch, value); __ ucomisd(xmm_scratch, value);
__ j(not_equal, &if_false); EmitFalseBranch(instr, not_equal);
__ movmskpd(scratch, value); __ movmskpd(scratch, value);
__ test(scratch, Immediate(1)); __ test(scratch, Immediate(1));
EmitBranch(instr, not_zero); EmitBranch(instr, not_zero);
} else { } else {
Register value = ToRegister(instr->value()); Register value = ToRegister(instr->value());
Handle<Map> map = masm()->isolate()->factory()->heap_number_map(); 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), __ cmp(FieldOperand(value, HeapNumber::kExponentOffset),
Immediate(0x80000000)); Immediate(0x80000000));
__ j(not_equal, &if_false); EmitFalseBranch(instr, not_equal);
__ cmp(FieldOperand(value, HeapNumber::kMantissaOffset), __ cmp(FieldOperand(value, HeapNumber::kMantissaOffset),
Immediate(0x00000000)); Immediate(0x00000000));
EmitBranch(instr, equal); EmitBranch(instr, equal);
} }
__ bind(&if_false);
EmitFalseBranch(instr, no_condition);
} }
......
...@@ -320,6 +320,8 @@ class LCodeGen: public LCodeGenBase { ...@@ -320,6 +320,8 @@ class LCodeGen: public LCodeGenBase {
static Condition TokenToCondition(Token::Value op, bool is_unsigned); static Condition TokenToCondition(Token::Value op, bool is_unsigned);
void EmitGoto(int block); void EmitGoto(int block);
// EmitBranch expects to be the last instruction of a block.
template<class InstrType> template<class InstrType>
void EmitBranch(InstrType instr, Condition cc); void EmitBranch(InstrType instr, Condition cc);
template<class InstrType> template<class InstrType>
......
...@@ -2249,31 +2249,27 @@ void LCodeGen::DoCmpHoleAndBranch(LCmpHoleAndBranch* instr) { ...@@ -2249,31 +2249,27 @@ void LCodeGen::DoCmpHoleAndBranch(LCmpHoleAndBranch* instr) {
void LCodeGen::DoCompareMinusZeroAndBranch(LCompareMinusZeroAndBranch* instr) { void LCodeGen::DoCompareMinusZeroAndBranch(LCompareMinusZeroAndBranch* instr) {
Representation rep = instr->hydrogen()->value()->representation(); Representation rep = instr->hydrogen()->value()->representation();
ASSERT(!rep.IsInteger32()); ASSERT(!rep.IsInteger32());
Label if_false;
if (rep.IsDouble()) { if (rep.IsDouble()) {
XMMRegister value = ToDoubleRegister(instr->value()); XMMRegister value = ToDoubleRegister(instr->value());
XMMRegister xmm_scratch = double_scratch0(); XMMRegister xmm_scratch = double_scratch0();
__ xorps(xmm_scratch, xmm_scratch); __ xorps(xmm_scratch, xmm_scratch);
__ ucomisd(xmm_scratch, value); __ ucomisd(xmm_scratch, value);
__ j(not_equal, &if_false); EmitFalseBranch(instr, not_equal);
__ movmskpd(kScratchRegister, value); __ movmskpd(kScratchRegister, value);
__ testl(kScratchRegister, Immediate(1)); __ testl(kScratchRegister, Immediate(1));
EmitBranch(instr, not_zero); EmitBranch(instr, not_zero);
} else { } else {
Register value = ToRegister(instr->value()); Register value = ToRegister(instr->value());
Handle<Map> map = masm()->isolate()->factory()->heap_number_map(); 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), __ cmpl(FieldOperand(value, HeapNumber::kExponentOffset),
Immediate(0x80000000)); Immediate(0x80000000));
__ j(not_equal, &if_false); EmitFalseBranch(instr, not_equal);
__ cmpl(FieldOperand(value, HeapNumber::kMantissaOffset), __ cmpl(FieldOperand(value, HeapNumber::kMantissaOffset),
Immediate(0x00000000)); Immediate(0x00000000));
EmitBranch(instr, equal); EmitBranch(instr, equal);
} }
__ bind(&if_false);
EmitFalseBranch(instr, always);
} }
......
...@@ -270,6 +270,8 @@ class LCodeGen: public LCodeGenBase { ...@@ -270,6 +270,8 @@ class LCodeGen: public LCodeGenBase {
static Condition TokenToCondition(Token::Value op, bool is_unsigned); static Condition TokenToCondition(Token::Value op, bool is_unsigned);
void EmitGoto(int block); void EmitGoto(int block);
// EmitBranch expects to be the last instruction of a block.
template<class InstrType> template<class InstrType>
void EmitBranch(InstrType instr, Condition cc); void EmitBranch(InstrType instr, Condition cc);
template<class InstrType> template<class InstrType>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment