Reviewers: danno, Yang, Paul Lind, kisg, Jakob, palfia,
Description:
MIPS: Introduce %_IsMinusZero.
Port r17639 (45b8a52)
BUG=
Please review this at https://codereview.chromium.org/61203006/
SVN Base: https://github.com/v8/v8.git@gbl
Affected files (+84, -0 lines):
M src/mips/full-codegen-mips.cc
M src/mips/lithium-codegen-mips.cc
M src/mips/lithium-mips.h
M src/mips/lithium-mips.cc
Index: src/mips/full-codegen-mips.cc
diff --git a/src/mips/full-codegen-mips.cc b/src/mips/full-codegen-mips.cc
index
56c9240dc5f57daa22cf7290d62fe507505f8cdb..8c7a4c314279a751d431e95c880564003351f3dd
100644
--- a/src/mips/full-codegen-mips.cc
+++ b/src/mips/full-codegen-mips.cc
@@ -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(¬_nan, ne, a2, Operand(t0));
+ __ mov(t0, zero_reg);
+ __ mov(a2, a1);
+ __ bind(¬_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) {
ZoneList<Expression*>* args = expr->arguments();
ASSERT(args->length() == 1);
Index: src/mips/lithium-codegen-mips.cc
diff --git a/src/mips/lithium-codegen-mips.cc
b/src/mips/lithium-codegen-mips.cc
index
b1cf42cb31cde5b59c69a767aa87678228380535..a3bcdf608a3154c210767c017b7d47a5f075cc0e
100644
--- a/src/mips/lithium-codegen-mips.cc
+++ b/src/mips/lithium-codegen-mips.cc
@@ -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,
Register temp1,
Register temp2,
Index: src/mips/lithium-mips.cc
diff --git a/src/mips/lithium-mips.cc b/src/mips/lithium-mips.cc
index
943d9476f43daca9a890f16371662c5be897a591..70dd60d6560cdb6a6938ff709130a72c0c00c101
100644
--- a/src/mips/lithium-mips.cc
+++ b/src/mips/lithium-mips.cc
@@ -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) {
ASSERT(instr->value()->representation().IsTagged());
LOperand* temp = TempRegister();
Index: src/mips/lithium-mips.h
diff --git a/src/mips/lithium-mips.h b/src/mips/lithium-mips.h
index
5678bb7505fa51f39d3209d2aec8cc3a78c844c2..8c82a9d7cbbcaaadfacb0ccd45a56784dd080d33
100644
--- a/src/mips/lithium-mips.h
+++ b/src/mips/lithium-mips.h
@@ -72,6 +72,7 @@ class LCodeGen;
V(ClampIToUint8) \
V(ClampTToUint8) \
V(ClassOfTestAndBranch) \
+ V(CompareMinusZeroAndBranch) \
V(CompareNumericAndBranch) \
V(CmpObjectEqAndBranch) \
V(CmpHoleAndBranch) \
@@ -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> {
public:
LIsObjectAndBranch(LOperand* value, LOperand* temp) {
--
--
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.