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

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. Created 7 years 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/hydrogen.cc ('k') | src/mark-compact.h » ('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 1702 matching lines...) Expand 10 before | Expand all | Expand 10 after
1713 int length = subexprs->length(); 1713 int length = subexprs->length();
1714 Handle<FixedArray> constant_elements = expr->constant_elements(); 1714 Handle<FixedArray> constant_elements = expr->constant_elements();
1715 ASSERT_EQ(2, constant_elements->length()); 1715 ASSERT_EQ(2, constant_elements->length());
1716 ElementsKind constant_elements_kind = 1716 ElementsKind constant_elements_kind =
1717 static_cast<ElementsKind>(Smi::cast(constant_elements->get(0))->value()); 1717 static_cast<ElementsKind>(Smi::cast(constant_elements->get(0))->value());
1718 bool has_constant_fast_elements = 1718 bool has_constant_fast_elements =
1719 IsFastObjectElementsKind(constant_elements_kind); 1719 IsFastObjectElementsKind(constant_elements_kind);
1720 Handle<FixedArrayBase> constant_elements_values( 1720 Handle<FixedArrayBase> constant_elements_values(
1721 FixedArrayBase::cast(constant_elements->get(1))); 1721 FixedArrayBase::cast(constant_elements->get(1)));
1722 1722
1723 AllocationSiteMode allocation_site_mode = FLAG_track_allocation_sites
1724 ? TRACK_ALLOCATION_SITE : DONT_TRACK_ALLOCATION_SITE;
1725 if (has_constant_fast_elements && !FLAG_allocation_site_pretenuring) {
1726 // If the only customer of allocation sites is transitioning, then
1727 // we can turn it off if we don't have anywhere else to transition to.
1728 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE;
1729 }
1730
1723 Heap* heap = isolate()->heap(); 1731 Heap* heap = isolate()->heap();
1724 if (has_constant_fast_elements && 1732 if (has_constant_fast_elements &&
1725 constant_elements_values->map() == heap->fixed_cow_array_map()) { 1733 constant_elements_values->map() == heap->fixed_cow_array_map()) {
1726 // If the elements are already FAST_*_ELEMENTS, the boilerplate cannot 1734 // If the elements are already FAST_*_ELEMENTS, the boilerplate cannot
1727 // change, so it's possible to specialize the stub in advance. 1735 // change, so it's possible to specialize the stub in advance.
1728 __ IncrementCounter(isolate()->counters()->cow_arrays_created_stub(), 1); 1736 __ IncrementCounter(isolate()->counters()->cow_arrays_created_stub(), 1);
1729 __ mov(ebx, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); 1737 __ mov(ebx, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
1730 __ mov(eax, FieldOperand(ebx, JSFunction::kLiteralsOffset)); 1738 __ mov(eax, FieldOperand(ebx, JSFunction::kLiteralsOffset));
1731 __ mov(ebx, Immediate(Smi::FromInt(expr->literal_index()))); 1739 __ mov(ebx, Immediate(Smi::FromInt(expr->literal_index())));
1732 __ mov(ecx, Immediate(constant_elements)); 1740 __ mov(ecx, Immediate(constant_elements));
1733 FastCloneShallowArrayStub stub( 1741 FastCloneShallowArrayStub stub(
1734 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS, 1742 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS,
1735 DONT_TRACK_ALLOCATION_SITE, 1743 allocation_site_mode,
1736 length); 1744 length);
1737 __ CallStub(&stub); 1745 __ CallStub(&stub);
1738 } else if (expr->depth() > 1 || Serializer::enabled() || 1746 } else if (expr->depth() > 1 || Serializer::enabled() ||
1739 length > FastCloneShallowArrayStub::kMaximumClonedLength) { 1747 length > FastCloneShallowArrayStub::kMaximumClonedLength) {
1740 __ mov(ebx, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); 1748 __ mov(ebx, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
1741 __ push(FieldOperand(ebx, JSFunction::kLiteralsOffset)); 1749 __ push(FieldOperand(ebx, JSFunction::kLiteralsOffset));
1742 __ push(Immediate(Smi::FromInt(expr->literal_index()))); 1750 __ push(Immediate(Smi::FromInt(expr->literal_index())));
1743 __ push(Immediate(constant_elements)); 1751 __ push(Immediate(constant_elements));
1744 __ push(Immediate(Smi::FromInt(flags))); 1752 __ push(Immediate(Smi::FromInt(flags)));
1745 __ CallRuntime(Runtime::kCreateArrayLiteral, 4); 1753 __ CallRuntime(Runtime::kCreateArrayLiteral, 4);
1746 } else { 1754 } else {
1747 ASSERT(IsFastSmiOrObjectElementsKind(constant_elements_kind) || 1755 ASSERT(IsFastSmiOrObjectElementsKind(constant_elements_kind) ||
1748 FLAG_smi_only_arrays); 1756 FLAG_smi_only_arrays);
1749 FastCloneShallowArrayStub::Mode mode = 1757 FastCloneShallowArrayStub::Mode mode =
1750 FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS; 1758 FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS;
1751 AllocationSiteMode allocation_site_mode = FLAG_track_allocation_sites
1752 ? TRACK_ALLOCATION_SITE : DONT_TRACK_ALLOCATION_SITE;
1753 1759
1754 // If the elements are already FAST_*_ELEMENTS, the boilerplate cannot 1760 // If the elements are already FAST_*_ELEMENTS, the boilerplate cannot
1755 // change, so it's possible to specialize the stub in advance. 1761 // change, so it's possible to specialize the stub in advance.
1756 if (has_constant_fast_elements) { 1762 if (has_constant_fast_elements) {
1757 mode = FastCloneShallowArrayStub::CLONE_ELEMENTS; 1763 mode = FastCloneShallowArrayStub::CLONE_ELEMENTS;
1758 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE;
1759 } 1764 }
1760 1765
1761 __ mov(ebx, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); 1766 __ mov(ebx, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
1762 __ mov(eax, FieldOperand(ebx, JSFunction::kLiteralsOffset)); 1767 __ mov(eax, FieldOperand(ebx, JSFunction::kLiteralsOffset));
1763 __ mov(ebx, Immediate(Smi::FromInt(expr->literal_index()))); 1768 __ mov(ebx, Immediate(Smi::FromInt(expr->literal_index())));
1764 __ mov(ecx, Immediate(constant_elements)); 1769 __ mov(ecx, Immediate(constant_elements));
1765 FastCloneShallowArrayStub stub(mode, allocation_site_mode, length); 1770 FastCloneShallowArrayStub stub(mode, allocation_site_mode, length);
1766 __ CallStub(&stub); 1771 __ CallStub(&stub);
1767 } 1772 }
1768 1773
(...skipping 3139 matching lines...) Expand 10 before | Expand all | Expand 10 after
4908 4913
4909 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), 4914 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(),
4910 Assembler::target_address_at(call_target_address)); 4915 Assembler::target_address_at(call_target_address));
4911 return OSR_AFTER_STACK_CHECK; 4916 return OSR_AFTER_STACK_CHECK;
4912 } 4917 }
4913 4918
4914 4919
4915 } } // namespace v8::internal 4920 } } // namespace v8::internal
4916 4921
4917 #endif // V8_TARGET_ARCH_IA32 4922 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | src/mark-compact.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698