Chromium Code Reviews| 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 822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 833 | 833 |
| 834 ASSERT(FLAG_deopt_every_n_times < 2); // Other values not supported on ARM. | 834 ASSERT(FLAG_deopt_every_n_times < 2); // Other values not supported on ARM. |
| 835 | 835 |
| 836 if (FLAG_deopt_every_n_times == 1 && info_->opt_count() == id) { | 836 if (FLAG_deopt_every_n_times == 1 && info_->opt_count() == id) { |
| 837 __ Jump(entry, RelocInfo::RUNTIME_ENTRY); | 837 __ Jump(entry, RelocInfo::RUNTIME_ENTRY); |
| 838 return; | 838 return; |
| 839 } | 839 } |
| 840 | 840 |
| 841 if (FLAG_trap_on_deopt) __ stop("trap_on_deopt", cc); | 841 if (FLAG_trap_on_deopt) __ stop("trap_on_deopt", cc); |
| 842 | 842 |
| 843 bool needs_lazy_deopt = info()->IsStub(); | 843 bool lazy_deopt_needed = info()->IsStub(); |
|
danno
2013/02/11 15:05:21
This change and the changes in the following lines
mvstanton
2013/02/15 07:36:43
Done.
| |
| 844 ASSERT(info()->IsStub() || frame_is_built_); | 844 ASSERT(info()->IsStub() || frame_is_built_); |
| 845 if (cc == al && !needs_lazy_deopt) { | 845 if (cc == al && !lazy_deopt_needed && frame_is_built_) { |
| 846 __ Jump(entry, RelocInfo::RUNTIME_ENTRY); | 846 __ Jump(entry, RelocInfo::RUNTIME_ENTRY); |
| 847 } else { | 847 } else { |
| 848 // We often have several deopts to the same entry, reuse the last | 848 // We often have several deopts to the same entry, reuse the last |
| 849 // jump entry if this is the case. | 849 // jump entry if this is the case. |
| 850 if (deopt_jump_table_.is_empty() || | 850 if (deopt_jump_table_.is_empty() || |
| 851 (deopt_jump_table_.last().address != entry) || | 851 (deopt_jump_table_.last().address != entry) || |
| 852 (deopt_jump_table_.last().is_lazy_deopt != needs_lazy_deopt) || | 852 (deopt_jump_table_.last().is_lazy_deopt != lazy_deopt_needed) || |
| 853 (deopt_jump_table_.last().needs_frame != !frame_is_built_)) { | 853 (deopt_jump_table_.last().needs_frame != !frame_is_built_)) { |
| 854 JumpTableEntry table_entry(entry, !frame_is_built_, needs_lazy_deopt); | 854 JumpTableEntry table_entry(entry, !frame_is_built_, lazy_deopt_needed); |
| 855 deopt_jump_table_.Add(table_entry, zone()); | 855 deopt_jump_table_.Add(table_entry, zone()); |
| 856 } | 856 } |
| 857 __ b(cc, &deopt_jump_table_.last().label); | 857 __ b(cc, &deopt_jump_table_.last().label); |
| 858 } | 858 } |
| 859 } | 859 } |
| 860 | 860 |
| 861 | 861 |
| 862 void LCodeGen::PopulateDeoptimizationData(Handle<Code> code) { | 862 void LCodeGen::PopulateDeoptimizationData(Handle<Code> code) { |
| 863 int length = deoptimizations_.length(); | 863 int length = deoptimizations_.length(); |
| 864 if (length == 0) return; | 864 if (length == 0) return; |
| (...skipping 4766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5631 // Load map into r2. | 5631 // Load map into r2. |
| 5632 __ ldr(r2, FieldMemOperand(r1, HeapObject::kMapOffset)); | 5632 __ ldr(r2, FieldMemOperand(r1, HeapObject::kMapOffset)); |
| 5633 // Load the map's "bit field 2". | 5633 // Load the map's "bit field 2". |
| 5634 __ ldrb(r2, FieldMemOperand(r2, Map::kBitField2Offset)); | 5634 __ ldrb(r2, FieldMemOperand(r2, Map::kBitField2Offset)); |
| 5635 // Retrieve elements_kind from bit field 2. | 5635 // Retrieve elements_kind from bit field 2. |
| 5636 __ ubfx(r2, r2, Map::kElementsKindShift, Map::kElementsKindBitCount); | 5636 __ ubfx(r2, r2, Map::kElementsKindShift, Map::kElementsKindBitCount); |
| 5637 __ cmp(r2, Operand(boilerplate_elements_kind)); | 5637 __ cmp(r2, Operand(boilerplate_elements_kind)); |
| 5638 DeoptimizeIf(ne, instr->environment()); | 5638 DeoptimizeIf(ne, instr->environment()); |
| 5639 } | 5639 } |
| 5640 | 5640 |
| 5641 int flags = allocation_site_mode == TRACK_ALLOCATION_SITE | |
| 5642 ? ArrayLiteral::kAllocationSiteInfoAllowed | |
| 5643 : ArrayLiteral::kNoFlags; | |
| 5644 | |
| 5641 // Set up the parameters to the stub/runtime call. | 5645 // Set up the parameters to the stub/runtime call. |
| 5642 __ LoadHeapObject(r3, literals); | 5646 __ LoadHeapObject(r3, literals); |
| 5643 __ mov(r2, Operand(Smi::FromInt(instr->hydrogen()->literal_index()))); | 5647 __ mov(r2, Operand(Smi::FromInt(instr->hydrogen()->literal_index()))); |
| 5644 // Boilerplate already exists, constant elements are never accessed. | 5648 // Boilerplate already exists, constant elements are never accessed. |
| 5645 // Pass an empty fixed array. | 5649 // Pass an empty fixed array. |
| 5646 __ mov(r1, Operand(isolate()->factory()->empty_fixed_array())); | 5650 __ mov(r1, Operand(isolate()->factory()->empty_fixed_array())); |
| 5647 __ Push(r3, r2, r1); | 5651 __ Push(r3, r2, r1); |
| 5648 | 5652 |
| 5649 // Pick the right runtime function or stub to call. | 5653 // Pick the right runtime function or stub to call. |
| 5650 int length = instr->hydrogen()->length(); | 5654 int length = instr->hydrogen()->length(); |
| 5651 if (instr->hydrogen()->IsCopyOnWrite()) { | 5655 if (instr->hydrogen()->IsCopyOnWrite()) { |
| 5652 ASSERT(instr->hydrogen()->depth() == 1); | 5656 ASSERT(instr->hydrogen()->depth() == 1); |
| 5653 FastCloneShallowArrayStub::Mode mode = | 5657 FastCloneShallowArrayStub::Mode mode = |
| 5654 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS; | 5658 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS; |
| 5655 FastCloneShallowArrayStub stub(mode, DONT_TRACK_ALLOCATION_SITE, length); | 5659 FastCloneShallowArrayStub stub(mode, DONT_TRACK_ALLOCATION_SITE, length); |
| 5656 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 5660 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
| 5657 } else if (instr->hydrogen()->depth() > 1) { | 5661 } else if (instr->hydrogen()->depth() > 1) { |
| 5658 CallRuntime(Runtime::kCreateArrayLiteral, 3, instr); | 5662 __ mov(r0, Operand(Smi::FromInt(flags))); |
| 5663 __ push(r0); | |
| 5664 CallRuntime(Runtime::kCreateArrayLiteral, 4, instr); | |
| 5659 } else if (length > FastCloneShallowArrayStub::kMaximumClonedLength) { | 5665 } else if (length > FastCloneShallowArrayStub::kMaximumClonedLength) { |
| 5660 CallRuntime(Runtime::kCreateArrayLiteralShallow, 3, instr); | 5666 __ mov(r0, Operand(Smi::FromInt(flags))); |
| 5667 __ push(r0); | |
| 5668 CallRuntime(Runtime::kCreateArrayLiteralShallow, 4, instr); | |
| 5661 } else { | 5669 } else { |
| 5662 FastCloneShallowArrayStub::Mode mode = | 5670 FastCloneShallowArrayStub::Mode mode = |
| 5663 boilerplate_elements_kind == FAST_DOUBLE_ELEMENTS | 5671 boilerplate_elements_kind == FAST_DOUBLE_ELEMENTS |
| 5664 ? FastCloneShallowArrayStub::CLONE_DOUBLE_ELEMENTS | 5672 ? FastCloneShallowArrayStub::CLONE_DOUBLE_ELEMENTS |
| 5665 : FastCloneShallowArrayStub::CLONE_ELEMENTS; | 5673 : FastCloneShallowArrayStub::CLONE_ELEMENTS; |
| 5666 FastCloneShallowArrayStub stub(mode, allocation_site_mode, length); | 5674 FastCloneShallowArrayStub stub(mode, allocation_site_mode, length); |
| 5667 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 5675 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
| 5668 } | 5676 } |
| 5669 } | 5677 } |
| 5670 | 5678 |
| 5671 | 5679 |
| 5672 void LCodeGen::EmitDeepCopy(Handle<JSObject> object, | 5680 void LCodeGen::EmitDeepCopy(Handle<JSObject> object, |
| 5681 Handle<JSObject> original_object, | |
| 5673 Register result, | 5682 Register result, |
| 5674 Register source, | 5683 Register source, |
| 5675 int* offset, | 5684 int* offset, |
| 5676 AllocationSiteMode mode) { | 5685 AllocationSiteMode mode) { |
| 5677 ASSERT(!source.is(r2)); | 5686 ASSERT(!source.is(r2)); |
| 5678 ASSERT(!result.is(r2)); | 5687 ASSERT(!result.is(r2)); |
| 5679 | 5688 |
| 5689 // Should we track allocation info for *this* object in the tree? | |
| 5680 bool create_allocation_site_info = mode == TRACK_ALLOCATION_SITE && | 5690 bool create_allocation_site_info = mode == TRACK_ALLOCATION_SITE && |
| 5681 object->map()->CanTrackAllocationSite(); | 5691 object->IsJSArray() && object->ShouldTrackAllocationInfo(); |
| 5682 | 5692 |
| 5683 // Only elements backing stores for non-COW arrays need to be copied. | 5693 // Only elements backing stores for non-COW arrays need to be copied. |
| 5684 Handle<FixedArrayBase> elements(object->elements()); | 5694 Handle<FixedArrayBase> elements(object->elements()); |
| 5695 Handle<FixedArrayBase> original_elements(original_object->elements()); | |
| 5685 bool has_elements = elements->length() > 0 && | 5696 bool has_elements = elements->length() > 0 && |
| 5686 elements->map() != isolate()->heap()->fixed_cow_array_map(); | 5697 elements->map() != isolate()->heap()->fixed_cow_array_map(); |
| 5687 | 5698 |
| 5688 // Increase the offset so that subsequent objects end up right after | 5699 // Increase the offset so that subsequent objects end up right after |
| 5689 // this object and its backing store. | 5700 // this object and its backing store. |
| 5690 int object_offset = *offset; | 5701 int object_offset = *offset; |
| 5691 int object_size = object->map()->instance_size(); | 5702 int object_size = object->map()->instance_size(); |
| 5692 int elements_size = has_elements ? elements->Size() : 0; | 5703 int elements_size = has_elements ? elements->Size() : 0; |
| 5693 int elements_offset = *offset + object_size; | 5704 int elements_offset = *offset + object_size; |
| 5694 if (create_allocation_site_info) { | 5705 if (create_allocation_site_info) { |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 5710 } | 5721 } |
| 5711 __ str(r2, FieldMemOperand(result, object_offset + i)); | 5722 __ str(r2, FieldMemOperand(result, object_offset + i)); |
| 5712 } | 5723 } |
| 5713 | 5724 |
| 5714 // Copy in-object properties. | 5725 // Copy in-object properties. |
| 5715 for (int i = 0; i < inobject_properties; i++) { | 5726 for (int i = 0; i < inobject_properties; i++) { |
| 5716 int total_offset = object_offset + object->GetInObjectPropertyOffset(i); | 5727 int total_offset = object_offset + object->GetInObjectPropertyOffset(i); |
| 5717 Handle<Object> value = Handle<Object>(object->InObjectPropertyAt(i)); | 5728 Handle<Object> value = Handle<Object>(object->InObjectPropertyAt(i)); |
| 5718 if (value->IsJSObject()) { | 5729 if (value->IsJSObject()) { |
| 5719 Handle<JSObject> value_object = Handle<JSObject>::cast(value); | 5730 Handle<JSObject> value_object = Handle<JSObject>::cast(value); |
| 5731 Handle<JSObject> original_value_object = Handle<JSObject>::cast( | |
| 5732 Handle<Object>(original_object->InObjectPropertyAt(i))); | |
| 5733 | |
| 5720 __ add(r2, result, Operand(*offset)); | 5734 __ add(r2, result, Operand(*offset)); |
| 5721 __ str(r2, FieldMemOperand(result, total_offset)); | 5735 __ str(r2, FieldMemOperand(result, total_offset)); |
| 5722 __ LoadHeapObject(source, value_object); | 5736 __ LoadHeapObject(source, value_object); |
| 5723 EmitDeepCopy(value_object, result, source, offset, | 5737 EmitDeepCopy(value_object, original_value_object, result, source, |
| 5724 DONT_TRACK_ALLOCATION_SITE); | 5738 offset, mode); |
| 5725 } else if (value->IsHeapObject()) { | 5739 } else if (value->IsHeapObject()) { |
| 5726 __ LoadHeapObject(r2, Handle<HeapObject>::cast(value)); | 5740 __ LoadHeapObject(r2, Handle<HeapObject>::cast(value)); |
| 5727 __ str(r2, FieldMemOperand(result, total_offset)); | 5741 __ str(r2, FieldMemOperand(result, total_offset)); |
| 5728 } else { | 5742 } else { |
| 5729 __ mov(r2, Operand(value)); | 5743 __ mov(r2, Operand(value)); |
| 5730 __ str(r2, FieldMemOperand(result, total_offset)); | 5744 __ str(r2, FieldMemOperand(result, total_offset)); |
| 5731 } | 5745 } |
| 5732 } | 5746 } |
| 5733 | 5747 |
| 5734 // Build Allocation Site Info if desired | 5748 // Build Allocation Site Info if desired |
| 5735 if (create_allocation_site_info) { | 5749 if (create_allocation_site_info) { |
| 5736 __ mov(r2, Operand(Handle<Map>(isolate()->heap()-> | 5750 __ mov(r2, Operand(Handle<Map>(isolate()->heap()-> |
| 5737 allocation_site_info_map()))); | 5751 allocation_site_info_map()))); |
| 5738 __ str(r2, FieldMemOperand(result, object_size)); | 5752 __ str(r2, FieldMemOperand(result, object_size + object_offset)); |
| 5739 __ str(source, FieldMemOperand(result, object_size + kPointerSize)); | 5753 __ LoadHeapObject(r2, original_object); |
| 5754 __ str(r2, FieldMemOperand(result, | |
| 5755 object_size + object_offset + kPointerSize)); | |
| 5740 } | 5756 } |
| 5741 | 5757 |
| 5742 if (has_elements) { | 5758 if (has_elements) { |
| 5743 // Copy elements backing store header. | 5759 // Copy elements backing store header. |
| 5744 __ LoadHeapObject(source, elements); | 5760 __ LoadHeapObject(source, elements); |
| 5745 for (int i = 0; i < FixedArray::kHeaderSize; i += kPointerSize) { | 5761 for (int i = 0; i < FixedArray::kHeaderSize; i += kPointerSize) { |
| 5746 __ ldr(r2, FieldMemOperand(source, i)); | 5762 __ ldr(r2, FieldMemOperand(source, i)); |
| 5747 __ str(r2, FieldMemOperand(result, elements_offset + i)); | 5763 __ str(r2, FieldMemOperand(result, elements_offset + i)); |
| 5748 } | 5764 } |
| 5749 | 5765 |
| 5750 // Copy elements backing store content. | 5766 // Copy elements backing store content. |
| 5751 int elements_length = has_elements ? elements->length() : 0; | 5767 int elements_length = has_elements ? elements->length() : 0; |
| 5752 if (elements->IsFixedDoubleArray()) { | 5768 if (elements->IsFixedDoubleArray()) { |
| 5753 Handle<FixedDoubleArray> double_array = | 5769 Handle<FixedDoubleArray> double_array = |
| 5754 Handle<FixedDoubleArray>::cast(elements); | 5770 Handle<FixedDoubleArray>::cast(elements); |
| 5755 for (int i = 0; i < elements_length; i++) { | 5771 for (int i = 0; i < elements_length; i++) { |
| 5756 int64_t value = double_array->get_representation(i); | 5772 int64_t value = double_array->get_representation(i); |
| 5757 // We only support little endian mode... | 5773 // We only support little endian mode... |
| 5758 int32_t value_low = static_cast<int32_t>(value & 0xFFFFFFFF); | 5774 int32_t value_low = static_cast<int32_t>(value & 0xFFFFFFFF); |
| 5759 int32_t value_high = static_cast<int32_t>(value >> 32); | 5775 int32_t value_high = static_cast<int32_t>(value >> 32); |
| 5760 int total_offset = | 5776 int total_offset = |
| 5761 elements_offset + FixedDoubleArray::OffsetOfElementAt(i); | 5777 elements_offset + FixedDoubleArray::OffsetOfElementAt(i); |
| 5762 __ mov(r2, Operand(value_low)); | 5778 __ mov(r2, Operand(value_low)); |
| 5763 __ str(r2, FieldMemOperand(result, total_offset)); | 5779 __ str(r2, FieldMemOperand(result, total_offset)); |
| 5764 __ mov(r2, Operand(value_high)); | 5780 __ mov(r2, Operand(value_high)); |
| 5765 __ str(r2, FieldMemOperand(result, total_offset + 4)); | 5781 __ str(r2, FieldMemOperand(result, total_offset + 4)); |
| 5766 } | 5782 } |
| 5767 } else if (elements->IsFixedArray()) { | 5783 } else if (elements->IsFixedArray()) { |
| 5768 Handle<FixedArray> fast_elements = Handle<FixedArray>::cast(elements); | 5784 Handle<FixedArray> fast_elements = Handle<FixedArray>::cast(elements); |
| 5785 ASSERT(original_object->HasFastObjectElements()); | |
| 5786 Handle<FixedArray> original_fast_elements = | |
| 5787 Handle<FixedArray>::cast(original_elements); | |
| 5769 for (int i = 0; i < elements_length; i++) { | 5788 for (int i = 0; i < elements_length; i++) { |
| 5770 int total_offset = elements_offset + FixedArray::OffsetOfElementAt(i); | 5789 int total_offset = elements_offset + FixedArray::OffsetOfElementAt(i); |
| 5771 Handle<Object> value(fast_elements->get(i)); | 5790 Handle<Object> value(fast_elements->get(i)); |
| 5772 if (value->IsJSObject()) { | 5791 if (value->IsJSObject()) { |
| 5773 Handle<JSObject> value_object = Handle<JSObject>::cast(value); | 5792 Handle<JSObject> value_object = Handle<JSObject>::cast(value); |
| 5793 Handle<JSObject> original_value_object = Handle<JSObject>::cast( | |
| 5794 Handle<Object>(original_fast_elements->get(i))); | |
| 5774 __ add(r2, result, Operand(*offset)); | 5795 __ add(r2, result, Operand(*offset)); |
| 5775 __ str(r2, FieldMemOperand(result, total_offset)); | 5796 __ str(r2, FieldMemOperand(result, total_offset)); |
| 5776 __ LoadHeapObject(source, value_object); | 5797 __ LoadHeapObject(source, value_object); |
| 5777 EmitDeepCopy(value_object, result, source, offset, | 5798 ASSERT(!value_object.is_identical_to(original_value_object)); |
| 5778 DONT_TRACK_ALLOCATION_SITE); | 5799 EmitDeepCopy(value_object, original_value_object, result, source, |
| 5800 offset, mode); | |
| 5779 } else if (value->IsHeapObject()) { | 5801 } else if (value->IsHeapObject()) { |
| 5780 __ LoadHeapObject(r2, Handle<HeapObject>::cast(value)); | 5802 __ LoadHeapObject(r2, Handle<HeapObject>::cast(value)); |
| 5781 __ str(r2, FieldMemOperand(result, total_offset)); | 5803 __ str(r2, FieldMemOperand(result, total_offset)); |
| 5782 } else { | 5804 } else { |
| 5783 __ mov(r2, Operand(value)); | 5805 __ mov(r2, Operand(value)); |
| 5784 __ str(r2, FieldMemOperand(result, total_offset)); | 5806 __ str(r2, FieldMemOperand(result, total_offset)); |
| 5785 } | 5807 } |
| 5786 } | 5808 } |
| 5787 } else { | 5809 } else { |
| 5788 UNREACHABLE(); | 5810 UNREACHABLE(); |
| 5789 } | 5811 } |
| 5790 } | 5812 } |
| 5791 } | 5813 } |
| 5792 | 5814 |
| 5793 | 5815 |
| 5794 void LCodeGen::DoFastLiteral(LFastLiteral* instr) { | 5816 void LCodeGen::DoFastLiteral(LFastLiteral* instr) { |
| 5795 int size = instr->hydrogen()->total_size(); | 5817 int size = instr->hydrogen()->total_size(); |
| 5796 ElementsKind boilerplate_elements_kind = | |
| 5797 instr->hydrogen()->boilerplate()->GetElementsKind(); | |
| 5798 | 5818 |
| 5799 // Deopt if the array literal boilerplate ElementsKind is of a type different | |
| 5800 // than the expected one. The check isn't necessary if the boilerplate has | |
| 5801 // already been converted to TERMINAL_FAST_ELEMENTS_KIND. | |
| 5802 if (CanTransitionToMoreGeneralFastElementsKind( | |
| 5803 boilerplate_elements_kind, true)) { | |
| 5804 __ LoadHeapObject(r1, instr->hydrogen()->boilerplate()); | |
| 5805 // Load map into r2. | |
| 5806 __ ldr(r2, FieldMemOperand(r1, HeapObject::kMapOffset)); | |
| 5807 // Load the map's "bit field 2". | |
| 5808 __ ldrb(r2, FieldMemOperand(r2, Map::kBitField2Offset)); | |
| 5809 // Retrieve elements_kind from bit field 2. | |
| 5810 __ ubfx(r2, r2, Map::kElementsKindShift, Map::kElementsKindBitCount); | |
| 5811 __ cmp(r2, Operand(boilerplate_elements_kind)); | |
| 5812 DeoptimizeIf(ne, instr->environment()); | |
| 5813 } | |
| 5814 | |
| 5815 // Allocate all objects that are part of the literal in one big | |
| 5816 // allocation. This avoids multiple limit checks. | 5819 // allocation. This avoids multiple limit checks. |
| 5817 Label allocated, runtime_allocate; | 5820 Label allocated, runtime_allocate; |
| 5818 __ AllocateInNewSpace(size, r0, r2, r3, &runtime_allocate, TAG_OBJECT); | 5821 __ AllocateInNewSpace(size, r0, r2, r3, &runtime_allocate, TAG_OBJECT); |
| 5819 __ jmp(&allocated); | 5822 __ jmp(&allocated); |
| 5820 | 5823 |
| 5821 __ bind(&runtime_allocate); | 5824 __ bind(&runtime_allocate); |
| 5822 __ mov(r0, Operand(Smi::FromInt(size))); | 5825 __ mov(r0, Operand(Smi::FromInt(size))); |
| 5823 __ push(r0); | 5826 __ push(r0); |
| 5824 CallRuntime(Runtime::kAllocateInNewSpace, 1, instr); | 5827 CallRuntime(Runtime::kAllocateInNewSpace, 1, instr); |
| 5825 | 5828 |
| 5826 __ bind(&allocated); | 5829 __ bind(&allocated); |
| 5827 int offset = 0; | 5830 int offset = 0; |
| 5828 __ LoadHeapObject(r1, instr->hydrogen()->boilerplate()); | 5831 __ LoadHeapObject(r1, instr->hydrogen()->boilerplate()); |
| 5829 EmitDeepCopy(instr->hydrogen()->boilerplate(), r0, r1, &offset, | 5832 EmitDeepCopy(instr->hydrogen()->boilerplate(), |
| 5833 instr->hydrogen()->original_boilerplate(), | |
| 5834 r0, r1, &offset, | |
| 5830 instr->hydrogen()->allocation_site_mode()); | 5835 instr->hydrogen()->allocation_site_mode()); |
| 5831 ASSERT_EQ(size, offset); | 5836 ASSERT_EQ(size, offset); |
| 5832 } | 5837 } |
| 5833 | 5838 |
| 5834 | 5839 |
| 5835 void LCodeGen::DoObjectLiteral(LObjectLiteral* instr) { | 5840 void LCodeGen::DoObjectLiteral(LObjectLiteral* instr) { |
| 5836 Handle<FixedArray> literals(instr->environment()->closure()->literals()); | 5841 Handle<FixedArray> literals(instr->environment()->closure()->literals()); |
| 5837 Handle<FixedArray> constant_properties = | 5842 Handle<FixedArray> constant_properties = |
| 5838 instr->hydrogen()->constant_properties(); | 5843 instr->hydrogen()->constant_properties(); |
| 5839 | 5844 |
| 5840 // Set up the parameters to the stub/runtime call. | 5845 // Set up the parameters to the stub/runtime call. |
| 5841 __ LoadHeapObject(r4, literals); | 5846 __ LoadHeapObject(r4, literals); |
| 5842 __ mov(r3, Operand(Smi::FromInt(instr->hydrogen()->literal_index()))); | 5847 __ mov(r3, Operand(Smi::FromInt(instr->hydrogen()->literal_index()))); |
| 5843 __ mov(r2, Operand(constant_properties)); | 5848 __ mov(r2, Operand(constant_properties)); |
| 5844 int flags = instr->hydrogen()->fast_elements() | 5849 int flags = instr->hydrogen()->fast_elements() |
| 5845 ? ObjectLiteral::kFastElements | 5850 ? ObjectLiteral::kFastElements |
| 5846 : ObjectLiteral::kNoFlags; | 5851 : ObjectLiteral::kNoFlags; |
| 5852 | |
| 5853 if (instr->hydrogen()->allocation_site_mode() == TRACK_ALLOCATION_SITE) { | |
| 5854 flags |= ObjectLiteral::kAllocationSiteInfoAllowed; | |
| 5855 } | |
| 5856 | |
| 5847 __ mov(r1, Operand(Smi::FromInt(flags))); | 5857 __ mov(r1, Operand(Smi::FromInt(flags))); |
| 5848 __ Push(r4, r3, r2, r1); | 5858 __ Push(r4, r3, r2, r1); |
| 5849 | 5859 |
| 5850 // Pick the right runtime function or stub to call. | 5860 // Pick the right runtime function or stub to call. |
| 5851 int properties_count = constant_properties->length() / 2; | 5861 int properties_count = constant_properties->length() / 2; |
| 5852 if (instr->hydrogen()->depth() > 1) { | 5862 if (instr->hydrogen()->depth() > 1) { |
| 5853 CallRuntime(Runtime::kCreateObjectLiteral, 4, instr); | 5863 CallRuntime(Runtime::kCreateObjectLiteral, 4, instr); |
| 5854 } else if (flags != ObjectLiteral::kFastElements || | 5864 } else if (flags != ObjectLiteral::kFastElements || |
| 5855 properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) { | 5865 properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) { |
| 5856 CallRuntime(Runtime::kCreateObjectLiteralShallow, 4, instr); | 5866 CallRuntime(Runtime::kCreateObjectLiteralShallow, 4, instr); |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6299 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize)); | 6309 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize)); |
| 6300 __ ldr(result, FieldMemOperand(scratch, | 6310 __ ldr(result, FieldMemOperand(scratch, |
| 6301 FixedArray::kHeaderSize - kPointerSize)); | 6311 FixedArray::kHeaderSize - kPointerSize)); |
| 6302 __ bind(&done); | 6312 __ bind(&done); |
| 6303 } | 6313 } |
| 6304 | 6314 |
| 6305 | 6315 |
| 6306 #undef __ | 6316 #undef __ |
| 6307 | 6317 |
| 6308 } } // namespace v8::internal | 6318 } } // namespace v8::internal |
| OLD | NEW |