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