ARM: Support DoCheckInstanceType in lithium codegenerator.

BUG=
TEST=

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6209 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 8945e02d
......@@ -1762,8 +1762,7 @@ LInstruction* LChunkBuilder::DoCheckNonSmi(HCheckNonSmi* instr) {
LInstruction* LChunkBuilder::DoCheckInstanceType(HCheckInstanceType* instr) {
LOperand* value = UseRegisterAtStart(instr->value());
LOperand* temp = TempRegister();
LInstruction* result = new LCheckInstanceType(value, temp);
LInstruction* result = new LCheckInstanceType(value);
return AssignEnvironment(result);
}
......
......@@ -1653,8 +1653,7 @@ class LCheckFunction: public LUnaryOperation {
class LCheckInstanceType: public LUnaryOperation {
public:
LCheckInstanceType(LOperand* use, LOperand* temp)
: LUnaryOperation(use), temp_(temp) { }
LCheckInstanceType(LOperand* use) : LUnaryOperation(use) { }
DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType, "check-instance-type")
DECLARE_HYDROGEN_ACCESSOR(CheckInstanceType)
......
......@@ -2156,7 +2156,26 @@ void LCodeGen::DoCheckSmi(LCheckSmi* instr) {
void LCodeGen::DoCheckInstanceType(LCheckInstanceType* instr) {
Abort("DoCheckInstanceType unimplemented.");
Register input = ToRegister(instr->input());
Register scratch = scratch0();
InstanceType first = instr->hydrogen()->first();
InstanceType last = instr->hydrogen()->last();
__ ldr(scratch, FieldMemOperand(input, HeapObject::kMapOffset));
__ ldrb(scratch, FieldMemOperand(scratch, Map::kInstanceTypeOffset));
__ cmp(scratch, Operand(first));
// If there is only one type in the interval check for equality.
if (first == last) {
DeoptimizeIf(ne, instr->environment());
} else {
DeoptimizeIf(lo, instr->environment());
// Omit check for the last type.
if (last != LAST_TYPE) {
__ cmp(scratch, Operand(last));
DeoptimizeIf(hi, instr->environment());
}
}
}
......
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