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 1799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1810 if (has_fast_elements && !FLAG_allocation_site_pretenuring) { | 1810 if (has_fast_elements && !FLAG_allocation_site_pretenuring) { |
1811 // If the only customer of allocation sites is transitioning, then | 1811 // If the only customer of allocation sites is transitioning, then |
1812 // we can turn it off if we don't have anywhere else to transition to. | 1812 // we can turn it off if we don't have anywhere else to transition to. |
1813 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE; | 1813 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE; |
1814 } | 1814 } |
1815 | 1815 |
1816 __ Ldr(x3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 1816 __ Ldr(x3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
1817 __ Ldr(x3, FieldMemOperand(x3, JSFunction::kLiteralsOffset)); | 1817 __ Ldr(x3, FieldMemOperand(x3, JSFunction::kLiteralsOffset)); |
1818 __ Mov(x2, Smi::FromInt(expr->literal_index())); | 1818 __ Mov(x2, Smi::FromInt(expr->literal_index())); |
1819 __ Mov(x1, Operand(constant_elements)); | 1819 __ Mov(x1, Operand(constant_elements)); |
1820 if (has_fast_elements && constant_elements_values->map() == | 1820 if (expr->depth() > 1) { |
1821 isolate()->heap()->fixed_cow_array_map()) { | |
1822 FastCloneShallowArrayStub stub( | |
1823 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS, | |
1824 allocation_site_mode, | |
1825 length); | |
1826 __ CallStub(&stub); | |
1827 __ IncrementCounter( | |
1828 isolate()->counters()->cow_arrays_created_stub(), 1, x10, x11); | |
1829 } else if ((expr->depth() > 1) || Serializer::enabled() || | |
1830 length > FastCloneShallowArrayStub::kMaximumClonedLength) { | |
1831 __ Mov(x0, Smi::FromInt(flags)); | 1821 __ Mov(x0, Smi::FromInt(flags)); |
1832 __ Push(x3, x2, x1, x0); | 1822 __ Push(x3, x2, x1, x0); |
1833 __ CallRuntime(Runtime::kHiddenCreateArrayLiteral, 4); | 1823 __ CallRuntime(Runtime::kHiddenCreateArrayLiteral, 4); |
1834 } else { | 1824 } else { |
1835 ASSERT(IsFastSmiOrObjectElementsKind(constant_elements_kind) || | 1825 FastCloneShallowArrayStub stub(allocation_site_mode); |
1836 FLAG_smi_only_arrays); | |
1837 FastCloneShallowArrayStub::Mode mode = | |
1838 FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS; | |
1839 | |
1840 if (has_fast_elements) { | |
1841 mode = FastCloneShallowArrayStub::CLONE_ELEMENTS; | |
1842 } | |
1843 | |
1844 FastCloneShallowArrayStub stub(mode, allocation_site_mode, length); | |
1845 __ CallStub(&stub); | 1826 __ CallStub(&stub); |
1846 } | 1827 } |
1847 | 1828 |
1848 bool result_saved = false; // Is the result saved to the stack? | 1829 bool result_saved = false; // Is the result saved to the stack? |
1849 | 1830 |
1850 // Emit code to evaluate all the non-constant subexpressions and to store | 1831 // Emit code to evaluate all the non-constant subexpressions and to store |
1851 // them into the newly cloned array. | 1832 // them into the newly cloned array. |
1852 for (int i = 0; i < length; i++) { | 1833 for (int i = 0; i < length; i++) { |
1853 Expression* subexpr = subexprs->at(i); | 1834 Expression* subexpr = subexprs->at(i); |
1854 // If the subexpression is a literal or a simple materialized literal it | 1835 // If the subexpression is a literal or a simple materialized literal it |
(...skipping 3139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4994 return previous_; | 4975 return previous_; |
4995 } | 4976 } |
4996 | 4977 |
4997 | 4978 |
4998 #undef __ | 4979 #undef __ |
4999 | 4980 |
5000 | 4981 |
5001 } } // namespace v8::internal | 4982 } } // namespace v8::internal |
5002 | 4983 |
5003 #endif // V8_TARGET_ARCH_ARM64 | 4984 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |