OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_ARM | 7 #if V8_TARGET_ARCH_ARM |
8 | 8 |
9 #include "code-stubs.h" | 9 #include "code-stubs.h" |
10 #include "codegen.h" | 10 #include "codegen.h" |
(...skipping 1774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1785 if (has_fast_elements && !FLAG_allocation_site_pretenuring) { | 1785 if (has_fast_elements && !FLAG_allocation_site_pretenuring) { |
1786 // If the only customer of allocation sites is transitioning, then | 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. | 1787 // we can turn it off if we don't have anywhere else to transition to. |
1788 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE; | 1788 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE; |
1789 } | 1789 } |
1790 | 1790 |
1791 __ ldr(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 1791 __ ldr(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
1792 __ ldr(r3, FieldMemOperand(r3, JSFunction::kLiteralsOffset)); | 1792 __ ldr(r3, FieldMemOperand(r3, JSFunction::kLiteralsOffset)); |
1793 __ mov(r2, Operand(Smi::FromInt(expr->literal_index()))); | 1793 __ mov(r2, Operand(Smi::FromInt(expr->literal_index()))); |
1794 __ mov(r1, Operand(constant_elements)); | 1794 __ mov(r1, Operand(constant_elements)); |
1795 if (expr->depth() > 1) { | 1795 if (has_fast_elements && constant_elements_values->map() == |
| 1796 isolate()->heap()->fixed_cow_array_map()) { |
| 1797 FastCloneShallowArrayStub stub( |
| 1798 isolate(), |
| 1799 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS, |
| 1800 allocation_site_mode, |
| 1801 length); |
| 1802 __ CallStub(&stub); |
| 1803 __ IncrementCounter( |
| 1804 isolate()->counters()->cow_arrays_created_stub(), 1, r1, r2); |
| 1805 } else if (expr->depth() > 1 || Serializer::enabled(isolate()) || |
| 1806 length > FastCloneShallowArrayStub::kMaximumClonedLength) { |
1796 __ mov(r0, Operand(Smi::FromInt(flags))); | 1807 __ mov(r0, Operand(Smi::FromInt(flags))); |
1797 __ Push(r3, r2, r1, r0); | 1808 __ Push(r3, r2, r1, r0); |
1798 __ CallRuntime(Runtime::kHiddenCreateArrayLiteral, 4); | 1809 __ CallRuntime(Runtime::kHiddenCreateArrayLiteral, 4); |
1799 } else { | 1810 } else { |
1800 FastCloneShallowArrayStub stub(isolate(), allocation_site_mode); | 1811 ASSERT(IsFastSmiOrObjectElementsKind(constant_elements_kind) || |
| 1812 FLAG_smi_only_arrays); |
| 1813 FastCloneShallowArrayStub::Mode mode = |
| 1814 FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS; |
| 1815 |
| 1816 if (has_fast_elements) { |
| 1817 mode = FastCloneShallowArrayStub::CLONE_ELEMENTS; |
| 1818 } |
| 1819 |
| 1820 FastCloneShallowArrayStub stub(isolate(), mode, allocation_site_mode, |
| 1821 length); |
1801 __ CallStub(&stub); | 1822 __ CallStub(&stub); |
1802 } | 1823 } |
1803 | 1824 |
1804 bool result_saved = false; // Is the result saved to the stack? | 1825 bool result_saved = false; // Is the result saved to the stack? |
1805 | 1826 |
1806 // Emit code to evaluate all the non-constant subexpressions and to store | 1827 // Emit code to evaluate all the non-constant subexpressions and to store |
1807 // them into the newly cloned array. | 1828 // them into the newly cloned array. |
1808 for (int i = 0; i < length; i++) { | 1829 for (int i = 0; i < length; i++) { |
1809 Expression* subexpr = subexprs->at(i); | 1830 Expression* subexpr = subexprs->at(i); |
1810 // If the subexpression is a literal or a simple materialized literal it | 1831 // If the subexpression is a literal or a simple materialized literal it |
(...skipping 3010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4821 | 4842 |
4822 ASSERT(interrupt_address == | 4843 ASSERT(interrupt_address == |
4823 isolate->builtins()->OsrAfterStackCheck()->entry()); | 4844 isolate->builtins()->OsrAfterStackCheck()->entry()); |
4824 return OSR_AFTER_STACK_CHECK; | 4845 return OSR_AFTER_STACK_CHECK; |
4825 } | 4846 } |
4826 | 4847 |
4827 | 4848 |
4828 } } // namespace v8::internal | 4849 } } // namespace v8::internal |
4829 | 4850 |
4830 #endif // V8_TARGET_ARCH_ARM | 4851 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |