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 2824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2835 instr, | 2835 instr, |
2836 RECORD_SAFEPOINT_WITH_REGISTERS_AND_NO_ARGUMENTS); | 2836 RECORD_SAFEPOINT_WITH_REGISTERS_AND_NO_ARGUMENTS); |
2837 LEnvironment* env = instr->GetDeferredLazyDeoptimizationEnvironment(); | 2837 LEnvironment* env = instr->GetDeferredLazyDeoptimizationEnvironment(); |
2838 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); | 2838 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); |
2839 // Put the result value into the result register slot and | 2839 // Put the result value into the result register slot and |
2840 // restore all registers. | 2840 // restore all registers. |
2841 __ StoreToSafepointRegisterSlot(result, result); | 2841 __ StoreToSafepointRegisterSlot(result, result); |
2842 } | 2842 } |
2843 | 2843 |
2844 | 2844 |
| 2845 void LCodeGen::DoInstanceSize(LInstanceSize* instr) { |
| 2846 Register object = ToRegister(instr->object()); |
| 2847 Register result = ToRegister(instr->result()); |
| 2848 __ ldr(result, FieldMemOperand(object, HeapObject::kMapOffset)); |
| 2849 __ ldrb(result, FieldMemOperand(result, Map::kInstanceSizeOffset)); |
| 2850 } |
| 2851 |
| 2852 |
2845 void LCodeGen::DoCmpT(LCmpT* instr) { | 2853 void LCodeGen::DoCmpT(LCmpT* instr) { |
2846 Token::Value op = instr->op(); | 2854 Token::Value op = instr->op(); |
2847 | 2855 |
2848 Handle<Code> ic = CompareIC::GetUninitialized(op); | 2856 Handle<Code> ic = CompareIC::GetUninitialized(op); |
2849 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 2857 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
2850 // This instruction also signals no smi code inlined. | 2858 // This instruction also signals no smi code inlined. |
2851 __ cmp(r0, Operand::Zero()); | 2859 __ cmp(r0, Operand::Zero()); |
2852 | 2860 |
2853 Condition condition = ComputeCompareCondition(op); | 2861 Condition condition = ComputeCompareCondition(op); |
2854 __ LoadRoot(ToRegister(instr->result()), | 2862 __ LoadRoot(ToRegister(instr->result()), |
(...skipping 2740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5595 : LDeferredCode(codegen), instr_(instr) { } | 5603 : LDeferredCode(codegen), instr_(instr) { } |
5596 virtual void Generate() { codegen()->DoDeferredAllocate(instr_); } | 5604 virtual void Generate() { codegen()->DoDeferredAllocate(instr_); } |
5597 virtual LInstruction* instr() { return instr_; } | 5605 virtual LInstruction* instr() { return instr_; } |
5598 private: | 5606 private: |
5599 LAllocate* instr_; | 5607 LAllocate* instr_; |
5600 }; | 5608 }; |
5601 | 5609 |
5602 DeferredAllocate* deferred = | 5610 DeferredAllocate* deferred = |
5603 new(zone()) DeferredAllocate(this, instr); | 5611 new(zone()) DeferredAllocate(this, instr); |
5604 | 5612 |
5605 Register size = ToRegister(instr->size()); | |
5606 Register result = ToRegister(instr->result()); | 5613 Register result = ToRegister(instr->result()); |
5607 Register scratch = ToRegister(instr->temp1()); | 5614 Register scratch = ToRegister(instr->temp1()); |
5608 Register scratch2 = ToRegister(instr->temp2()); | 5615 Register scratch2 = ToRegister(instr->temp2()); |
5609 | 5616 |
5610 HAllocate* original_instr = instr->hydrogen(); | 5617 // Allocate memory for the object. |
5611 if (original_instr->size()->IsConstant()) { | 5618 AllocationFlags flags = TAG_OBJECT; |
5612 UNREACHABLE(); | 5619 if (instr->hydrogen()->MustAllocateDoubleAligned()) { |
5613 } else { | 5620 flags = static_cast<AllocationFlags>(flags | DOUBLE_ALIGNMENT); |
5614 // Allocate memory for the object. | 5621 } |
5615 AllocationFlags flags = TAG_OBJECT; | 5622 if (instr->size()->IsConstantOperand()) { |
5616 if (original_instr->MustAllocateDoubleAligned()) { | 5623 int32_t size = ToInteger32(LConstantOperand::cast(instr->size())); |
5617 flags = static_cast<AllocationFlags>(flags | DOUBLE_ALIGNMENT); | |
5618 } | |
5619 __ AllocateInNewSpace(size, | 5624 __ AllocateInNewSpace(size, |
5620 result, | 5625 result, |
5621 scratch, | 5626 scratch, |
5622 scratch2, | 5627 scratch2, |
5623 deferred->entry(), | 5628 deferred->entry(), |
5624 TAG_OBJECT); | 5629 flags); |
| 5630 } else { |
| 5631 Register size = ToRegister(instr->size()); |
| 5632 __ AllocateInNewSpace(size, |
| 5633 result, |
| 5634 scratch, |
| 5635 scratch2, |
| 5636 deferred->entry(), |
| 5637 flags); |
5625 } | 5638 } |
5626 | 5639 |
5627 __ bind(deferred->exit()); | 5640 __ bind(deferred->exit()); |
5628 } | 5641 } |
5629 | 5642 |
5630 | 5643 |
5631 void LCodeGen::DoDeferredAllocate(LAllocate* instr) { | 5644 void LCodeGen::DoDeferredAllocate(LAllocate* instr) { |
5632 Register size = ToRegister(instr->size()); | 5645 Register size = ToRegister(instr->size()); |
5633 Register result = ToRegister(instr->result()); | 5646 Register result = ToRegister(instr->result()); |
5634 | 5647 |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5862 ASSERT_EQ(size, offset); | 5875 ASSERT_EQ(size, offset); |
5863 } | 5876 } |
5864 | 5877 |
5865 | 5878 |
5866 void LCodeGen::DoObjectLiteral(LObjectLiteral* instr) { | 5879 void LCodeGen::DoObjectLiteral(LObjectLiteral* instr) { |
5867 Handle<FixedArray> literals(instr->environment()->closure()->literals()); | 5880 Handle<FixedArray> literals(instr->environment()->closure()->literals()); |
5868 Handle<FixedArray> constant_properties = | 5881 Handle<FixedArray> constant_properties = |
5869 instr->hydrogen()->constant_properties(); | 5882 instr->hydrogen()->constant_properties(); |
5870 | 5883 |
5871 // Set up the parameters to the stub/runtime call. | 5884 // Set up the parameters to the stub/runtime call. |
5872 __ LoadHeapObject(r4, literals); | 5885 __ LoadHeapObject(r3, literals); |
5873 __ mov(r3, Operand(Smi::FromInt(instr->hydrogen()->literal_index()))); | 5886 __ mov(r2, Operand(Smi::FromInt(instr->hydrogen()->literal_index()))); |
5874 __ mov(r2, Operand(constant_properties)); | 5887 __ mov(r1, Operand(constant_properties)); |
5875 int flags = instr->hydrogen()->fast_elements() | 5888 int flags = instr->hydrogen()->fast_elements() |
5876 ? ObjectLiteral::kFastElements | 5889 ? ObjectLiteral::kFastElements |
5877 : ObjectLiteral::kNoFlags; | 5890 : ObjectLiteral::kNoFlags; |
5878 __ mov(r1, Operand(Smi::FromInt(flags))); | 5891 __ mov(r0, Operand(Smi::FromInt(flags))); |
5879 __ Push(r4, r3, r2, r1); | |
5880 | 5892 |
5881 // Pick the right runtime function or stub to call. | 5893 // Pick the right runtime function or stub to call. |
5882 int properties_count = constant_properties->length() / 2; | 5894 int properties_count = constant_properties->length() / 2; |
5883 if (instr->hydrogen()->depth() > 1) { | 5895 if (instr->hydrogen()->depth() > 1) { |
| 5896 __ Push(r3, r2, r1, r0); |
5884 CallRuntime(Runtime::kCreateObjectLiteral, 4, instr); | 5897 CallRuntime(Runtime::kCreateObjectLiteral, 4, instr); |
5885 } else if (flags != ObjectLiteral::kFastElements || | 5898 } else if (flags != ObjectLiteral::kFastElements || |
5886 properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) { | 5899 properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) { |
| 5900 __ Push(r3, r2, r1, r0); |
5887 CallRuntime(Runtime::kCreateObjectLiteralShallow, 4, instr); | 5901 CallRuntime(Runtime::kCreateObjectLiteralShallow, 4, instr); |
5888 } else { | 5902 } else { |
5889 FastCloneShallowObjectStub stub(properties_count); | 5903 FastCloneShallowObjectStub stub(properties_count); |
5890 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 5904 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
5891 } | 5905 } |
5892 } | 5906 } |
5893 | 5907 |
5894 | 5908 |
5895 void LCodeGen::DoToFastProperties(LToFastProperties* instr) { | 5909 void LCodeGen::DoToFastProperties(LToFastProperties* instr) { |
5896 ASSERT(ToRegister(instr->value()).is(r0)); | 5910 ASSERT(ToRegister(instr->value()).is(r0)); |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6330 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize)); | 6344 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize)); |
6331 __ ldr(result, FieldMemOperand(scratch, | 6345 __ ldr(result, FieldMemOperand(scratch, |
6332 FixedArray::kHeaderSize - kPointerSize)); | 6346 FixedArray::kHeaderSize - kPointerSize)); |
6333 __ bind(&done); | 6347 __ bind(&done); |
6334 } | 6348 } |
6335 | 6349 |
6336 | 6350 |
6337 #undef __ | 6351 #undef __ |
6338 | 6352 |
6339 } } // namespace v8::internal | 6353 } } // namespace v8::internal |
OLD | NEW |