| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 1759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1770 ZoneList<Expression*>* subexprs = expr->values(); | 1770 ZoneList<Expression*>* subexprs = expr->values(); |
| 1771 int length = subexprs->length(); | 1771 int length = subexprs->length(); |
| 1772 Handle<FixedArray> constant_elements = expr->constant_elements(); | 1772 Handle<FixedArray> constant_elements = expr->constant_elements(); |
| 1773 ASSERT_EQ(2, constant_elements->length()); | 1773 ASSERT_EQ(2, constant_elements->length()); |
| 1774 ElementsKind constant_elements_kind = | 1774 ElementsKind constant_elements_kind = |
| 1775 static_cast<ElementsKind>(Smi::cast(constant_elements->get(0))->value()); | 1775 static_cast<ElementsKind>(Smi::cast(constant_elements->get(0))->value()); |
| 1776 bool has_fast_elements = IsFastObjectElementsKind(constant_elements_kind); | 1776 bool has_fast_elements = IsFastObjectElementsKind(constant_elements_kind); |
| 1777 Handle<FixedArrayBase> constant_elements_values( | 1777 Handle<FixedArrayBase> constant_elements_values( |
| 1778 FixedArrayBase::cast(constant_elements->get(1))); | 1778 FixedArrayBase::cast(constant_elements->get(1))); |
| 1779 | 1779 |
| 1780 AllocationSiteMode allocation_site_mode = |
| 1781 FLAG_track_allocation_sites ? TRACK_ALLOCATION_SITE |
| 1782 : DONT_TRACK_ALLOCATION_SITE; |
| 1783 if (has_fast_elements && !FLAG_allocation_site_pretenuring) { |
| 1784 // If the only customer of allocation sites is transitioning, then |
| 1785 // we can turn it off if we don't have anywhere else to transition to. |
| 1786 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE; |
| 1787 } |
| 1788 |
| 1780 __ Ldr(x3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 1789 __ Ldr(x3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
| 1781 __ Ldr(x3, FieldMemOperand(x3, JSFunction::kLiteralsOffset)); | 1790 __ Ldr(x3, FieldMemOperand(x3, JSFunction::kLiteralsOffset)); |
| 1782 // TODO(jbramley): Can these Operand constructors be implicit? | 1791 // TODO(jbramley): Can these Operand constructors be implicit? |
| 1783 __ Mov(x2, Operand(Smi::FromInt(expr->literal_index()))); | 1792 __ Mov(x2, Operand(Smi::FromInt(expr->literal_index()))); |
| 1784 __ Mov(x1, Operand(constant_elements)); | 1793 __ Mov(x1, Operand(constant_elements)); |
| 1785 if (has_fast_elements && constant_elements_values->map() == | 1794 if (has_fast_elements && constant_elements_values->map() == |
| 1786 isolate()->heap()->fixed_cow_array_map()) { | 1795 isolate()->heap()->fixed_cow_array_map()) { |
| 1787 FastCloneShallowArrayStub stub( | 1796 FastCloneShallowArrayStub stub( |
| 1788 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS, | 1797 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS, |
| 1789 DONT_TRACK_ALLOCATION_SITE, | 1798 allocation_site_mode, |
| 1790 length); | 1799 length); |
| 1791 __ CallStub(&stub); | 1800 __ CallStub(&stub); |
| 1792 __ IncrementCounter( | 1801 __ IncrementCounter( |
| 1793 isolate()->counters()->cow_arrays_created_stub(), 1, x10, x11); | 1802 isolate()->counters()->cow_arrays_created_stub(), 1, x10, x11); |
| 1794 } else if ((expr->depth() > 1) || Serializer::enabled() || | 1803 } else if ((expr->depth() > 1) || Serializer::enabled() || |
| 1795 length > FastCloneShallowArrayStub::kMaximumClonedLength) { | 1804 length > FastCloneShallowArrayStub::kMaximumClonedLength) { |
| 1796 __ Mov(x0, Operand(Smi::FromInt(flags))); | 1805 __ Mov(x0, Operand(Smi::FromInt(flags))); |
| 1797 __ Push(x3, x2, x1, x0); | 1806 __ Push(x3, x2, x1, x0); |
| 1798 __ CallRuntime(Runtime::kCreateArrayLiteral, 4); | 1807 __ CallRuntime(Runtime::kCreateArrayLiteral, 4); |
| 1799 } else { | 1808 } else { |
| 1800 ASSERT(IsFastSmiOrObjectElementsKind(constant_elements_kind) || | 1809 ASSERT(IsFastSmiOrObjectElementsKind(constant_elements_kind) || |
| 1801 FLAG_smi_only_arrays); | 1810 FLAG_smi_only_arrays); |
| 1802 FastCloneShallowArrayStub::Mode mode = | 1811 FastCloneShallowArrayStub::Mode mode = |
| 1803 FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS; | 1812 FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS; |
| 1804 AllocationSiteMode allocation_site_mode = FLAG_track_allocation_sites | |
| 1805 ? TRACK_ALLOCATION_SITE : DONT_TRACK_ALLOCATION_SITE; | |
| 1806 | 1813 |
| 1807 if (has_fast_elements) { | 1814 if (has_fast_elements) { |
| 1808 mode = FastCloneShallowArrayStub::CLONE_ELEMENTS; | 1815 mode = FastCloneShallowArrayStub::CLONE_ELEMENTS; |
| 1809 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE; | |
| 1810 } | 1816 } |
| 1811 | 1817 |
| 1812 FastCloneShallowArrayStub stub(mode, allocation_site_mode, length); | 1818 FastCloneShallowArrayStub stub(mode, allocation_site_mode, length); |
| 1813 __ CallStub(&stub); | 1819 __ CallStub(&stub); |
| 1814 } | 1820 } |
| 1815 | 1821 |
| 1816 bool result_saved = false; // Is the result saved to the stack? | 1822 bool result_saved = false; // Is the result saved to the stack? |
| 1817 | 1823 |
| 1818 // Emit code to evaluate all the non-constant subexpressions and to store | 1824 // Emit code to evaluate all the non-constant subexpressions and to store |
| 1819 // them into the newly cloned array. | 1825 // them into the newly cloned array. |
| (...skipping 3206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5026 return previous_; | 5032 return previous_; |
| 5027 } | 5033 } |
| 5028 | 5034 |
| 5029 | 5035 |
| 5030 #undef __ | 5036 #undef __ |
| 5031 | 5037 |
| 5032 | 5038 |
| 5033 } } // namespace v8::internal | 5039 } } // namespace v8::internal |
| 5034 | 5040 |
| 5035 #endif // V8_TARGET_ARCH_A64 | 5041 #endif // V8_TARGET_ARCH_A64 |
| OLD | NEW |