Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(474)

Side by Side Diff: src/x64/full-codegen-x64.cc

Issue 272243002: Revert "Reland r20974: Unify and simplify the FastCloneShallowArrayStub" (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/x64/code-stubs-x64.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_X64 7 #if V8_TARGET_ARCH_X64
8 8
9 #include "code-stubs.h" 9 #include "code-stubs.h"
10 #include "codegen.h" 10 #include "codegen.h"
(...skipping 1748 matching lines...) Expand 10 before | Expand all | Expand 10 after
1759 Handle<FixedArrayBase> constant_elements_values( 1759 Handle<FixedArrayBase> constant_elements_values(
1760 FixedArrayBase::cast(constant_elements->get(1))); 1760 FixedArrayBase::cast(constant_elements->get(1)));
1761 1761
1762 AllocationSiteMode allocation_site_mode = TRACK_ALLOCATION_SITE; 1762 AllocationSiteMode allocation_site_mode = TRACK_ALLOCATION_SITE;
1763 if (has_constant_fast_elements && !FLAG_allocation_site_pretenuring) { 1763 if (has_constant_fast_elements && !FLAG_allocation_site_pretenuring) {
1764 // If the only customer of allocation sites is transitioning, then 1764 // If the only customer of allocation sites is transitioning, then
1765 // we can turn it off if we don't have anywhere else to transition to. 1765 // we can turn it off if we don't have anywhere else to transition to.
1766 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE; 1766 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE;
1767 } 1767 }
1768 1768
1769 if (expr->depth() > 1) { 1769 Heap* heap = isolate()->heap();
1770 if (has_constant_fast_elements &&
1771 constant_elements_values->map() == heap->fixed_cow_array_map()) {
1772 // If the elements are already FAST_*_ELEMENTS, the boilerplate cannot
1773 // change, so it's possible to specialize the stub in advance.
1774 __ IncrementCounter(isolate()->counters()->cow_arrays_created_stub(), 1);
1775 __ movp(rbx, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset));
1776 __ movp(rax, FieldOperand(rbx, JSFunction::kLiteralsOffset));
1777 __ Move(rbx, Smi::FromInt(expr->literal_index()));
1778 __ Move(rcx, constant_elements);
1779 FastCloneShallowArrayStub stub(
1780 isolate(),
1781 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS,
1782 allocation_site_mode,
1783 length);
1784 __ CallStub(&stub);
1785 } else if (expr->depth() > 1 || Serializer::enabled(isolate()) ||
1786 length > FastCloneShallowArrayStub::kMaximumClonedLength) {
1770 __ movp(rbx, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); 1787 __ movp(rbx, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset));
1771 __ Push(FieldOperand(rbx, JSFunction::kLiteralsOffset)); 1788 __ Push(FieldOperand(rbx, JSFunction::kLiteralsOffset));
1772 __ Push(Smi::FromInt(expr->literal_index())); 1789 __ Push(Smi::FromInt(expr->literal_index()));
1773 __ Push(constant_elements); 1790 __ Push(constant_elements);
1774 __ Push(Smi::FromInt(flags)); 1791 __ Push(Smi::FromInt(flags));
1775 __ CallRuntime(Runtime::kHiddenCreateArrayLiteral, 4); 1792 __ CallRuntime(Runtime::kHiddenCreateArrayLiteral, 4);
1776 } else { 1793 } else {
1794 ASSERT(IsFastSmiOrObjectElementsKind(constant_elements_kind) ||
1795 FLAG_smi_only_arrays);
1796 FastCloneShallowArrayStub::Mode mode =
1797 FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS;
1798
1799 // If the elements are already FAST_*_ELEMENTS, the boilerplate cannot
1800 // change, so it's possible to specialize the stub in advance.
1801 if (has_constant_fast_elements) {
1802 mode = FastCloneShallowArrayStub::CLONE_ELEMENTS;
1803 }
1804
1777 __ movp(rbx, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); 1805 __ movp(rbx, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset));
1778 __ movp(rax, FieldOperand(rbx, JSFunction::kLiteralsOffset)); 1806 __ movp(rax, FieldOperand(rbx, JSFunction::kLiteralsOffset));
1779 __ Move(rbx, Smi::FromInt(expr->literal_index())); 1807 __ Move(rbx, Smi::FromInt(expr->literal_index()));
1780 __ Move(rcx, constant_elements); 1808 __ Move(rcx, constant_elements);
1781 FastCloneShallowArrayStub stub(isolate(), allocation_site_mode); 1809 FastCloneShallowArrayStub stub(isolate(),
1810 mode,
1811 allocation_site_mode, length);
1782 __ CallStub(&stub); 1812 __ CallStub(&stub);
1783 } 1813 }
1784 1814
1785 bool result_saved = false; // Is the result saved to the stack? 1815 bool result_saved = false; // Is the result saved to the stack?
1786 1816
1787 // Emit code to evaluate all the non-constant subexpressions and to store 1817 // Emit code to evaluate all the non-constant subexpressions and to store
1788 // them into the newly cloned array. 1818 // them into the newly cloned array.
1789 for (int i = 0; i < length; i++) { 1819 for (int i = 0; i < length; i++) {
1790 Expression* subexpr = subexprs->at(i); 1820 Expression* subexpr = subexprs->at(i);
1791 // If the subexpression is a literal or a simple materialized literal it 1821 // If the subexpression is a literal or a simple materialized literal it
(...skipping 3008 matching lines...) Expand 10 before | Expand all | Expand 10 after
4800 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), 4830 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(),
4801 Assembler::target_address_at(call_target_address, 4831 Assembler::target_address_at(call_target_address,
4802 unoptimized_code)); 4832 unoptimized_code));
4803 return OSR_AFTER_STACK_CHECK; 4833 return OSR_AFTER_STACK_CHECK;
4804 } 4834 }
4805 4835
4806 4836
4807 } } // namespace v8::internal 4837 } } // namespace v8::internal
4808 4838
4809 #endif // V8_TARGET_ARCH_X64 4839 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/code-stubs-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698