Revision: 17671
Author: [email protected]
Date: Tue Nov 12 19:05:38 2013 UTC
Log: MIPS: Introduce %_IsMinusZero.
Port r17639 (45b8a52)
BUG=
[email protected]
Review URL: https://codereview.chromium.org/61203006
Patch from Balazs Kilvady <[email protected]>.
http://code.google.com/p/v8/source/detail?r=17671
Modified:
/branches/bleeding_edge/src/mips/full-codegen-mips.cc
/branches/bleeding_edge/src/mips/lithium-codegen-mips.cc
/branches/bleeding_edge/src/mips/lithium-mips.cc
/branches/bleeding_edge/src/mips/lithium-mips.h
=======================================
--- /branches/bleeding_edge/src/mips/full-codegen-mips.cc Tue Nov 12
16:24:13 2013 UTC
+++ /branches/bleeding_edge/src/mips/full-codegen-mips.cc Tue Nov 12
19:05:38 2013 UTC
@@ -3131,6 +3131,36 @@
context()->Plug(if_true, if_false);
}
+
+
+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) {
=======================================
--- /branches/bleeding_edge/src/mips/lithium-codegen-mips.cc Tue Nov 12
16:24:13 2013 UTC
+++ /branches/bleeding_edge/src/mips/lithium-codegen-mips.cc Tue Nov 12
19:05:38 2013 UTC
@@ -2309,6 +2309,33 @@
__ FmoveHigh(scratch, input_reg);
EmitBranch(instr, eq, scratch, Operand(kHoleNanUpper32));
}
+
+
+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,
=======================================
--- /branches/bleeding_edge/src/mips/lithium-mips.cc Tue Nov 12 16:24:13
2013 UTC
+++ /branches/bleeding_edge/src/mips/lithium-mips.cc Tue Nov 12 19:05:38
2013 UTC
@@ -1701,6 +1701,16 @@
LOperand* value = UseRegisterAtStart(instr->value());
return new(zone()) LCmpHoleAndBranch(value);
}
+
+
+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) {
=======================================
--- /branches/bleeding_edge/src/mips/lithium-mips.h Fri Nov 8 14:16:34
2013 UTC
+++ /branches/bleeding_edge/src/mips/lithium-mips.h Tue Nov 12 19:05:38
2013 UTC
@@ -72,6 +72,7 @@
V(ClampIToUint8) \
V(ClampTToUint8) \
V(ClassOfTestAndBranch) \
+ V(CompareMinusZeroAndBranch) \
V(CompareNumericAndBranch) \
V(CmpObjectEqAndBranch) \
V(CmpHoleAndBranch) \
@@ -923,6 +924,22 @@
};
+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.