OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "v8.h" | 5 #include "v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_ARM64 | 7 #if V8_TARGET_ARCH_ARM64 |
8 | 8 |
9 #include "code-stubs.h" | 9 #include "code-stubs.h" |
10 #include "codegen.h" | 10 #include "codegen.h" |
(...skipping 1777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1788 if (has_fast_elements && !FLAG_allocation_site_pretenuring) { | 1788 if (has_fast_elements && !FLAG_allocation_site_pretenuring) { |
1789 // If the only customer of allocation sites is transitioning, then | 1789 // If the only customer of allocation sites is transitioning, then |
1790 // we can turn it off if we don't have anywhere else to transition to. | 1790 // we can turn it off if we don't have anywhere else to transition to. |
1791 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE; | 1791 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE; |
1792 } | 1792 } |
1793 | 1793 |
1794 __ Ldr(x3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 1794 __ Ldr(x3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
1795 __ Ldr(x3, FieldMemOperand(x3, JSFunction::kLiteralsOffset)); | 1795 __ Ldr(x3, FieldMemOperand(x3, JSFunction::kLiteralsOffset)); |
1796 __ Mov(x2, Smi::FromInt(expr->literal_index())); | 1796 __ Mov(x2, Smi::FromInt(expr->literal_index())); |
1797 __ Mov(x1, Operand(constant_elements)); | 1797 __ Mov(x1, Operand(constant_elements)); |
1798 if (expr->depth() > 1) { | 1798 if (has_fast_elements && constant_elements_values->map() == |
| 1799 isolate()->heap()->fixed_cow_array_map()) { |
| 1800 FastCloneShallowArrayStub stub( |
| 1801 isolate(), |
| 1802 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS, |
| 1803 allocation_site_mode, |
| 1804 length); |
| 1805 __ CallStub(&stub); |
| 1806 __ IncrementCounter( |
| 1807 isolate()->counters()->cow_arrays_created_stub(), 1, x10, x11); |
| 1808 } else if ((expr->depth() > 1) || Serializer::enabled(isolate()) || |
| 1809 length > FastCloneShallowArrayStub::kMaximumClonedLength) { |
1799 __ Mov(x0, Smi::FromInt(flags)); | 1810 __ Mov(x0, Smi::FromInt(flags)); |
1800 __ Push(x3, x2, x1, x0); | 1811 __ Push(x3, x2, x1, x0); |
1801 __ CallRuntime(Runtime::kHiddenCreateArrayLiteral, 4); | 1812 __ CallRuntime(Runtime::kHiddenCreateArrayLiteral, 4); |
1802 } else { | 1813 } else { |
1803 FastCloneShallowArrayStub stub(isolate(), allocation_site_mode); | 1814 ASSERT(IsFastSmiOrObjectElementsKind(constant_elements_kind) || |
| 1815 FLAG_smi_only_arrays); |
| 1816 FastCloneShallowArrayStub::Mode mode = |
| 1817 FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS; |
| 1818 |
| 1819 if (has_fast_elements) { |
| 1820 mode = FastCloneShallowArrayStub::CLONE_ELEMENTS; |
| 1821 } |
| 1822 |
| 1823 FastCloneShallowArrayStub stub(isolate(), |
| 1824 mode, |
| 1825 allocation_site_mode, |
| 1826 length); |
1804 __ CallStub(&stub); | 1827 __ CallStub(&stub); |
1805 } | 1828 } |
1806 | 1829 |
1807 bool result_saved = false; // Is the result saved to the stack? | 1830 bool result_saved = false; // Is the result saved to the stack? |
1808 | 1831 |
1809 // Emit code to evaluate all the non-constant subexpressions and to store | 1832 // Emit code to evaluate all the non-constant subexpressions and to store |
1810 // them into the newly cloned array. | 1833 // them into the newly cloned array. |
1811 for (int i = 0; i < length; i++) { | 1834 for (int i = 0; i < length; i++) { |
1812 Expression* subexpr = subexprs->at(i); | 1835 Expression* subexpr = subexprs->at(i); |
1813 // If the subexpression is a literal or a simple materialized literal it | 1836 // If the subexpression is a literal or a simple materialized literal it |
(...skipping 3072 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4886 return previous_; | 4909 return previous_; |
4887 } | 4910 } |
4888 | 4911 |
4889 | 4912 |
4890 #undef __ | 4913 #undef __ |
4891 | 4914 |
4892 | 4915 |
4893 } } // namespace v8::internal | 4916 } } // namespace v8::internal |
4894 | 4917 |
4895 #endif // V8_TARGET_ARCH_ARM64 | 4918 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |