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

Side by Side Diff: src/ia32/full-codegen-ia32.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/ia32/code-stubs-ia32.cc ('k') | src/mips/full-codegen-mips.cc » ('j') | 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 1740 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 if (expr->depth() > 1) { 1761 Heap* heap = isolate()->heap();
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 isolate(),
1773 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS,
1774 allocation_site_mode,
1775 length);
1776 __ CallStub(&stub);
1777 } else if (expr->depth() > 1 || Serializer::enabled() ||
1778 length > FastCloneShallowArrayStub::kMaximumClonedLength) {
1762 __ mov(ebx, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); 1779 __ mov(ebx, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
1763 __ push(FieldOperand(ebx, JSFunction::kLiteralsOffset)); 1780 __ push(FieldOperand(ebx, JSFunction::kLiteralsOffset));
1764 __ push(Immediate(Smi::FromInt(expr->literal_index()))); 1781 __ push(Immediate(Smi::FromInt(expr->literal_index())));
1765 __ push(Immediate(constant_elements)); 1782 __ push(Immediate(constant_elements));
1766 __ push(Immediate(Smi::FromInt(flags))); 1783 __ push(Immediate(Smi::FromInt(flags)));
1767 __ CallRuntime(Runtime::kHiddenCreateArrayLiteral, 4); 1784 __ CallRuntime(Runtime::kHiddenCreateArrayLiteral, 4);
1768 } else { 1785 } else {
1786 ASSERT(IsFastSmiOrObjectElementsKind(constant_elements_kind) ||
1787 FLAG_smi_only_arrays);
1788 FastCloneShallowArrayStub::Mode mode =
1789 FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS;
1790
1791 // If the elements are already FAST_*_ELEMENTS, the boilerplate cannot
1792 // change, so it's possible to specialize the stub in advance.
1793 if (has_constant_fast_elements) {
1794 mode = FastCloneShallowArrayStub::CLONE_ELEMENTS;
1795 }
1796
1769 __ mov(ebx, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); 1797 __ mov(ebx, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
1770 __ mov(eax, FieldOperand(ebx, JSFunction::kLiteralsOffset)); 1798 __ mov(eax, FieldOperand(ebx, JSFunction::kLiteralsOffset));
1771 __ mov(ebx, Immediate(Smi::FromInt(expr->literal_index()))); 1799 __ mov(ebx, Immediate(Smi::FromInt(expr->literal_index())));
1772 __ mov(ecx, Immediate(constant_elements)); 1800 __ mov(ecx, Immediate(constant_elements));
1773 FastCloneShallowArrayStub stub(isolate(), allocation_site_mode); 1801 FastCloneShallowArrayStub stub(isolate(),
1802 mode,
1803 allocation_site_mode,
1804 length);
1774 __ CallStub(&stub); 1805 __ CallStub(&stub);
1775 } 1806 }
1776 1807
1777 bool result_saved = false; // Is the result saved to the stack? 1808 bool result_saved = false; // Is the result saved to the stack?
1778 1809
1779 // Emit code to evaluate all the non-constant subexpressions and to store 1810 // Emit code to evaluate all the non-constant subexpressions and to store
1780 // them into the newly cloned array. 1811 // them into the newly cloned array.
1781 for (int i = 0; i < length; i++) { 1812 for (int i = 0; i < length; i++) {
1782 Expression* subexpr = subexprs->at(i); 1813 Expression* subexpr = subexprs->at(i);
1783 // If the subexpression is a literal or a simple materialized literal it 1814 // If the subexpression is a literal or a simple materialized literal it
(...skipping 3108 matching lines...) Expand 10 before | Expand all | Expand 10 after
4892 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), 4923 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(),
4893 Assembler::target_address_at(call_target_address, 4924 Assembler::target_address_at(call_target_address,
4894 unoptimized_code)); 4925 unoptimized_code));
4895 return OSR_AFTER_STACK_CHECK; 4926 return OSR_AFTER_STACK_CHECK;
4896 } 4927 }
4897 4928
4898 4929
4899 } } // namespace v8::internal 4930 } } // namespace v8::internal
4900 4931
4901 #endif // V8_TARGET_ARCH_IA32 4932 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/code-stubs-ia32.cc ('k') | src/mips/full-codegen-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698