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

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

Issue 257563004: Unify and simplify the FastCloneShallowArrayStub (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review feedback 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 1742 matching lines...) Expand 10 before | Expand all | Expand 10 after
1753 Handle<FixedArrayBase> constant_elements_values( 1753 Handle<FixedArrayBase> constant_elements_values(
1754 FixedArrayBase::cast(constant_elements->get(1))); 1754 FixedArrayBase::cast(constant_elements->get(1)));
1755 1755
1756 AllocationSiteMode allocation_site_mode = TRACK_ALLOCATION_SITE; 1756 AllocationSiteMode allocation_site_mode = TRACK_ALLOCATION_SITE;
1757 if (has_constant_fast_elements && !FLAG_allocation_site_pretenuring) { 1757 if (has_constant_fast_elements && !FLAG_allocation_site_pretenuring) {
1758 // If the only customer of allocation sites is transitioning, then 1758 // If the only customer of allocation sites is transitioning, then
1759 // we can turn it off if we don't have anywhere else to transition to. 1759 // we can turn it off if we don't have anywhere else to transition to.
1760 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE; 1760 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE;
1761 } 1761 }
1762 1762
1763 Heap* heap = isolate()->heap(); 1763 if (expr->depth() > 1) {
1764 if (has_constant_fast_elements &&
1765 constant_elements_values->map() == heap->fixed_cow_array_map()) {
1766 // If the elements are already FAST_*_ELEMENTS, the boilerplate cannot
1767 // change, so it's possible to specialize the stub in advance.
1768 __ IncrementCounter(isolate()->counters()->cow_arrays_created_stub(), 1);
1769 __ mov(ebx, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
1770 __ mov(eax, FieldOperand(ebx, JSFunction::kLiteralsOffset));
1771 __ mov(ebx, Immediate(Smi::FromInt(expr->literal_index())));
1772 __ mov(ecx, Immediate(constant_elements));
1773 FastCloneShallowArrayStub stub(
1774 isolate(),
1775 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS,
1776 allocation_site_mode,
1777 length);
1778 __ CallStub(&stub);
1779 } else if (expr->depth() > 1 || Serializer::enabled() ||
1780 length > FastCloneShallowArrayStub::kMaximumClonedLength) {
1781 __ mov(ebx, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); 1764 __ mov(ebx, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
1782 __ push(FieldOperand(ebx, JSFunction::kLiteralsOffset)); 1765 __ push(FieldOperand(ebx, JSFunction::kLiteralsOffset));
1783 __ push(Immediate(Smi::FromInt(expr->literal_index()))); 1766 __ push(Immediate(Smi::FromInt(expr->literal_index())));
1784 __ push(Immediate(constant_elements)); 1767 __ push(Immediate(constant_elements));
1785 __ push(Immediate(Smi::FromInt(flags))); 1768 __ push(Immediate(Smi::FromInt(flags)));
1786 __ CallRuntime(Runtime::kHiddenCreateArrayLiteral, 4); 1769 __ CallRuntime(Runtime::kHiddenCreateArrayLiteral, 4);
1787 } else { 1770 } else {
1788 ASSERT(IsFastSmiOrObjectElementsKind(constant_elements_kind) ||
1789 FLAG_smi_only_arrays);
1790 FastCloneShallowArrayStub::Mode mode =
1791 FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS;
1792
1793 // If the elements are already FAST_*_ELEMENTS, the boilerplate cannot
1794 // change, so it's possible to specialize the stub in advance.
1795 if (has_constant_fast_elements) {
1796 mode = FastCloneShallowArrayStub::CLONE_ELEMENTS;
1797 }
1798
1799 __ mov(ebx, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); 1771 __ mov(ebx, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
1800 __ mov(eax, FieldOperand(ebx, JSFunction::kLiteralsOffset)); 1772 __ mov(eax, FieldOperand(ebx, JSFunction::kLiteralsOffset));
1801 __ mov(ebx, Immediate(Smi::FromInt(expr->literal_index()))); 1773 __ mov(ebx, Immediate(Smi::FromInt(expr->literal_index())));
1802 __ mov(ecx, Immediate(constant_elements)); 1774 __ mov(ecx, Immediate(constant_elements));
1803 FastCloneShallowArrayStub stub(isolate(), 1775 FastCloneShallowArrayStub stub(isolate(), allocation_site_mode);
1804 mode,
1805 allocation_site_mode,
1806 length);
1807 __ CallStub(&stub); 1776 __ CallStub(&stub);
1808 } 1777 }
1809 1778
1810 bool result_saved = false; // Is the result saved to the stack? 1779 bool result_saved = false; // Is the result saved to the stack?
1811 1780
1812 // Emit code to evaluate all the non-constant subexpressions and to store 1781 // Emit code to evaluate all the non-constant subexpressions and to store
1813 // them into the newly cloned array. 1782 // them into the newly cloned array.
1814 for (int i = 0; i < length; i++) { 1783 for (int i = 0; i < length; i++) {
1815 Expression* subexpr = subexprs->at(i); 1784 Expression* subexpr = subexprs->at(i);
1816 // If the subexpression is a literal or a simple materialized literal it 1785 // If the subexpression is a literal or a simple materialized literal it
(...skipping 3108 matching lines...) Expand 10 before | Expand all | Expand 10 after
4925 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), 4894 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(),
4926 Assembler::target_address_at(call_target_address, 4895 Assembler::target_address_at(call_target_address,
4927 unoptimized_code)); 4896 unoptimized_code));
4928 return OSR_AFTER_STACK_CHECK; 4897 return OSR_AFTER_STACK_CHECK;
4929 } 4898 }
4930 4899
4931 4900
4932 } } // namespace v8::internal 4901 } } // namespace v8::internal
4933 4902
4934 #endif // V8_TARGET_ARCH_IA32 4903 #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