Commit 56073b73 authored by ager@chromium.org's avatar ager@chromium.org

ARM: Implement HasInstanceType in lithium backend.

Review URL: http://codereview.chromium.org/6283006

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6398 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent fb43b16e
......@@ -1756,8 +1756,40 @@ Condition LHasInstanceType::BranchCondition() {
}
static InstanceType TestType(HHasInstanceType* instr) {
InstanceType from = instr->from();
InstanceType to = instr->to();
if (from == FIRST_TYPE) return to;
ASSERT(from == to || to == LAST_TYPE);
return from;
}
static Condition BranchCondition(HHasInstanceType* instr) {
InstanceType from = instr->from();
InstanceType to = instr->to();
if (from == to) return eq;
if (to == LAST_TYPE) return hs;
if (from == FIRST_TYPE) return ls;
UNREACHABLE();
return eq;
}
void LCodeGen::DoHasInstanceType(LHasInstanceType* instr) {
Abort("DoHasInstanceType unimplemented.");
Register input = ToRegister(instr->input());
Register result = ToRegister(instr->result());
ASSERT(instr->hydrogen()->value()->representation().IsTagged());
Label done;
__ tst(input, Operand(kSmiTagMask));
__ LoadRoot(result, Heap::kFalseValueRootIndex, eq);
__ b(eq, &done);
__ CompareObjectType(input, result, result, TestType(instr->hydrogen()));
Condition cond = BranchCondition(instr->hydrogen());
__ LoadRoot(result, Heap::kTrueValueRootIndex, cond);
__ LoadRoot(result, Heap::kFalseValueRootIndex, NegateCondition(cond));
__ bind(&done);
}
......
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