| 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 1723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1734 int length = subexprs->length(); | 1734 int length = subexprs->length(); |
| 1735 Handle<FixedArray> constant_elements = expr->constant_elements(); | 1735 Handle<FixedArray> constant_elements = expr->constant_elements(); |
| 1736 ASSERT_EQ(2, constant_elements->length()); | 1736 ASSERT_EQ(2, constant_elements->length()); |
| 1737 ElementsKind constant_elements_kind = | 1737 ElementsKind constant_elements_kind = |
| 1738 static_cast<ElementsKind>(Smi::cast(constant_elements->get(0))->value()); | 1738 static_cast<ElementsKind>(Smi::cast(constant_elements->get(0))->value()); |
| 1739 bool has_constant_fast_elements = | 1739 bool has_constant_fast_elements = |
| 1740 IsFastObjectElementsKind(constant_elements_kind); | 1740 IsFastObjectElementsKind(constant_elements_kind); |
| 1741 Handle<FixedArrayBase> constant_elements_values( | 1741 Handle<FixedArrayBase> constant_elements_values( |
| 1742 FixedArrayBase::cast(constant_elements->get(1))); | 1742 FixedArrayBase::cast(constant_elements->get(1))); |
| 1743 | 1743 |
| 1744 AllocationSiteMode allocation_site_mode = FLAG_track_allocation_sites |
| 1745 ? TRACK_ALLOCATION_SITE : DONT_TRACK_ALLOCATION_SITE; |
| 1746 if (has_constant_fast_elements && !FLAG_allocation_site_pretenuring) { |
| 1747 // If the only customer of allocation sites is transitioning, then |
| 1748 // we can turn it off if we don't have anywhere else to transition to. |
| 1749 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE; |
| 1750 } |
| 1751 |
| 1744 Heap* heap = isolate()->heap(); | 1752 Heap* heap = isolate()->heap(); |
| 1745 if (has_constant_fast_elements && | 1753 if (has_constant_fast_elements && |
| 1746 constant_elements_values->map() == heap->fixed_cow_array_map()) { | 1754 constant_elements_values->map() == heap->fixed_cow_array_map()) { |
| 1747 // If the elements are already FAST_*_ELEMENTS, the boilerplate cannot | 1755 // If the elements are already FAST_*_ELEMENTS, the boilerplate cannot |
| 1748 // change, so it's possible to specialize the stub in advance. | 1756 // change, so it's possible to specialize the stub in advance. |
| 1749 __ IncrementCounter(isolate()->counters()->cow_arrays_created_stub(), 1); | 1757 __ IncrementCounter(isolate()->counters()->cow_arrays_created_stub(), 1); |
| 1750 __ movq(rbx, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); | 1758 __ movq(rbx, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); |
| 1751 __ movq(rax, FieldOperand(rbx, JSFunction::kLiteralsOffset)); | 1759 __ movq(rax, FieldOperand(rbx, JSFunction::kLiteralsOffset)); |
| 1752 __ Move(rbx, Smi::FromInt(expr->literal_index())); | 1760 __ Move(rbx, Smi::FromInt(expr->literal_index())); |
| 1753 __ Move(rcx, constant_elements); | 1761 __ Move(rcx, constant_elements); |
| 1754 FastCloneShallowArrayStub stub( | 1762 FastCloneShallowArrayStub stub( |
| 1755 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS, | 1763 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS, |
| 1756 DONT_TRACK_ALLOCATION_SITE, | 1764 allocation_site_mode, |
| 1757 length); | 1765 length); |
| 1758 __ CallStub(&stub); | 1766 __ CallStub(&stub); |
| 1759 } else if (expr->depth() > 1 || Serializer::enabled() || | 1767 } else if (expr->depth() > 1 || Serializer::enabled() || |
| 1760 length > FastCloneShallowArrayStub::kMaximumClonedLength) { | 1768 length > FastCloneShallowArrayStub::kMaximumClonedLength) { |
| 1761 __ movq(rbx, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); | 1769 __ movq(rbx, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); |
| 1762 __ push(FieldOperand(rbx, JSFunction::kLiteralsOffset)); | 1770 __ push(FieldOperand(rbx, JSFunction::kLiteralsOffset)); |
| 1763 __ Push(Smi::FromInt(expr->literal_index())); | 1771 __ Push(Smi::FromInt(expr->literal_index())); |
| 1764 __ Push(constant_elements); | 1772 __ Push(constant_elements); |
| 1765 __ Push(Smi::FromInt(flags)); | 1773 __ Push(Smi::FromInt(flags)); |
| 1766 __ CallRuntime(Runtime::kCreateArrayLiteral, 4); | 1774 __ CallRuntime(Runtime::kCreateArrayLiteral, 4); |
| 1767 } else { | 1775 } else { |
| 1768 ASSERT(IsFastSmiOrObjectElementsKind(constant_elements_kind) || | 1776 ASSERT(IsFastSmiOrObjectElementsKind(constant_elements_kind) || |
| 1769 FLAG_smi_only_arrays); | 1777 FLAG_smi_only_arrays); |
| 1770 FastCloneShallowArrayStub::Mode mode = | 1778 FastCloneShallowArrayStub::Mode mode = |
| 1771 FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS; | 1779 FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS; |
| 1772 AllocationSiteMode allocation_site_mode = FLAG_track_allocation_sites | |
| 1773 ? TRACK_ALLOCATION_SITE : DONT_TRACK_ALLOCATION_SITE; | |
| 1774 | 1780 |
| 1775 // If the elements are already FAST_*_ELEMENTS, the boilerplate cannot | 1781 // If the elements are already FAST_*_ELEMENTS, the boilerplate cannot |
| 1776 // change, so it's possible to specialize the stub in advance. | 1782 // change, so it's possible to specialize the stub in advance. |
| 1777 if (has_constant_fast_elements) { | 1783 if (has_constant_fast_elements) { |
| 1778 mode = FastCloneShallowArrayStub::CLONE_ELEMENTS; | 1784 mode = FastCloneShallowArrayStub::CLONE_ELEMENTS; |
| 1779 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE; | |
| 1780 } | 1785 } |
| 1781 | 1786 |
| 1782 __ movq(rbx, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); | 1787 __ movq(rbx, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); |
| 1783 __ movq(rax, FieldOperand(rbx, JSFunction::kLiteralsOffset)); | 1788 __ movq(rax, FieldOperand(rbx, JSFunction::kLiteralsOffset)); |
| 1784 __ Move(rbx, Smi::FromInt(expr->literal_index())); | 1789 __ Move(rbx, Smi::FromInt(expr->literal_index())); |
| 1785 __ Move(rcx, constant_elements); | 1790 __ Move(rcx, constant_elements); |
| 1786 FastCloneShallowArrayStub stub(mode, allocation_site_mode, length); | 1791 FastCloneShallowArrayStub stub(mode, allocation_site_mode, length); |
| 1787 __ CallStub(&stub); | 1792 __ CallStub(&stub); |
| 1788 } | 1793 } |
| 1789 | 1794 |
| (...skipping 3111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4901 | 4906 |
| 4902 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 4907 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
| 4903 Assembler::target_address_at(call_target_address)); | 4908 Assembler::target_address_at(call_target_address)); |
| 4904 return OSR_AFTER_STACK_CHECK; | 4909 return OSR_AFTER_STACK_CHECK; |
| 4905 } | 4910 } |
| 4906 | 4911 |
| 4907 | 4912 |
| 4908 } } // namespace v8::internal | 4913 } } // namespace v8::internal |
| 4909 | 4914 |
| 4910 #endif // V8_TARGET_ARCH_X64 | 4915 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |