| 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 2804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2815 instr, | 2815 instr, |
| 2816 RECORD_SAFEPOINT_WITH_REGISTERS_AND_NO_ARGUMENTS); | 2816 RECORD_SAFEPOINT_WITH_REGISTERS_AND_NO_ARGUMENTS); |
| 2817 LEnvironment* env = instr->GetDeferredLazyDeoptimizationEnvironment(); | 2817 LEnvironment* env = instr->GetDeferredLazyDeoptimizationEnvironment(); |
| 2818 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); | 2818 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); |
| 2819 // Put the result value into the result register slot and | 2819 // Put the result value into the result register slot and |
| 2820 // restore all registers. | 2820 // restore all registers. |
| 2821 __ StoreToSafepointRegisterSlot(result, result); | 2821 __ StoreToSafepointRegisterSlot(result, result); |
| 2822 } | 2822 } |
| 2823 | 2823 |
| 2824 | 2824 |
| 2825 void LCodeGen::DoInstanceSize(LInstanceSize* instr) { |
| 2826 Register object = ToRegister(instr->object()); |
| 2827 Register result = ToRegister(instr->result()); |
| 2828 __ ldr(result, FieldMemOperand(object, HeapObject::kMapOffset)); |
| 2829 __ ldrb(result, FieldMemOperand(result, Map::kInstanceSizeOffset)); |
| 2830 } |
| 2831 |
| 2832 |
| 2825 void LCodeGen::DoCmpT(LCmpT* instr) { | 2833 void LCodeGen::DoCmpT(LCmpT* instr) { |
| 2826 Token::Value op = instr->op(); | 2834 Token::Value op = instr->op(); |
| 2827 | 2835 |
| 2828 Handle<Code> ic = CompareIC::GetUninitialized(op); | 2836 Handle<Code> ic = CompareIC::GetUninitialized(op); |
| 2829 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 2837 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 2830 // This instruction also signals no smi code inlined. | 2838 // This instruction also signals no smi code inlined. |
| 2831 __ cmp(r0, Operand::Zero()); | 2839 __ cmp(r0, Operand::Zero()); |
| 2832 | 2840 |
| 2833 Condition condition = ComputeCompareCondition(op); | 2841 Condition condition = ComputeCompareCondition(op); |
| 2834 __ LoadRoot(ToRegister(instr->result()), | 2842 __ LoadRoot(ToRegister(instr->result()), |
| (...skipping 2747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5582 : LDeferredCode(codegen), instr_(instr) { } | 5590 : LDeferredCode(codegen), instr_(instr) { } |
| 5583 virtual void Generate() { codegen()->DoDeferredAllocate(instr_); } | 5591 virtual void Generate() { codegen()->DoDeferredAllocate(instr_); } |
| 5584 virtual LInstruction* instr() { return instr_; } | 5592 virtual LInstruction* instr() { return instr_; } |
| 5585 private: | 5593 private: |
| 5586 LAllocate* instr_; | 5594 LAllocate* instr_; |
| 5587 }; | 5595 }; |
| 5588 | 5596 |
| 5589 DeferredAllocate* deferred = | 5597 DeferredAllocate* deferred = |
| 5590 new(zone()) DeferredAllocate(this, instr); | 5598 new(zone()) DeferredAllocate(this, instr); |
| 5591 | 5599 |
| 5592 Register size = ToRegister(instr->size()); | |
| 5593 Register result = ToRegister(instr->result()); | 5600 Register result = ToRegister(instr->result()); |
| 5594 Register scratch = ToRegister(instr->temp1()); | 5601 Register scratch = ToRegister(instr->temp1()); |
| 5595 Register scratch2 = ToRegister(instr->temp2()); | 5602 Register scratch2 = ToRegister(instr->temp2()); |
| 5596 | 5603 |
| 5597 HAllocate* original_instr = instr->hydrogen(); | 5604 // Allocate memory for the object. |
| 5598 if (original_instr->size()->IsConstant()) { | 5605 AllocationFlags flags = TAG_OBJECT; |
| 5599 UNREACHABLE(); | 5606 if (instr->hydrogen()->MustAllocateDoubleAligned()) { |
| 5600 } else { | 5607 flags = static_cast<AllocationFlags>(flags | DOUBLE_ALIGNMENT); |
| 5601 // Allocate memory for the object. | 5608 } |
| 5602 AllocationFlags flags = TAG_OBJECT; | 5609 if (instr->size()->IsConstantOperand()) { |
| 5603 if (original_instr->MustAllocateDoubleAligned()) { | 5610 int32_t size = ToInteger32(LConstantOperand::cast(instr->size())); |
| 5604 flags = static_cast<AllocationFlags>(flags | DOUBLE_ALIGNMENT); | |
| 5605 } | |
| 5606 __ AllocateInNewSpace(size, | 5611 __ AllocateInNewSpace(size, |
| 5607 result, | 5612 result, |
| 5608 scratch, | 5613 scratch, |
| 5609 scratch2, | 5614 scratch2, |
| 5610 deferred->entry(), | 5615 deferred->entry(), |
| 5611 TAG_OBJECT); | 5616 flags); |
| 5617 } else { |
| 5618 Register size = ToRegister(instr->size()); |
| 5619 __ AllocateInNewSpace(size, |
| 5620 result, |
| 5621 scratch, |
| 5622 scratch2, |
| 5623 deferred->entry(), |
| 5624 flags); |
| 5612 } | 5625 } |
| 5613 | 5626 |
| 5614 __ bind(deferred->exit()); | 5627 __ bind(deferred->exit()); |
| 5615 } | 5628 } |
| 5616 | 5629 |
| 5617 | 5630 |
| 5618 void LCodeGen::DoDeferredAllocate(LAllocate* instr) { | 5631 void LCodeGen::DoDeferredAllocate(LAllocate* instr) { |
| 5619 Register size = ToRegister(instr->size()); | 5632 Register size = ToRegister(instr->size()); |
| 5620 Register result = ToRegister(instr->result()); | 5633 Register result = ToRegister(instr->result()); |
| 5621 | 5634 |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5848 ASSERT_EQ(size, offset); | 5861 ASSERT_EQ(size, offset); |
| 5849 } | 5862 } |
| 5850 | 5863 |
| 5851 | 5864 |
| 5852 void LCodeGen::DoObjectLiteral(LObjectLiteral* instr) { | 5865 void LCodeGen::DoObjectLiteral(LObjectLiteral* instr) { |
| 5853 Handle<FixedArray> literals(instr->environment()->closure()->literals()); | 5866 Handle<FixedArray> literals(instr->environment()->closure()->literals()); |
| 5854 Handle<FixedArray> constant_properties = | 5867 Handle<FixedArray> constant_properties = |
| 5855 instr->hydrogen()->constant_properties(); | 5868 instr->hydrogen()->constant_properties(); |
| 5856 | 5869 |
| 5857 // Set up the parameters to the stub/runtime call. | 5870 // Set up the parameters to the stub/runtime call. |
| 5858 __ LoadHeapObject(r4, literals); | 5871 __ LoadHeapObject(r3, literals); |
| 5859 __ mov(r3, Operand(Smi::FromInt(instr->hydrogen()->literal_index()))); | 5872 __ mov(r2, Operand(Smi::FromInt(instr->hydrogen()->literal_index()))); |
| 5860 __ mov(r2, Operand(constant_properties)); | 5873 __ mov(r1, Operand(constant_properties)); |
| 5861 int flags = instr->hydrogen()->fast_elements() | 5874 int flags = instr->hydrogen()->fast_elements() |
| 5862 ? ObjectLiteral::kFastElements | 5875 ? ObjectLiteral::kFastElements |
| 5863 : ObjectLiteral::kNoFlags; | 5876 : ObjectLiteral::kNoFlags; |
| 5864 __ mov(r1, Operand(Smi::FromInt(flags))); | 5877 __ mov(r0, Operand(Smi::FromInt(flags))); |
| 5865 __ Push(r4, r3, r2, r1); | |
| 5866 | 5878 |
| 5867 // Pick the right runtime function or stub to call. | 5879 // Pick the right runtime function or stub to call. |
| 5868 int properties_count = constant_properties->length() / 2; | 5880 int properties_count = constant_properties->length() / 2; |
| 5869 if (instr->hydrogen()->depth() > 1) { | 5881 if (instr->hydrogen()->depth() > 1) { |
| 5882 __ Push(r3, r2, r1, r0); |
| 5870 CallRuntime(Runtime::kCreateObjectLiteral, 4, instr); | 5883 CallRuntime(Runtime::kCreateObjectLiteral, 4, instr); |
| 5871 } else if (flags != ObjectLiteral::kFastElements || | 5884 } else if (flags != ObjectLiteral::kFastElements || |
| 5872 properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) { | 5885 properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) { |
| 5886 __ Push(r3, r2, r1, r0); |
| 5873 CallRuntime(Runtime::kCreateObjectLiteralShallow, 4, instr); | 5887 CallRuntime(Runtime::kCreateObjectLiteralShallow, 4, instr); |
| 5874 } else { | 5888 } else { |
| 5875 FastCloneShallowObjectStub stub(properties_count); | 5889 FastCloneShallowObjectStub stub(properties_count); |
| 5876 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 5890 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
| 5877 } | 5891 } |
| 5878 } | 5892 } |
| 5879 | 5893 |
| 5880 | 5894 |
| 5881 void LCodeGen::DoToFastProperties(LToFastProperties* instr) { | 5895 void LCodeGen::DoToFastProperties(LToFastProperties* instr) { |
| 5882 ASSERT(ToRegister(instr->value()).is(r0)); | 5896 ASSERT(ToRegister(instr->value()).is(r0)); |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6316 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize)); | 6330 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize)); |
| 6317 __ ldr(result, FieldMemOperand(scratch, | 6331 __ ldr(result, FieldMemOperand(scratch, |
| 6318 FixedArray::kHeaderSize - kPointerSize)); | 6332 FixedArray::kHeaderSize - kPointerSize)); |
| 6319 __ bind(&done); | 6333 __ bind(&done); |
| 6320 } | 6334 } |
| 6321 | 6335 |
| 6322 | 6336 |
| 6323 #undef __ | 6337 #undef __ |
| 6324 | 6338 |
| 6325 } } // namespace v8::internal | 6339 } } // namespace v8::internal |
| OLD | NEW |