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

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

Issue 12114054: Supporting AllocationSiteInfo for Nested arrays (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Now with ports to arm and x64 Created 7 years, 10 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
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 1571 matching lines...) Expand 10 before | Expand all | Expand 10 after
1582 __ ldr(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 1582 __ ldr(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
1583 __ ldr(r3, FieldMemOperand(r3, JSFunction::kLiteralsOffset)); 1583 __ ldr(r3, FieldMemOperand(r3, JSFunction::kLiteralsOffset));
1584 __ mov(r2, Operand(Smi::FromInt(expr->literal_index()))); 1584 __ mov(r2, Operand(Smi::FromInt(expr->literal_index())));
1585 __ mov(r1, Operand(constant_properties)); 1585 __ mov(r1, Operand(constant_properties));
1586 int flags = expr->fast_elements() 1586 int flags = expr->fast_elements()
1587 ? ObjectLiteral::kFastElements 1587 ? ObjectLiteral::kFastElements
1588 : ObjectLiteral::kNoFlags; 1588 : ObjectLiteral::kNoFlags;
1589 flags |= expr->has_function() 1589 flags |= expr->has_function()
1590 ? ObjectLiteral::kHasFunction 1590 ? ObjectLiteral::kHasFunction
1591 : ObjectLiteral::kNoFlags; 1591 : ObjectLiteral::kNoFlags;
1592
1593 if (FLAG_track_allocation_sites &&
1594 (loop_depth() != 0 || !scope()->is_global_scope())) {
danno 2013/02/08 13:44:38 Add this as a predicate somewhere?
mvstanton 2013/02/11 11:11:24 Done.
1595 // Don't track global arrays that are never re-created
1596 flags |= ObjectLiteral::kAllocationSiteInfoAllowed;
1597 }
1598
1592 __ mov(r0, Operand(Smi::FromInt(flags))); 1599 __ mov(r0, Operand(Smi::FromInt(flags)));
1593 __ Push(r3, r2, r1, r0); 1600 __ Push(r3, r2, r1, r0);
1594 int properties_count = constant_properties->length() / 2; 1601 int properties_count = constant_properties->length() / 2;
1595 if (expr->depth() > 1) { 1602 if (expr->depth() > 1) {
1596 __ CallRuntime(Runtime::kCreateObjectLiteral, 4); 1603 __ CallRuntime(Runtime::kCreateObjectLiteral, 4);
1597 } else if (flags != ObjectLiteral::kFastElements || 1604 } else if (flags != ObjectLiteral::kFastElements ||
1598 properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) { 1605 properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) {
1599 __ CallRuntime(Runtime::kCreateObjectLiteralShallow, 4); 1606 __ CallRuntime(Runtime::kCreateObjectLiteralShallow, 4);
1600 } else { 1607 } else {
1601 FastCloneShallowObjectStub stub(properties_count); 1608 FastCloneShallowObjectStub stub(properties_count);
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
1704 ZoneList<Expression*>* subexprs = expr->values(); 1711 ZoneList<Expression*>* subexprs = expr->values();
1705 int length = subexprs->length(); 1712 int length = subexprs->length();
1706 Handle<FixedArray> constant_elements = expr->constant_elements(); 1713 Handle<FixedArray> constant_elements = expr->constant_elements();
1707 ASSERT_EQ(2, constant_elements->length()); 1714 ASSERT_EQ(2, constant_elements->length());
1708 ElementsKind constant_elements_kind = 1715 ElementsKind constant_elements_kind =
1709 static_cast<ElementsKind>(Smi::cast(constant_elements->get(0))->value()); 1716 static_cast<ElementsKind>(Smi::cast(constant_elements->get(0))->value());
1710 bool has_fast_elements = IsFastObjectElementsKind(constant_elements_kind); 1717 bool has_fast_elements = IsFastObjectElementsKind(constant_elements_kind);
1711 Handle<FixedArrayBase> constant_elements_values( 1718 Handle<FixedArrayBase> constant_elements_values(
1712 FixedArrayBase::cast(constant_elements->get(1))); 1719 FixedArrayBase::cast(constant_elements->get(1)));
1713 1720
1721 AllocationSiteMode allocation_site_mode = DONT_TRACK_ALLOCATION_SITE;
1722 int flags = ArrayLiteral::kNoFlags;
1723 if (FLAG_track_allocation_sites &&
1724 (loop_depth() != 0 || !scope()->is_global_scope())) {
danno 2013/02/08 13:44:38 Add this as a predicate somewhere?
mvstanton 2013/02/11 11:11:24 Done.
1725 // Don't track global arrays that are never re-created
1726 flags |= ArrayLiteral::kAllocationSiteInfoAllowed;
1727 allocation_site_mode = TRACK_ALLOCATION_SITE;
1728 }
1729
1714 __ ldr(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 1730 __ ldr(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
1715 __ ldr(r3, FieldMemOperand(r3, JSFunction::kLiteralsOffset)); 1731 __ ldr(r3, FieldMemOperand(r3, JSFunction::kLiteralsOffset));
1716 __ mov(r2, Operand(Smi::FromInt(expr->literal_index()))); 1732 __ mov(r2, Operand(Smi::FromInt(expr->literal_index())));
1717 __ mov(r1, Operand(constant_elements)); 1733 __ mov(r1, Operand(constant_elements));
1718 __ Push(r3, r2, r1); 1734
1735 ASSERT(((flags & ArrayLiteral::kAllocationSiteInfoAllowed) &&
1736 (allocation_site_mode == TRACK_ALLOCATION_SITE)) ||
1737 (((flags & ArrayLiteral::kAllocationSiteInfoAllowed) == 0) &&
1738 (allocation_site_mode == DONT_TRACK_ALLOCATION_SITE)));
1739 __ mov(r0, Operand(Smi::FromInt(flags)));
1740 __ Push(r3, r2, r1, r0);
1719 if (has_fast_elements && constant_elements_values->map() == 1741 if (has_fast_elements && constant_elements_values->map() ==
1720 isolate()->heap()->fixed_cow_array_map()) { 1742 isolate()->heap()->fixed_cow_array_map()) {
1721 FastCloneShallowArrayStub stub( 1743 FastCloneShallowArrayStub stub(
1722 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS, 1744 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS,
1723 DONT_TRACK_ALLOCATION_SITE, 1745 DONT_TRACK_ALLOCATION_SITE,
1724 length); 1746 length);
danno 2013/02/08 13:44:38 With the parameterized stub, don't push the flags
mvstanton 2013/02/11 11:11:24 Done.
1725 __ CallStub(&stub); 1747 __ CallStub(&stub);
1726 __ IncrementCounter( 1748 __ IncrementCounter(
1727 isolate()->counters()->cow_arrays_created_stub(), 1, r1, r2); 1749 isolate()->counters()->cow_arrays_created_stub(), 1, r1, r2);
1728 } else if (expr->depth() > 1) { 1750 } else if (expr->depth() > 1) {
danno 2013/02/08 13:44:38 but push them here...
mvstanton 2013/02/11 11:11:24 Done.
1729 __ CallRuntime(Runtime::kCreateArrayLiteral, 3); 1751 __ CallRuntime(Runtime::kCreateArrayLiteral, 4);
1730 } else if (length > FastCloneShallowArrayStub::kMaximumClonedLength) { 1752 } else if (length > FastCloneShallowArrayStub::kMaximumClonedLength) {
danno 2013/02/08 13:44:38 and here...
mvstanton 2013/02/11 11:11:24 Done.
1731 __ CallRuntime(Runtime::kCreateArrayLiteralShallow, 3); 1753 __ CallRuntime(Runtime::kCreateArrayLiteralShallow, 4);
1732 } else { 1754 } else {
1733 ASSERT(IsFastSmiOrObjectElementsKind(constant_elements_kind) || 1755 ASSERT(IsFastSmiOrObjectElementsKind(constant_elements_kind) ||
danno 2013/02/08 13:44:38 But not here...
mvstanton 2013/02/11 11:11:24 Done.
1734 FLAG_smi_only_arrays); 1756 FLAG_smi_only_arrays);
1735 FastCloneShallowArrayStub::Mode mode = 1757 FastCloneShallowArrayStub::Mode mode =
1736 FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS; 1758 FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS;
1737 AllocationSiteMode allocation_site_mode = FLAG_track_allocation_sites
1738 ? TRACK_ALLOCATION_SITE : DONT_TRACK_ALLOCATION_SITE;
1739 1759
1740 if (has_fast_elements) { 1760 if (has_fast_elements) {
1741 mode = FastCloneShallowArrayStub::CLONE_ELEMENTS; 1761 mode = FastCloneShallowArrayStub::CLONE_ELEMENTS;
1742 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE; 1762 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE;
1743 } 1763 }
1744 1764
1745 FastCloneShallowArrayStub stub(mode, allocation_site_mode, length); 1765 FastCloneShallowArrayStub stub(mode, allocation_site_mode, length);
1746 __ CallStub(&stub); 1766 __ CallStub(&stub);
1747 } 1767 }
1748 1768
(...skipping 2813 matching lines...) Expand 10 before | Expand all | Expand 10 after
4562 *context_length = 0; 4582 *context_length = 0;
4563 return previous_; 4583 return previous_;
4564 } 4584 }
4565 4585
4566 4586
4567 #undef __ 4587 #undef __
4568 4588
4569 } } // namespace v8::internal 4589 } } // namespace v8::internal
4570 4590
4571 #endif // V8_TARGET_ARCH_ARM 4591 #endif // V8_TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698