| 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 1740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1751 Handle<FixedArrayBase> constant_elements_values( | 1751 Handle<FixedArrayBase> constant_elements_values( |
| 1752 FixedArrayBase::cast(constant_elements->get(1))); | 1752 FixedArrayBase::cast(constant_elements->get(1))); |
| 1753 | 1753 |
| 1754 AllocationSiteMode allocation_site_mode = TRACK_ALLOCATION_SITE; | 1754 AllocationSiteMode allocation_site_mode = TRACK_ALLOCATION_SITE; |
| 1755 if (has_constant_fast_elements && !FLAG_allocation_site_pretenuring) { | 1755 if (has_constant_fast_elements && !FLAG_allocation_site_pretenuring) { |
| 1756 // If the only customer of allocation sites is transitioning, then | 1756 // If the only customer of allocation sites is transitioning, then |
| 1757 // we can turn it off if we don't have anywhere else to transition to. | 1757 // we can turn it off if we don't have anywhere else to transition to. |
| 1758 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE; | 1758 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE; |
| 1759 } | 1759 } |
| 1760 | 1760 |
| 1761 Heap* heap = isolate()->heap(); | 1761 if (expr->depth() > 1) { |
| 1762 if (has_constant_fast_elements && | |
| 1763 constant_elements_values->map() == heap->fixed_cow_array_map()) { | |
| 1764 // If the elements are already FAST_*_ELEMENTS, the boilerplate cannot | |
| 1765 // change, so it's possible to specialize the stub in advance. | |
| 1766 __ IncrementCounter(isolate()->counters()->cow_arrays_created_stub(), 1); | |
| 1767 __ mov(ebx, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); | |
| 1768 __ mov(eax, FieldOperand(ebx, JSFunction::kLiteralsOffset)); | |
| 1769 __ mov(ebx, Immediate(Smi::FromInt(expr->literal_index()))); | |
| 1770 __ mov(ecx, Immediate(constant_elements)); | |
| 1771 FastCloneShallowArrayStub stub( | |
| 1772 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS, | |
| 1773 allocation_site_mode, | |
| 1774 length); | |
| 1775 __ CallStub(&stub); | |
| 1776 } else if (expr->depth() > 1 || Serializer::enabled() || | |
| 1777 length > FastCloneShallowArrayStub::kMaximumClonedLength) { | |
| 1778 __ mov(ebx, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); | 1762 __ mov(ebx, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); |
| 1779 __ push(FieldOperand(ebx, JSFunction::kLiteralsOffset)); | 1763 __ push(FieldOperand(ebx, JSFunction::kLiteralsOffset)); |
| 1780 __ push(Immediate(Smi::FromInt(expr->literal_index()))); | 1764 __ push(Immediate(Smi::FromInt(expr->literal_index()))); |
| 1781 __ push(Immediate(constant_elements)); | 1765 __ push(Immediate(constant_elements)); |
| 1782 __ push(Immediate(Smi::FromInt(flags))); | 1766 __ push(Immediate(Smi::FromInt(flags))); |
| 1783 __ CallRuntime(Runtime::kHiddenCreateArrayLiteral, 4); | 1767 __ CallRuntime(Runtime::kHiddenCreateArrayLiteral, 4); |
| 1784 } else { | 1768 } else { |
| 1785 ASSERT(IsFastSmiOrObjectElementsKind(constant_elements_kind) || | |
| 1786 FLAG_smi_only_arrays); | |
| 1787 FastCloneShallowArrayStub::Mode mode = | |
| 1788 FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS; | |
| 1789 | |
| 1790 // If the elements are already FAST_*_ELEMENTS, the boilerplate cannot | |
| 1791 // change, so it's possible to specialize the stub in advance. | |
| 1792 if (has_constant_fast_elements) { | |
| 1793 mode = FastCloneShallowArrayStub::CLONE_ELEMENTS; | |
| 1794 } | |
| 1795 | |
| 1796 __ mov(ebx, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); | 1769 __ mov(ebx, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); |
| 1797 __ mov(eax, FieldOperand(ebx, JSFunction::kLiteralsOffset)); | 1770 __ mov(eax, FieldOperand(ebx, JSFunction::kLiteralsOffset)); |
| 1798 __ mov(ebx, Immediate(Smi::FromInt(expr->literal_index()))); | 1771 __ mov(ebx, Immediate(Smi::FromInt(expr->literal_index()))); |
| 1799 __ mov(ecx, Immediate(constant_elements)); | 1772 __ mov(ecx, Immediate(constant_elements)); |
| 1800 FastCloneShallowArrayStub stub(mode, allocation_site_mode, length); | 1773 FastCloneShallowArrayStub stub(allocation_site_mode); |
| 1801 __ CallStub(&stub); | 1774 __ CallStub(&stub); |
| 1802 } | 1775 } |
| 1803 | 1776 |
| 1804 bool result_saved = false; // Is the result saved to the stack? | 1777 bool result_saved = false; // Is the result saved to the stack? |
| 1805 | 1778 |
| 1806 // Emit code to evaluate all the non-constant subexpressions and to store | 1779 // Emit code to evaluate all the non-constant subexpressions and to store |
| 1807 // them into the newly cloned array. | 1780 // them into the newly cloned array. |
| 1808 for (int i = 0; i < length; i++) { | 1781 for (int i = 0; i < length; i++) { |
| 1809 Expression* subexpr = subexprs->at(i); | 1782 Expression* subexpr = subexprs->at(i); |
| 1810 // If the subexpression is a literal or a simple materialized literal it | 1783 // If the subexpression is a literal or a simple materialized literal it |
| (...skipping 3108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4919 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 4892 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
| 4920 Assembler::target_address_at(call_target_address, | 4893 Assembler::target_address_at(call_target_address, |
| 4921 unoptimized_code)); | 4894 unoptimized_code)); |
| 4922 return OSR_AFTER_STACK_CHECK; | 4895 return OSR_AFTER_STACK_CHECK; |
| 4923 } | 4896 } |
| 4924 | 4897 |
| 4925 | 4898 |
| 4926 } } // namespace v8::internal | 4899 } } // namespace v8::internal |
| 4927 | 4900 |
| 4928 #endif // V8_TARGET_ARCH_IA32 | 4901 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |