Commit e23ac61f authored by plind44@gmail.com's avatar plind44@gmail.com

MIPS: Introduce %_IsMinusZero.

Port r17639 (45b8a52)

BUG=
R=plind44@gmail.com

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

Patch from Balazs Kilvady <kilvadyb@homejinni.com>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17671 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 108538f1
...@@ -3133,6 +3133,36 @@ void FullCodeGenerator::EmitIsFunction(CallRuntime* expr) { ...@@ -3133,6 +3133,36 @@ void FullCodeGenerator::EmitIsFunction(CallRuntime* expr) {
} }
void FullCodeGenerator::EmitIsMinusZero(CallRuntime* expr) {
ZoneList<Expression*>* args = expr->arguments();
ASSERT(args->length() == 1);
VisitForAccumulatorValue(args->at(0));
Label materialize_true, materialize_false;
Label* if_true = NULL;
Label* if_false = NULL;
Label* fall_through = NULL;
context()->PrepareTest(&materialize_true, &materialize_false,
&if_true, &if_false, &fall_through);
__ CheckMap(v0, a1, Heap::kHeapNumberMapRootIndex, if_false, DO_SMI_CHECK);
__ lw(a2, FieldMemOperand(v0, HeapNumber::kExponentOffset));
__ lw(a1, FieldMemOperand(v0, HeapNumber::kMantissaOffset));
__ li(t0, 0x80000000);
Label not_nan;
__ Branch(&not_nan, ne, a2, Operand(t0));
__ mov(t0, zero_reg);
__ mov(a2, a1);
__ bind(&not_nan);
PrepareForBailoutBeforeSplit(expr, true, if_true, if_false);
Split(eq, a2, Operand(t0), if_true, if_false, fall_through);
context()->Plug(if_true, if_false);
}
void FullCodeGenerator::EmitIsArray(CallRuntime* expr) { void FullCodeGenerator::EmitIsArray(CallRuntime* expr) {
ZoneList<Expression*>* args = expr->arguments(); ZoneList<Expression*>* args = expr->arguments();
ASSERT(args->length() == 1); ASSERT(args->length() == 1);
......
...@@ -2311,6 +2311,33 @@ void LCodeGen::DoCmpHoleAndBranch(LCmpHoleAndBranch* instr) { ...@@ -2311,6 +2311,33 @@ 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()) {
DoubleRegister value = ToDoubleRegister(instr->value());
__ BranchF(&if_false, NULL, ne, value, kDoubleRegZero);
__ FmoveHigh(scratch, value);
__ li(at, 0x80000000);
} else {
Register value = ToRegister(instr->value());
__ CheckMap(
value, scratch, Heap::kHeapNumberMapRootIndex, &if_false, DO_SMI_CHECK);
__ lw(scratch, FieldMemOperand(value, HeapNumber::kExponentOffset));
__ Branch(&if_false, ne, scratch, Operand(0x80000000));
__ lw(scratch, FieldMemOperand(value, HeapNumber::kMantissaOffset));
__ mov(at, zero_reg);
}
EmitBranch(instr, eq, scratch, Operand(at));
__ bind(&if_false);
EmitFalseBranchF(instr, al, kDoubleRegZero, kDoubleRegZero);
}
Condition LCodeGen::EmitIsObject(Register input, Condition LCodeGen::EmitIsObject(Register input,
Register temp1, Register temp1,
Register temp2, Register temp2,
......
...@@ -1703,6 +1703,16 @@ LInstruction* LChunkBuilder::DoCompareHoleAndBranch( ...@@ -1703,6 +1703,16 @@ LInstruction* LChunkBuilder::DoCompareHoleAndBranch(
} }
LInstruction* LChunkBuilder::DoCompareMinusZeroAndBranch(
HCompareMinusZeroAndBranch* instr) {
LInstruction* goto_instr = CheckElideControlInstruction(instr);
if (goto_instr != NULL) return goto_instr;
LOperand* value = UseRegister(instr->value());
LOperand* scratch = TempRegister();
return new(zone()) LCompareMinusZeroAndBranch(value, scratch);
}
LInstruction* LChunkBuilder::DoIsObjectAndBranch(HIsObjectAndBranch* instr) { LInstruction* LChunkBuilder::DoIsObjectAndBranch(HIsObjectAndBranch* instr) {
ASSERT(instr->value()->representation().IsTagged()); ASSERT(instr->value()->representation().IsTagged());
LOperand* temp = TempRegister(); LOperand* temp = TempRegister();
......
...@@ -72,6 +72,7 @@ class LCodeGen; ...@@ -72,6 +72,7 @@ class LCodeGen;
V(ClampIToUint8) \ V(ClampIToUint8) \
V(ClampTToUint8) \ V(ClampTToUint8) \
V(ClassOfTestAndBranch) \ V(ClassOfTestAndBranch) \
V(CompareMinusZeroAndBranch) \
V(CompareNumericAndBranch) \ V(CompareNumericAndBranch) \
V(CmpObjectEqAndBranch) \ V(CmpObjectEqAndBranch) \
V(CmpHoleAndBranch) \ V(CmpHoleAndBranch) \
...@@ -923,6 +924,22 @@ class LCmpHoleAndBranch V8_FINAL : public LControlInstruction<1, 0> { ...@@ -923,6 +924,22 @@ class LCmpHoleAndBranch V8_FINAL : public LControlInstruction<1, 0> {
}; };
class LCompareMinusZeroAndBranch V8_FINAL : public LControlInstruction<1, 1> {
public:
LCompareMinusZeroAndBranch(LOperand* value, LOperand* temp) {
inputs_[0] = value;
temps_[0] = temp;
}
LOperand* value() { return inputs_[0]; }
LOperand* temp() { return temps_[0]; }
DECLARE_CONCRETE_INSTRUCTION(CompareMinusZeroAndBranch,
"cmp-minus-zero-and-branch")
DECLARE_HYDROGEN_ACCESSOR(CompareMinusZeroAndBranch)
};
class LIsObjectAndBranch V8_FINAL : public LControlInstruction<1, 1> { class LIsObjectAndBranch V8_FINAL : public LControlInstruction<1, 1> {
public: public:
LIsObjectAndBranch(LOperand* value, LOperand* temp) { LIsObjectAndBranch(LOperand* value, LOperand* temp) {
......
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