Index: src/arm/lithium-codegen-arm.cc |
=================================================================== |
--- src/arm/lithium-codegen-arm.cc (revision 11540) |
+++ src/arm/lithium-codegen-arm.cc (working copy) |
@@ -2587,49 +2587,38 @@ |
Register object = ToRegister(instr->object()); |
Register result = ToRegister(instr->result()); |
Register scratch = scratch0(); |
+ |
int map_count = instr->hydrogen()->types()->length(); |
+ bool need_generic = instr->hydrogen()->need_generic(); |
+ |
+ if (map_count == 0 && !need_generic) { |
+ DeoptimizeIf(al, instr->environment()); |
+ return; |
+ } |
Handle<String> name = instr->hydrogen()->name(); |
- if (map_count == 0 && instr->hydrogen()->need_generic()) { |
- __ mov(r2, Operand(name)); |
- Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); |
- CallCode(ic, RelocInfo::CODE_TARGET, instr); |
- } else { |
- Label done; |
- __ ldr(scratch, FieldMemOperand(object, HeapObject::kMapOffset)); |
- for (int i = 0; i < map_count - 1; ++i) { |
- Handle<Map> map = instr->hydrogen()->types()->at(i); |
+ Label done; |
+ __ ldr(scratch, FieldMemOperand(object, HeapObject::kMapOffset)); |
+ for (int i = 0; i < map_count; ++i) { |
+ bool last = (i == map_count - 1); |
+ Handle<Map> map = instr->hydrogen()->types()->at(i); |
+ __ cmp(scratch, Operand(map)); |
+ if (last && !need_generic) { |
+ DeoptimizeIf(ne, instr->environment()); |
+ EmitLoadFieldOrConstantFunction(result, object, map, name); |
+ } else { |
Label next; |
- __ cmp(scratch, Operand(map)); |
__ b(ne, &next); |
EmitLoadFieldOrConstantFunction(result, object, map, name); |
__ b(&done); |
__ bind(&next); |
} |
- if (instr->hydrogen()->need_generic()) { |
- if (map_count != 0) { |
- Handle<Map> map = instr->hydrogen()->types()->last(); |
- __ cmp(scratch, Operand(map)); |
- Label generic; |
- __ b(ne, &generic); |
- EmitLoadFieldOrConstantFunction(result, object, map, name); |
- __ b(&done); |
- __ bind(&generic); |
- } |
- __ mov(r2, Operand(name)); |
- Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); |
- CallCode(ic, RelocInfo::CODE_TARGET, instr); |
- } else { |
- if (map_count != 0) { |
- Handle<Map> map = instr->hydrogen()->types()->last(); |
- __ cmp(scratch, Operand(map)); |
- DeoptimizeIf(ne, instr->environment()); |
- EmitLoadFieldOrConstantFunction(result, object, map, name); |
- } else { |
- DeoptimizeIf(al, instr->environment()); |
- } |
- } |
- __ bind(&done); |
} |
+ if (need_generic) { |
+ __ mov(r2, Operand(name)); |
+ Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); |
+ CallCode(ic, RelocInfo::CODE_TARGET, instr); |
+ } |
+ __ bind(&done); |
} |