| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 1724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1735 } else { | 1735 } else { |
| 1736 if (instr->can_deopt()) { | 1736 if (instr->can_deopt()) { |
| 1737 __ tst(left, Operand(0x80000000)); | 1737 __ tst(left, Operand(0x80000000)); |
| 1738 DeoptimizeIf(ne, instr->environment()); | 1738 DeoptimizeIf(ne, instr->environment()); |
| 1739 } | 1739 } |
| 1740 __ Move(result, left); | 1740 __ Move(result, left); |
| 1741 } | 1741 } |
| 1742 break; | 1742 break; |
| 1743 case Token::SHL: | 1743 case Token::SHL: |
| 1744 if (shift_count != 0) { | 1744 if (shift_count != 0) { |
| 1745 if (instr->hydrogen_value()->representation().IsSmi() && | 1745 __ mov(result, Operand(left, LSL, shift_count)); |
| 1746 instr->can_deopt()) { | |
| 1747 __ mov(result, Operand(left, LSL, shift_count - 1)); | |
| 1748 __ SmiTag(result, result, SetCC); | |
| 1749 DeoptimizeIf(vs, instr->environment()); | |
| 1750 } else { | |
| 1751 __ mov(result, Operand(left, LSL, shift_count)); | |
| 1752 } | |
| 1753 } else { | 1746 } else { |
| 1754 __ Move(result, left); | 1747 __ Move(result, left); |
| 1755 } | 1748 } |
| 1756 break; | 1749 break; |
| 1757 default: | 1750 default: |
| 1758 UNREACHABLE(); | 1751 UNREACHABLE(); |
| 1759 break; | 1752 break; |
| 1760 } | 1753 } |
| 1761 } | 1754 } |
| 1762 } | 1755 } |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1815 | 1808 |
| 1816 | 1809 |
| 1817 void LCodeGen::DoConstantD(LConstantD* instr) { | 1810 void LCodeGen::DoConstantD(LConstantD* instr) { |
| 1818 ASSERT(instr->result()->IsDoubleRegister()); | 1811 ASSERT(instr->result()->IsDoubleRegister()); |
| 1819 DwVfpRegister result = ToDoubleRegister(instr->result()); | 1812 DwVfpRegister result = ToDoubleRegister(instr->result()); |
| 1820 double v = instr->value(); | 1813 double v = instr->value(); |
| 1821 __ Vmov(result, v, scratch0()); | 1814 __ Vmov(result, v, scratch0()); |
| 1822 } | 1815 } |
| 1823 | 1816 |
| 1824 | 1817 |
| 1825 void LCodeGen::DoConstantE(LConstantE* instr) { | |
| 1826 __ mov(ToRegister(instr->result()), Operand(instr->value())); | |
| 1827 } | |
| 1828 | |
| 1829 | |
| 1830 void LCodeGen::DoConstantT(LConstantT* instr) { | 1818 void LCodeGen::DoConstantT(LConstantT* instr) { |
| 1831 Handle<Object> value = instr->value(); | 1819 Handle<Object> value = instr->value(); |
| 1832 AllowDeferredHandleDereference smi_check; | 1820 AllowDeferredHandleDereference smi_check; |
| 1833 __ LoadObject(ToRegister(instr->result()), value); | 1821 __ LoadObject(ToRegister(instr->result()), value); |
| 1834 } | 1822 } |
| 1835 | 1823 |
| 1836 | 1824 |
| 1837 void LCodeGen::DoMapEnumLength(LMapEnumLength* instr) { | 1825 void LCodeGen::DoMapEnumLength(LMapEnumLength* instr) { |
| 1838 Register result = ToRegister(instr->result()); | 1826 Register result = ToRegister(instr->result()); |
| 1839 Register map = ToRegister(instr->value()); | 1827 Register map = ToRegister(instr->value()); |
| (...skipping 1160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3000 } | 2988 } |
| 3001 | 2989 |
| 3002 __ bind(&skip_assignment); | 2990 __ bind(&skip_assignment); |
| 3003 } | 2991 } |
| 3004 | 2992 |
| 3005 | 2993 |
| 3006 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { | 2994 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { |
| 3007 HObjectAccess access = instr->hydrogen()->access(); | 2995 HObjectAccess access = instr->hydrogen()->access(); |
| 3008 int offset = access.offset(); | 2996 int offset = access.offset(); |
| 3009 Register object = ToRegister(instr->object()); | 2997 Register object = ToRegister(instr->object()); |
| 3010 | |
| 3011 if (access.IsExternalMemory()) { | |
| 3012 Register result = ToRegister(instr->result()); | |
| 3013 __ ldr(result, MemOperand(object, offset)); | |
| 3014 return; | |
| 3015 } | |
| 3016 | |
| 3017 if (instr->hydrogen()->representation().IsDouble()) { | 2998 if (instr->hydrogen()->representation().IsDouble()) { |
| 3018 DwVfpRegister result = ToDoubleRegister(instr->result()); | 2999 DwVfpRegister result = ToDoubleRegister(instr->result()); |
| 3019 __ vldr(result, FieldMemOperand(object, offset)); | 3000 __ vldr(result, FieldMemOperand(object, offset)); |
| 3020 return; | 3001 return; |
| 3021 } | 3002 } |
| 3022 | 3003 |
| 3023 Register result = ToRegister(instr->result()); | 3004 Register result = ToRegister(instr->result()); |
| 3024 if (access.IsInobject()) { | 3005 if (access.IsInobject()) { |
| 3025 __ ldr(result, FieldMemOperand(object, offset)); | 3006 __ ldr(result, FieldMemOperand(object, offset)); |
| 3026 } else { | 3007 } else { |
| (...skipping 1159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4186 Register base = ToRegister(instr->base_object()); | 4167 Register base = ToRegister(instr->base_object()); |
| 4187 __ add(result, base, Operand(instr->offset())); | 4168 __ add(result, base, Operand(instr->offset())); |
| 4188 } | 4169 } |
| 4189 | 4170 |
| 4190 | 4171 |
| 4191 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) { | 4172 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) { |
| 4192 Representation representation = instr->representation(); | 4173 Representation representation = instr->representation(); |
| 4193 | 4174 |
| 4194 Register object = ToRegister(instr->object()); | 4175 Register object = ToRegister(instr->object()); |
| 4195 Register scratch = scratch0(); | 4176 Register scratch = scratch0(); |
| 4177 |
| 4196 HObjectAccess access = instr->hydrogen()->access(); | 4178 HObjectAccess access = instr->hydrogen()->access(); |
| 4197 int offset = access.offset(); | 4179 int offset = access.offset(); |
| 4198 | 4180 |
| 4199 if (access.IsExternalMemory()) { | |
| 4200 Register value = ToRegister(instr->value()); | |
| 4201 __ str(value, MemOperand(object, offset)); | |
| 4202 return; | |
| 4203 } | |
| 4204 | |
| 4205 Handle<Map> transition = instr->transition(); | 4181 Handle<Map> transition = instr->transition(); |
| 4206 | 4182 |
| 4207 if (FLAG_track_heap_object_fields && representation.IsHeapObject()) { | 4183 if (FLAG_track_heap_object_fields && representation.IsHeapObject()) { |
| 4208 Register value = ToRegister(instr->value()); | 4184 Register value = ToRegister(instr->value()); |
| 4209 if (!instr->hydrogen()->value()->type().IsHeapObject()) { | 4185 if (!instr->hydrogen()->value()->type().IsHeapObject()) { |
| 4210 __ SmiTst(value); | 4186 __ SmiTst(value); |
| 4211 DeoptimizeIf(eq, instr->environment()); | 4187 DeoptimizeIf(eq, instr->environment()); |
| 4212 } | 4188 } |
| 4213 } else if (FLAG_track_double_fields && representation.IsDouble()) { | 4189 } else if (FLAG_track_double_fields && representation.IsDouble()) { |
| 4214 ASSERT(transition.is_null()); | 4190 ASSERT(transition.is_null()); |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4517 __ cmp(scratch, Operand(from_map)); | 4493 __ cmp(scratch, Operand(from_map)); |
| 4518 __ b(ne, ¬_applicable); | 4494 __ b(ne, ¬_applicable); |
| 4519 | 4495 |
| 4520 if (IsSimpleMapChangeTransition(from_kind, to_kind)) { | 4496 if (IsSimpleMapChangeTransition(from_kind, to_kind)) { |
| 4521 Register new_map_reg = ToRegister(instr->new_map_temp()); | 4497 Register new_map_reg = ToRegister(instr->new_map_temp()); |
| 4522 __ mov(new_map_reg, Operand(to_map)); | 4498 __ mov(new_map_reg, Operand(to_map)); |
| 4523 __ str(new_map_reg, FieldMemOperand(object_reg, HeapObject::kMapOffset)); | 4499 __ str(new_map_reg, FieldMemOperand(object_reg, HeapObject::kMapOffset)); |
| 4524 // Write barrier. | 4500 // Write barrier. |
| 4525 __ RecordWriteField(object_reg, HeapObject::kMapOffset, new_map_reg, | 4501 __ RecordWriteField(object_reg, HeapObject::kMapOffset, new_map_reg, |
| 4526 scratch, GetLinkRegisterState(), kDontSaveFPRegs); | 4502 scratch, GetLinkRegisterState(), kDontSaveFPRegs); |
| 4527 } else { | 4503 } else if (FLAG_compiled_transitions) { |
| 4528 PushSafepointRegistersScope scope(this, Safepoint::kWithRegisters); | 4504 PushSafepointRegistersScope scope(this, Safepoint::kWithRegisters); |
| 4529 __ Move(r0, object_reg); | 4505 __ Move(r0, object_reg); |
| 4530 __ Move(r1, to_map); | 4506 __ Move(r1, to_map); |
| 4531 TransitionElementsKindStub stub(from_kind, to_kind); | 4507 TransitionElementsKindStub stub(from_kind, to_kind); |
| 4532 __ CallStub(&stub); | 4508 __ CallStub(&stub); |
| 4533 RecordSafepointWithRegisters( | 4509 RecordSafepointWithRegisters( |
| 4534 instr->pointer_map(), 0, Safepoint::kNoLazyDeopt); | 4510 instr->pointer_map(), 0, Safepoint::kNoLazyDeopt); |
| 4511 } else if (IsFastSmiElementsKind(from_kind) && |
| 4512 IsFastDoubleElementsKind(to_kind)) { |
| 4513 Register fixed_object_reg = ToRegister(instr->temp()); |
| 4514 ASSERT(fixed_object_reg.is(r2)); |
| 4515 Register new_map_reg = ToRegister(instr->new_map_temp()); |
| 4516 ASSERT(new_map_reg.is(r3)); |
| 4517 __ mov(new_map_reg, Operand(to_map)); |
| 4518 __ mov(fixed_object_reg, object_reg); |
| 4519 CallCode(isolate()->builtins()->TransitionElementsSmiToDouble(), |
| 4520 RelocInfo::CODE_TARGET, instr); |
| 4521 } else if (IsFastDoubleElementsKind(from_kind) && |
| 4522 IsFastObjectElementsKind(to_kind)) { |
| 4523 Register fixed_object_reg = ToRegister(instr->temp()); |
| 4524 ASSERT(fixed_object_reg.is(r2)); |
| 4525 Register new_map_reg = ToRegister(instr->new_map_temp()); |
| 4526 ASSERT(new_map_reg.is(r3)); |
| 4527 __ mov(new_map_reg, Operand(to_map)); |
| 4528 __ mov(fixed_object_reg, object_reg); |
| 4529 CallCode(isolate()->builtins()->TransitionElementsDoubleToObject(), |
| 4530 RelocInfo::CODE_TARGET, instr); |
| 4531 } else { |
| 4532 UNREACHABLE(); |
| 4535 } | 4533 } |
| 4536 __ bind(¬_applicable); | 4534 __ bind(¬_applicable); |
| 4537 } | 4535 } |
| 4538 | 4536 |
| 4539 | 4537 |
| 4540 void LCodeGen::DoTrapAllocationMemento(LTrapAllocationMemento* instr) { | 4538 void LCodeGen::DoTrapAllocationMemento(LTrapAllocationMemento* instr) { |
| 4541 Register object = ToRegister(instr->object()); | 4539 Register object = ToRegister(instr->object()); |
| 4542 Register temp = ToRegister(instr->temp()); | 4540 Register temp = ToRegister(instr->temp()); |
| 4543 __ TestJSArrayForAllocationMemento(object, temp); | 4541 __ TestJSArrayForAllocationMemento(object, temp); |
| 4544 DeoptimizeIf(eq, instr->environment()); | 4542 DeoptimizeIf(eq, instr->environment()); |
| (...skipping 1291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5836 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); | 5834 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); |
| 5837 __ ldr(result, FieldMemOperand(scratch, | 5835 __ ldr(result, FieldMemOperand(scratch, |
| 5838 FixedArray::kHeaderSize - kPointerSize)); | 5836 FixedArray::kHeaderSize - kPointerSize)); |
| 5839 __ bind(&done); | 5837 __ bind(&done); |
| 5840 } | 5838 } |
| 5841 | 5839 |
| 5842 | 5840 |
| 5843 #undef __ | 5841 #undef __ |
| 5844 | 5842 |
| 5845 } } // namespace v8::internal | 5843 } } // namespace v8::internal |
| OLD | NEW |