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

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

Issue 256873007: Revert 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 // 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 1778 matching lines...) Expand 10 before | Expand all | Expand 10 after
1789 Handle<FixedArrayBase> constant_elements_values( 1789 Handle<FixedArrayBase> constant_elements_values(
1790 FixedArrayBase::cast(constant_elements->get(1))); 1790 FixedArrayBase::cast(constant_elements->get(1)));
1791 1791
1792 AllocationSiteMode allocation_site_mode = TRACK_ALLOCATION_SITE; 1792 AllocationSiteMode allocation_site_mode = TRACK_ALLOCATION_SITE;
1793 if (has_constant_fast_elements && !FLAG_allocation_site_pretenuring) { 1793 if (has_constant_fast_elements && !FLAG_allocation_site_pretenuring) {
1794 // If the only customer of allocation sites is transitioning, then 1794 // If the only customer of allocation sites is transitioning, then
1795 // we can turn it off if we don't have anywhere else to transition to. 1795 // we can turn it off if we don't have anywhere else to transition to.
1796 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE; 1796 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE;
1797 } 1797 }
1798 1798
1799 if (expr->depth() > 1) { 1799 Heap* heap = isolate()->heap();
1800 if (has_constant_fast_elements &&
1801 constant_elements_values->map() == heap->fixed_cow_array_map()) {
1802 // If the elements are already FAST_*_ELEMENTS, the boilerplate cannot
1803 // change, so it's possible to specialize the stub in advance.
1804 __ IncrementCounter(isolate()->counters()->cow_arrays_created_stub(), 1);
1805 __ movp(rbx, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset));
1806 __ movp(rax, FieldOperand(rbx, JSFunction::kLiteralsOffset));
1807 __ Move(rbx, Smi::FromInt(expr->literal_index()));
1808 __ Move(rcx, constant_elements);
1809 FastCloneShallowArrayStub stub(
1810 isolate(),
1811 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS,
1812 allocation_site_mode,
1813 length);
1814 __ CallStub(&stub);
1815 } else if (expr->depth() > 1 || Serializer::enabled() ||
1816 length > FastCloneShallowArrayStub::kMaximumClonedLength) {
1800 __ movp(rbx, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); 1817 __ movp(rbx, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset));
1801 __ Push(FieldOperand(rbx, JSFunction::kLiteralsOffset)); 1818 __ Push(FieldOperand(rbx, JSFunction::kLiteralsOffset));
1802 __ Push(Smi::FromInt(expr->literal_index())); 1819 __ Push(Smi::FromInt(expr->literal_index()));
1803 __ Push(constant_elements); 1820 __ Push(constant_elements);
1804 __ Push(Smi::FromInt(flags)); 1821 __ Push(Smi::FromInt(flags));
1805 __ CallRuntime(Runtime::kHiddenCreateArrayLiteral, 4); 1822 __ CallRuntime(Runtime::kHiddenCreateArrayLiteral, 4);
1806 } else { 1823 } else {
1824 ASSERT(IsFastSmiOrObjectElementsKind(constant_elements_kind) ||
1825 FLAG_smi_only_arrays);
1826 FastCloneShallowArrayStub::Mode mode =
1827 FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS;
1828
1829 // If the elements are already FAST_*_ELEMENTS, the boilerplate cannot
1830 // change, so it's possible to specialize the stub in advance.
1831 if (has_constant_fast_elements) {
1832 mode = FastCloneShallowArrayStub::CLONE_ELEMENTS;
1833 }
1834
1807 __ movp(rbx, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); 1835 __ movp(rbx, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset));
1808 __ movp(rax, FieldOperand(rbx, JSFunction::kLiteralsOffset)); 1836 __ movp(rax, FieldOperand(rbx, JSFunction::kLiteralsOffset));
1809 __ Move(rbx, Smi::FromInt(expr->literal_index())); 1837 __ Move(rbx, Smi::FromInt(expr->literal_index()));
1810 __ Move(rcx, constant_elements); 1838 __ Move(rcx, constant_elements);
1811 FastCloneShallowArrayStub stub(isolate(), allocation_site_mode); 1839 FastCloneShallowArrayStub stub(isolate(),
1840 mode,
1841 allocation_site_mode, length);
1812 __ CallStub(&stub); 1842 __ CallStub(&stub);
1813 } 1843 }
1814 1844
1815 bool result_saved = false; // Is the result saved to the stack? 1845 bool result_saved = false; // Is the result saved to the stack?
1816 1846
1817 // Emit code to evaluate all the non-constant subexpressions and to store 1847 // Emit code to evaluate all the non-constant subexpressions and to store
1818 // them into the newly cloned array. 1848 // them into the newly cloned array.
1819 for (int i = 0; i < length; i++) { 1849 for (int i = 0; i < length; i++) {
1820 Expression* subexpr = subexprs->at(i); 1850 Expression* subexpr = subexprs->at(i);
1821 // If the subexpression is a literal or a simple materialized literal it 1851 // If the subexpression is a literal or a simple materialized literal it
(...skipping 3076 matching lines...) Expand 10 before | Expand all | Expand 10 after
4898 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), 4928 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(),
4899 Assembler::target_address_at(call_target_address, 4929 Assembler::target_address_at(call_target_address,
4900 unoptimized_code)); 4930 unoptimized_code));
4901 return OSR_AFTER_STACK_CHECK; 4931 return OSR_AFTER_STACK_CHECK;
4902 } 4932 }
4903 4933
4904 4934
4905 } } // namespace v8::internal 4935 } } // namespace v8::internal
4906 4936
4907 #endif // V8_TARGET_ARCH_X64 4937 #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