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
This commit is contained in:
karlklose@chromium.org 2011-01-06 15:25:03 +00:00
parent 8945e02d86
commit d4bbad8e4e
3 changed files with 22 additions and 5 deletions

View File

@ -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);
}

View File

@ -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)

View File

@ -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());
}
}
}