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

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

Issue 40063002: Bookkeeping for allocation site pretenuring (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebase built on site fields in another CL. Created 7 years, 1 month 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
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 1698 matching lines...) Expand 10 before | Expand all | Expand 10 after
1709 int length = subexprs->length(); 1709 int length = subexprs->length();
1710 Handle<FixedArray> constant_elements = expr->constant_elements(); 1710 Handle<FixedArray> constant_elements = expr->constant_elements();
1711 ASSERT_EQ(2, constant_elements->length()); 1711 ASSERT_EQ(2, constant_elements->length());
1712 ElementsKind constant_elements_kind = 1712 ElementsKind constant_elements_kind =
1713 static_cast<ElementsKind>(Smi::cast(constant_elements->get(0))->value()); 1713 static_cast<ElementsKind>(Smi::cast(constant_elements->get(0))->value());
1714 bool has_constant_fast_elements = 1714 bool has_constant_fast_elements =
1715 IsFastObjectElementsKind(constant_elements_kind); 1715 IsFastObjectElementsKind(constant_elements_kind);
1716 Handle<FixedArrayBase> constant_elements_values( 1716 Handle<FixedArrayBase> constant_elements_values(
1717 FixedArrayBase::cast(constant_elements->get(1))); 1717 FixedArrayBase::cast(constant_elements->get(1)));
1718 1718
1719 AllocationSiteMode allocation_site_mode = FLAG_track_allocation_sites
1720 ? TRACK_ALLOCATION_SITE : DONT_TRACK_ALLOCATION_SITE;
1721 if (has_constant_fast_elements && !FLAG_allocation_site_pretenuring) {
1722 // If the only customer of allocation sites is transitioning, then
1723 // we can turn it off if we don't have anywhere else to transition to.
1724 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE;
1725 }
1726
1719 Heap* heap = isolate()->heap(); 1727 Heap* heap = isolate()->heap();
1720 if (has_constant_fast_elements && 1728 if (has_constant_fast_elements &&
1721 constant_elements_values->map() == heap->fixed_cow_array_map()) { 1729 constant_elements_values->map() == heap->fixed_cow_array_map()) {
1722 // If the elements are already FAST_*_ELEMENTS, the boilerplate cannot 1730 // If the elements are already FAST_*_ELEMENTS, the boilerplate cannot
1723 // change, so it's possible to specialize the stub in advance. 1731 // change, so it's possible to specialize the stub in advance.
1724 __ IncrementCounter(isolate()->counters()->cow_arrays_created_stub(), 1); 1732 __ IncrementCounter(isolate()->counters()->cow_arrays_created_stub(), 1);
1725 __ mov(ebx, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); 1733 __ mov(ebx, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
1726 __ mov(eax, FieldOperand(ebx, JSFunction::kLiteralsOffset)); 1734 __ mov(eax, FieldOperand(ebx, JSFunction::kLiteralsOffset));
1727 __ mov(ebx, Immediate(Smi::FromInt(expr->literal_index()))); 1735 __ mov(ebx, Immediate(Smi::FromInt(expr->literal_index())));
1728 __ mov(ecx, Immediate(constant_elements)); 1736 __ mov(ecx, Immediate(constant_elements));
1729 FastCloneShallowArrayStub stub( 1737 FastCloneShallowArrayStub stub(
1730 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS, 1738 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS,
1731 DONT_TRACK_ALLOCATION_SITE, 1739 allocation_site_mode,
1732 length); 1740 length);
1733 __ CallStub(&stub); 1741 __ CallStub(&stub);
1734 } else if (expr->depth() > 1 || Serializer::enabled() || 1742 } else if (expr->depth() > 1 || Serializer::enabled() ||
1735 length > FastCloneShallowArrayStub::kMaximumClonedLength) { 1743 length > FastCloneShallowArrayStub::kMaximumClonedLength) {
1736 __ mov(ebx, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); 1744 __ mov(ebx, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
1737 __ push(FieldOperand(ebx, JSFunction::kLiteralsOffset)); 1745 __ push(FieldOperand(ebx, JSFunction::kLiteralsOffset));
1738 __ push(Immediate(Smi::FromInt(expr->literal_index()))); 1746 __ push(Immediate(Smi::FromInt(expr->literal_index())));
1739 __ push(Immediate(constant_elements)); 1747 __ push(Immediate(constant_elements));
1740 __ CallRuntime(Runtime::kCreateArrayLiteral, 3); 1748 __ CallRuntime(Runtime::kCreateArrayLiteral, 3);
1741 } else { 1749 } else {
1742 ASSERT(IsFastSmiOrObjectElementsKind(constant_elements_kind) || 1750 ASSERT(IsFastSmiOrObjectElementsKind(constant_elements_kind) ||
1743 FLAG_smi_only_arrays); 1751 FLAG_smi_only_arrays);
1744 FastCloneShallowArrayStub::Mode mode = 1752 FastCloneShallowArrayStub::Mode mode =
1745 FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS; 1753 FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS;
1746 AllocationSiteMode allocation_site_mode = FLAG_track_allocation_sites
1747 ? TRACK_ALLOCATION_SITE : DONT_TRACK_ALLOCATION_SITE;
1748 1754
1749 // If the elements are already FAST_*_ELEMENTS, the boilerplate cannot 1755 // If the elements are already FAST_*_ELEMENTS, the boilerplate cannot
1750 // change, so it's possible to specialize the stub in advance. 1756 // change, so it's possible to specialize the stub in advance.
1751 if (has_constant_fast_elements) { 1757 if (has_constant_fast_elements) {
1752 mode = FastCloneShallowArrayStub::CLONE_ELEMENTS; 1758 mode = FastCloneShallowArrayStub::CLONE_ELEMENTS;
1753 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE;
1754 } 1759 }
1755 1760
1756 __ mov(ebx, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); 1761 __ mov(ebx, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
1757 __ mov(eax, FieldOperand(ebx, JSFunction::kLiteralsOffset)); 1762 __ mov(eax, FieldOperand(ebx, JSFunction::kLiteralsOffset));
1758 __ mov(ebx, Immediate(Smi::FromInt(expr->literal_index()))); 1763 __ mov(ebx, Immediate(Smi::FromInt(expr->literal_index())));
1759 __ mov(ecx, Immediate(constant_elements)); 1764 __ mov(ecx, Immediate(constant_elements));
1760 FastCloneShallowArrayStub stub(mode, allocation_site_mode, length); 1765 FastCloneShallowArrayStub stub(mode, allocation_site_mode, length);
1761 __ CallStub(&stub); 1766 __ CallStub(&stub);
1762 } 1767 }
1763 1768
(...skipping 3190 matching lines...) Expand 10 before | Expand all | Expand 10 after
4954 4959
4955 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), 4960 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(),
4956 Assembler::target_address_at(call_target_address)); 4961 Assembler::target_address_at(call_target_address));
4957 return OSR_AFTER_STACK_CHECK; 4962 return OSR_AFTER_STACK_CHECK;
4958 } 4963 }
4959 4964
4960 4965
4961 } } // namespace v8::internal 4966 } } // namespace v8::internal
4962 4967
4963 #endif // V8_TARGET_ARCH_IA32 4968 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698