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 1762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1773 ZoneList<Expression*>* subexprs = expr->values(); | 1773 ZoneList<Expression*>* subexprs = expr->values(); |
1774 int length = subexprs->length(); | 1774 int length = subexprs->length(); |
1775 Handle<FixedArray> constant_elements = expr->constant_elements(); | 1775 Handle<FixedArray> constant_elements = expr->constant_elements(); |
1776 ASSERT_EQ(2, constant_elements->length()); | 1776 ASSERT_EQ(2, constant_elements->length()); |
1777 ElementsKind constant_elements_kind = | 1777 ElementsKind constant_elements_kind = |
1778 static_cast<ElementsKind>(Smi::cast(constant_elements->get(0))->value()); | 1778 static_cast<ElementsKind>(Smi::cast(constant_elements->get(0))->value()); |
1779 bool has_fast_elements = IsFastObjectElementsKind(constant_elements_kind); | 1779 bool has_fast_elements = IsFastObjectElementsKind(constant_elements_kind); |
1780 Handle<FixedArrayBase> constant_elements_values( | 1780 Handle<FixedArrayBase> constant_elements_values( |
1781 FixedArrayBase::cast(constant_elements->get(1))); | 1781 FixedArrayBase::cast(constant_elements->get(1))); |
1782 | 1782 |
| 1783 AllocationSiteMode allocation_site_mode = FLAG_track_allocation_sites |
| 1784 ? TRACK_ALLOCATION_SITE : DONT_TRACK_ALLOCATION_SITE; |
| 1785 if (has_constant_fast_elements && !FLAG_allocation_site_pretenuring) { |
| 1786 // If the only customer of allocation sites is transitioning, then |
| 1787 // we can turn it off if we don't have anywhere else to transition to. |
| 1788 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE; |
| 1789 } |
| 1790 |
1783 __ ldr(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 1791 __ ldr(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
1784 __ ldr(r3, FieldMemOperand(r3, JSFunction::kLiteralsOffset)); | 1792 __ ldr(r3, FieldMemOperand(r3, JSFunction::kLiteralsOffset)); |
1785 __ mov(r2, Operand(Smi::FromInt(expr->literal_index()))); | 1793 __ mov(r2, Operand(Smi::FromInt(expr->literal_index()))); |
1786 __ mov(r1, Operand(constant_elements)); | 1794 __ mov(r1, Operand(constant_elements)); |
1787 if (has_fast_elements && constant_elements_values->map() == | 1795 if (has_fast_elements && constant_elements_values->map() == |
1788 isolate()->heap()->fixed_cow_array_map()) { | 1796 isolate()->heap()->fixed_cow_array_map()) { |
1789 FastCloneShallowArrayStub stub( | 1797 FastCloneShallowArrayStub stub( |
1790 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS, | 1798 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS, |
1791 DONT_TRACK_ALLOCATION_SITE, | 1799 allocation_site_mode, |
1792 length); | 1800 length); |
1793 __ CallStub(&stub); | 1801 __ CallStub(&stub); |
1794 __ IncrementCounter( | 1802 __ IncrementCounter( |
1795 isolate()->counters()->cow_arrays_created_stub(), 1, r1, r2); | 1803 isolate()->counters()->cow_arrays_created_stub(), 1, r1, r2); |
1796 } else if (expr->depth() > 1 || Serializer::enabled() || | 1804 } else if (expr->depth() > 1 || Serializer::enabled() || |
1797 length > FastCloneShallowArrayStub::kMaximumClonedLength) { | 1805 length > FastCloneShallowArrayStub::kMaximumClonedLength) { |
1798 __ Push(r3, r2, r1); | 1806 __ Push(r3, r2, r1); |
1799 __ CallRuntime(Runtime::kCreateArrayLiteral, 3); | 1807 __ CallRuntime(Runtime::kCreateArrayLiteral, 3); |
1800 } else { | 1808 } else { |
1801 ASSERT(IsFastSmiOrObjectElementsKind(constant_elements_kind) || | 1809 ASSERT(IsFastSmiOrObjectElementsKind(constant_elements_kind) || |
1802 FLAG_smi_only_arrays); | 1810 FLAG_smi_only_arrays); |
1803 FastCloneShallowArrayStub::Mode mode = | 1811 FastCloneShallowArrayStub::Mode mode = |
1804 FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS; | 1812 FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS; |
1805 AllocationSiteMode allocation_site_mode = FLAG_track_allocation_sites | |
1806 ? TRACK_ALLOCATION_SITE : DONT_TRACK_ALLOCATION_SITE; | |
1807 | 1813 |
1808 if (has_fast_elements) { | 1814 if (has_fast_elements) { |
1809 mode = FastCloneShallowArrayStub::CLONE_ELEMENTS; | 1815 mode = FastCloneShallowArrayStub::CLONE_ELEMENTS; |
1810 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE; | |
1811 } | 1816 } |
1812 | 1817 |
1813 FastCloneShallowArrayStub stub(mode, allocation_site_mode, length); | 1818 FastCloneShallowArrayStub stub(mode, allocation_site_mode, length); |
1814 __ CallStub(&stub); | 1819 __ CallStub(&stub); |
1815 } | 1820 } |
1816 | 1821 |
1817 bool result_saved = false; // Is the result saved to the stack? | 1822 bool result_saved = false; // Is the result saved to the stack? |
1818 | 1823 |
1819 // 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 |
1820 // them into the newly cloned array. | 1825 // them into the newly cloned array. |
(...skipping 3142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4963 ASSERT(Memory::uint32_at(interrupt_address_pointer) == | 4968 ASSERT(Memory::uint32_at(interrupt_address_pointer) == |
4964 reinterpret_cast<uint32_t>( | 4969 reinterpret_cast<uint32_t>( |
4965 isolate->builtins()->OsrAfterStackCheck()->entry())); | 4970 isolate->builtins()->OsrAfterStackCheck()->entry())); |
4966 return OSR_AFTER_STACK_CHECK; | 4971 return OSR_AFTER_STACK_CHECK; |
4967 } | 4972 } |
4968 | 4973 |
4969 | 4974 |
4970 } } // namespace v8::internal | 4975 } } // namespace v8::internal |
4971 | 4976 |
4972 #endif // V8_TARGET_ARCH_ARM | 4977 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |