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 1766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1777 ZoneList<Expression*>* subexprs = expr->values(); | 1777 ZoneList<Expression*>* subexprs = expr->values(); |
1778 int length = subexprs->length(); | 1778 int length = subexprs->length(); |
1779 Handle<FixedArray> constant_elements = expr->constant_elements(); | 1779 Handle<FixedArray> constant_elements = expr->constant_elements(); |
1780 ASSERT_EQ(2, constant_elements->length()); | 1780 ASSERT_EQ(2, constant_elements->length()); |
1781 ElementsKind constant_elements_kind = | 1781 ElementsKind constant_elements_kind = |
1782 static_cast<ElementsKind>(Smi::cast(constant_elements->get(0))->value()); | 1782 static_cast<ElementsKind>(Smi::cast(constant_elements->get(0))->value()); |
1783 bool has_fast_elements = IsFastObjectElementsKind(constant_elements_kind); | 1783 bool has_fast_elements = IsFastObjectElementsKind(constant_elements_kind); |
1784 Handle<FixedArrayBase> constant_elements_values( | 1784 Handle<FixedArrayBase> constant_elements_values( |
1785 FixedArrayBase::cast(constant_elements->get(1))); | 1785 FixedArrayBase::cast(constant_elements->get(1))); |
1786 | 1786 |
| 1787 AllocationSiteMode allocation_site_mode = FLAG_track_allocation_sites |
| 1788 ? TRACK_ALLOCATION_SITE : DONT_TRACK_ALLOCATION_SITE; |
| 1789 if (has_constant_fast_elements && !FLAG_allocation_site_pretenuring) { |
| 1790 // If the only customer of allocation sites is transitioning, then |
| 1791 // we can turn it off if we don't have anywhere else to transition to. |
| 1792 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE; |
| 1793 } |
| 1794 |
1787 __ ldr(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 1795 __ ldr(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
1788 __ ldr(r3, FieldMemOperand(r3, JSFunction::kLiteralsOffset)); | 1796 __ ldr(r3, FieldMemOperand(r3, JSFunction::kLiteralsOffset)); |
1789 __ mov(r2, Operand(Smi::FromInt(expr->literal_index()))); | 1797 __ mov(r2, Operand(Smi::FromInt(expr->literal_index()))); |
1790 __ mov(r1, Operand(constant_elements)); | 1798 __ mov(r1, Operand(constant_elements)); |
1791 if (has_fast_elements && constant_elements_values->map() == | 1799 if (has_fast_elements && constant_elements_values->map() == |
1792 isolate()->heap()->fixed_cow_array_map()) { | 1800 isolate()->heap()->fixed_cow_array_map()) { |
1793 FastCloneShallowArrayStub stub( | 1801 FastCloneShallowArrayStub stub( |
1794 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS, | 1802 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS, |
1795 DONT_TRACK_ALLOCATION_SITE, | 1803 allocation_site_mode, |
1796 length); | 1804 length); |
1797 __ CallStub(&stub); | 1805 __ CallStub(&stub); |
1798 __ IncrementCounter( | 1806 __ IncrementCounter( |
1799 isolate()->counters()->cow_arrays_created_stub(), 1, r1, r2); | 1807 isolate()->counters()->cow_arrays_created_stub(), 1, r1, r2); |
1800 } else if (expr->depth() > 1 || Serializer::enabled() || | 1808 } else if (expr->depth() > 1 || Serializer::enabled() || |
1801 length > FastCloneShallowArrayStub::kMaximumClonedLength) { | 1809 length > FastCloneShallowArrayStub::kMaximumClonedLength) { |
1802 __ mov(r0, Operand(Smi::FromInt(flags))); | 1810 __ mov(r0, Operand(Smi::FromInt(flags))); |
1803 __ Push(r3, r2, r1, r0); | 1811 __ Push(r3, r2, r1, r0); |
1804 __ CallRuntime(Runtime::kCreateArrayLiteral, 4); | 1812 __ CallRuntime(Runtime::kCreateArrayLiteral, 4); |
1805 } else { | 1813 } else { |
1806 ASSERT(IsFastSmiOrObjectElementsKind(constant_elements_kind) || | 1814 ASSERT(IsFastSmiOrObjectElementsKind(constant_elements_kind) || |
1807 FLAG_smi_only_arrays); | 1815 FLAG_smi_only_arrays); |
1808 FastCloneShallowArrayStub::Mode mode = | 1816 FastCloneShallowArrayStub::Mode mode = |
1809 FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS; | 1817 FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS; |
1810 AllocationSiteMode allocation_site_mode = FLAG_track_allocation_sites | |
1811 ? TRACK_ALLOCATION_SITE : DONT_TRACK_ALLOCATION_SITE; | |
1812 | 1818 |
1813 if (has_fast_elements) { | 1819 if (has_fast_elements) { |
1814 mode = FastCloneShallowArrayStub::CLONE_ELEMENTS; | 1820 mode = FastCloneShallowArrayStub::CLONE_ELEMENTS; |
1815 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE; | |
1816 } | 1821 } |
1817 | 1822 |
1818 FastCloneShallowArrayStub stub(mode, allocation_site_mode, length); | 1823 FastCloneShallowArrayStub stub(mode, allocation_site_mode, length); |
1819 __ CallStub(&stub); | 1824 __ CallStub(&stub); |
1820 } | 1825 } |
1821 | 1826 |
1822 bool result_saved = false; // Is the result saved to the stack? | 1827 bool result_saved = false; // Is the result saved to the stack? |
1823 | 1828 |
1824 // Emit code to evaluate all the non-constant subexpressions and to store | 1829 // Emit code to evaluate all the non-constant subexpressions and to store |
1825 // them into the newly cloned array. | 1830 // them into the newly cloned array. |
(...skipping 3098 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4924 ASSERT(Memory::uint32_at(interrupt_address_pointer) == | 4929 ASSERT(Memory::uint32_at(interrupt_address_pointer) == |
4925 reinterpret_cast<uint32_t>( | 4930 reinterpret_cast<uint32_t>( |
4926 isolate->builtins()->OsrAfterStackCheck()->entry())); | 4931 isolate->builtins()->OsrAfterStackCheck()->entry())); |
4927 return OSR_AFTER_STACK_CHECK; | 4932 return OSR_AFTER_STACK_CHECK; |
4928 } | 4933 } |
4929 | 4934 |
4930 | 4935 |
4931 } } // namespace v8::internal | 4936 } } // namespace v8::internal |
4932 | 4937 |
4933 #endif // V8_TARGET_ARCH_ARM | 4938 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |