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 1806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1817 if (has_fast_elements && !FLAG_allocation_site_pretenuring) { | 1817 if (has_fast_elements && !FLAG_allocation_site_pretenuring) { |
1818 // If the only customer of allocation sites is transitioning, then | 1818 // If the only customer of allocation sites is transitioning, then |
1819 // we can turn it off if we don't have anywhere else to transition to. | 1819 // we can turn it off if we don't have anywhere else to transition to. |
1820 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE; | 1820 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE; |
1821 } | 1821 } |
1822 | 1822 |
1823 __ Ldr(x3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 1823 __ Ldr(x3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
1824 __ Ldr(x3, FieldMemOperand(x3, JSFunction::kLiteralsOffset)); | 1824 __ Ldr(x3, FieldMemOperand(x3, JSFunction::kLiteralsOffset)); |
1825 __ Mov(x2, Smi::FromInt(expr->literal_index())); | 1825 __ Mov(x2, Smi::FromInt(expr->literal_index())); |
1826 __ Mov(x1, Operand(constant_elements)); | 1826 __ Mov(x1, Operand(constant_elements)); |
1827 if (expr->depth() > 1) { | 1827 if (has_fast_elements && constant_elements_values->map() == |
| 1828 isolate()->heap()->fixed_cow_array_map()) { |
| 1829 FastCloneShallowArrayStub stub( |
| 1830 isolate(), |
| 1831 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS, |
| 1832 allocation_site_mode, |
| 1833 length); |
| 1834 __ CallStub(&stub); |
| 1835 __ IncrementCounter( |
| 1836 isolate()->counters()->cow_arrays_created_stub(), 1, x10, x11); |
| 1837 } else if ((expr->depth() > 1) || Serializer::enabled() || |
| 1838 length > FastCloneShallowArrayStub::kMaximumClonedLength) { |
1828 __ Mov(x0, Smi::FromInt(flags)); | 1839 __ Mov(x0, Smi::FromInt(flags)); |
1829 __ Push(x3, x2, x1, x0); | 1840 __ Push(x3, x2, x1, x0); |
1830 __ CallRuntime(Runtime::kHiddenCreateArrayLiteral, 4); | 1841 __ CallRuntime(Runtime::kHiddenCreateArrayLiteral, 4); |
1831 } else { | 1842 } else { |
1832 FastCloneShallowArrayStub stub(isolate(), allocation_site_mode); | 1843 ASSERT(IsFastSmiOrObjectElementsKind(constant_elements_kind) || |
| 1844 FLAG_smi_only_arrays); |
| 1845 FastCloneShallowArrayStub::Mode mode = |
| 1846 FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS; |
| 1847 |
| 1848 if (has_fast_elements) { |
| 1849 mode = FastCloneShallowArrayStub::CLONE_ELEMENTS; |
| 1850 } |
| 1851 |
| 1852 FastCloneShallowArrayStub stub(isolate(), |
| 1853 mode, |
| 1854 allocation_site_mode, |
| 1855 length); |
1833 __ CallStub(&stub); | 1856 __ CallStub(&stub); |
1834 } | 1857 } |
1835 | 1858 |
1836 bool result_saved = false; // Is the result saved to the stack? | 1859 bool result_saved = false; // Is the result saved to the stack? |
1837 | 1860 |
1838 // Emit code to evaluate all the non-constant subexpressions and to store | 1861 // Emit code to evaluate all the non-constant subexpressions and to store |
1839 // them into the newly cloned array. | 1862 // them into the newly cloned array. |
1840 for (int i = 0; i < length; i++) { | 1863 for (int i = 0; i < length; i++) { |
1841 Expression* subexpr = subexprs->at(i); | 1864 Expression* subexpr = subexprs->at(i); |
1842 // If the subexpression is a literal or a simple materialized literal it | 1865 // 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... |
4982 return previous_; | 5005 return previous_; |
4983 } | 5006 } |
4984 | 5007 |
4985 | 5008 |
4986 #undef __ | 5009 #undef __ |
4987 | 5010 |
4988 | 5011 |
4989 } } // namespace v8::internal | 5012 } } // namespace v8::internal |
4990 | 5013 |
4991 #endif // V8_TARGET_ARCH_ARM64 | 5014 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |