| OLD | NEW |
| 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 1572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1583 __ ldr(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 1583 __ ldr(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
| 1584 __ ldr(r3, FieldMemOperand(r3, JSFunction::kLiteralsOffset)); | 1584 __ ldr(r3, FieldMemOperand(r3, JSFunction::kLiteralsOffset)); |
| 1585 __ mov(r2, Operand(Smi::FromInt(expr->literal_index()))); | 1585 __ mov(r2, Operand(Smi::FromInt(expr->literal_index()))); |
| 1586 __ mov(r1, Operand(constant_properties)); | 1586 __ mov(r1, Operand(constant_properties)); |
| 1587 int flags = expr->fast_elements() | 1587 int flags = expr->fast_elements() |
| 1588 ? ObjectLiteral::kFastElements | 1588 ? ObjectLiteral::kFastElements |
| 1589 : ObjectLiteral::kNoFlags; | 1589 : ObjectLiteral::kNoFlags; |
| 1590 flags |= expr->has_function() | 1590 flags |= expr->has_function() |
| 1591 ? ObjectLiteral::kHasFunction | 1591 ? ObjectLiteral::kHasFunction |
| 1592 : ObjectLiteral::kNoFlags; | 1592 : ObjectLiteral::kNoFlags; |
| 1593 |
| 1594 if (FLAG_track_allocation_sites && !IsOneTimeCode()) { |
| 1595 // Don't track global arrays that are never re-created |
| 1596 flags |= ObjectLiteral::kCreateAllocationSiteInfos; |
| 1597 } |
| 1598 |
| 1593 __ mov(r0, Operand(Smi::FromInt(flags))); | 1599 __ mov(r0, Operand(Smi::FromInt(flags))); |
| 1594 int properties_count = constant_properties->length() / 2; | 1600 int properties_count = constant_properties->length() / 2; |
| 1595 if (expr->depth() > 1) { | 1601 if (expr->depth() > 1) { |
| 1596 __ Push(r3, r2, r1, r0); | 1602 __ Push(r3, r2, r1, r0); |
| 1597 __ CallRuntime(Runtime::kCreateObjectLiteral, 4); | 1603 __ CallRuntime(Runtime::kCreateObjectLiteral, 4); |
| 1598 } else if (Serializer::enabled() || flags != ObjectLiteral::kFastElements || | 1604 } else if (Serializer::enabled() || flags != ObjectLiteral::kFastElements || |
| 1599 properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) { | 1605 properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) { |
| 1600 __ Push(r3, r2, r1, r0); | 1606 __ Push(r3, r2, r1, r0); |
| 1601 __ CallRuntime(Runtime::kCreateObjectLiteralShallow, 4); | 1607 __ CallRuntime(Runtime::kCreateObjectLiteralShallow, 4); |
| 1602 } else { | 1608 } else { |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1716 ZoneList<Expression*>* subexprs = expr->values(); | 1722 ZoneList<Expression*>* subexprs = expr->values(); |
| 1717 int length = subexprs->length(); | 1723 int length = subexprs->length(); |
| 1718 Handle<FixedArray> constant_elements = expr->constant_elements(); | 1724 Handle<FixedArray> constant_elements = expr->constant_elements(); |
| 1719 ASSERT_EQ(2, constant_elements->length()); | 1725 ASSERT_EQ(2, constant_elements->length()); |
| 1720 ElementsKind constant_elements_kind = | 1726 ElementsKind constant_elements_kind = |
| 1721 static_cast<ElementsKind>(Smi::cast(constant_elements->get(0))->value()); | 1727 static_cast<ElementsKind>(Smi::cast(constant_elements->get(0))->value()); |
| 1722 bool has_fast_elements = IsFastObjectElementsKind(constant_elements_kind); | 1728 bool has_fast_elements = IsFastObjectElementsKind(constant_elements_kind); |
| 1723 Handle<FixedArrayBase> constant_elements_values( | 1729 Handle<FixedArrayBase> constant_elements_values( |
| 1724 FixedArrayBase::cast(constant_elements->get(1))); | 1730 FixedArrayBase::cast(constant_elements->get(1))); |
| 1725 | 1731 |
| 1732 AllocationSiteMode allocation_site_mode = DONT_TRACK_ALLOCATION_SITE; |
| 1733 int flags = ArrayLiteral::kNoFlags; |
| 1734 if (FLAG_track_allocation_sites && !IsOneTimeCode()) { |
| 1735 // Don't track global arrays that are never re-created |
| 1736 flags |= ArrayLiteral::kCreateAllocationSiteInfos; |
| 1737 allocation_site_mode = TRACK_ALLOCATION_SITE; |
| 1738 } |
| 1739 |
| 1740 ASSERT(((flags & ArrayLiteral::kCreateAllocationSiteInfos) && |
| 1741 (allocation_site_mode == TRACK_ALLOCATION_SITE)) || |
| 1742 (((flags & ArrayLiteral::kCreateAllocationSiteInfos) == 0) && |
| 1743 (allocation_site_mode == DONT_TRACK_ALLOCATION_SITE))); |
| 1744 |
| 1726 __ ldr(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 1745 __ ldr(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
| 1727 __ ldr(r3, FieldMemOperand(r3, JSFunction::kLiteralsOffset)); | 1746 __ ldr(r3, FieldMemOperand(r3, JSFunction::kLiteralsOffset)); |
| 1728 __ mov(r2, Operand(Smi::FromInt(expr->literal_index()))); | 1747 __ mov(r2, Operand(Smi::FromInt(expr->literal_index()))); |
| 1729 __ mov(r1, Operand(constant_elements)); | 1748 __ mov(r1, Operand(constant_elements)); |
| 1749 |
| 1730 __ Push(r3, r2, r1); | 1750 __ Push(r3, r2, r1); |
| 1731 if (has_fast_elements && constant_elements_values->map() == | 1751 if (has_fast_elements && constant_elements_values->map() == |
| 1732 isolate()->heap()->fixed_cow_array_map()) { | 1752 isolate()->heap()->fixed_cow_array_map()) { |
| 1733 FastCloneShallowArrayStub stub( | 1753 FastCloneShallowArrayStub stub( |
| 1734 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS, | 1754 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS, |
| 1735 DONT_TRACK_ALLOCATION_SITE, | 1755 DONT_TRACK_ALLOCATION_SITE, |
| 1736 length); | 1756 length); |
| 1737 __ CallStub(&stub); | 1757 __ CallStub(&stub); |
| 1738 __ IncrementCounter( | 1758 __ IncrementCounter( |
| 1739 isolate()->counters()->cow_arrays_created_stub(), 1, r1, r2); | 1759 isolate()->counters()->cow_arrays_created_stub(), 1, r1, r2); |
| 1740 } else if (expr->depth() > 1) { | 1760 } else if (expr->depth() > 1) { |
| 1741 __ CallRuntime(Runtime::kCreateArrayLiteral, 3); | 1761 __ mov(r0, Operand(Smi::FromInt(flags))); |
| 1762 __ push(r0); |
| 1763 __ CallRuntime(Runtime::kCreateArrayLiteral, 4); |
| 1742 } else if (length > FastCloneShallowArrayStub::kMaximumClonedLength) { | 1764 } else if (length > FastCloneShallowArrayStub::kMaximumClonedLength) { |
| 1743 __ CallRuntime(Runtime::kCreateArrayLiteralShallow, 3); | 1765 __ mov(r0, Operand(Smi::FromInt(flags))); |
| 1766 __ push(r0); |
| 1767 __ CallRuntime(Runtime::kCreateArrayLiteralShallow, 4); |
| 1744 } else { | 1768 } else { |
| 1745 ASSERT(IsFastSmiOrObjectElementsKind(constant_elements_kind) || | 1769 ASSERT(IsFastSmiOrObjectElementsKind(constant_elements_kind) || |
| 1746 FLAG_smi_only_arrays); | 1770 FLAG_smi_only_arrays); |
| 1747 FastCloneShallowArrayStub::Mode mode = | 1771 FastCloneShallowArrayStub::Mode mode = |
| 1748 FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS; | 1772 FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS; |
| 1749 AllocationSiteMode allocation_site_mode = FLAG_track_allocation_sites | |
| 1750 ? TRACK_ALLOCATION_SITE : DONT_TRACK_ALLOCATION_SITE; | |
| 1751 | 1773 |
| 1752 if (has_fast_elements) { | 1774 if (has_fast_elements) { |
| 1753 mode = FastCloneShallowArrayStub::CLONE_ELEMENTS; | 1775 mode = FastCloneShallowArrayStub::CLONE_ELEMENTS; |
| 1754 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE; | 1776 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE; |
| 1755 } | 1777 } |
| 1756 | 1778 |
| 1757 FastCloneShallowArrayStub stub(mode, allocation_site_mode, length); | 1779 FastCloneShallowArrayStub stub(mode, allocation_site_mode, length); |
| 1758 __ CallStub(&stub); | 1780 __ CallStub(&stub); |
| 1759 } | 1781 } |
| 1760 | 1782 |
| (...skipping 2841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4602 *context_length = 0; | 4624 *context_length = 0; |
| 4603 return previous_; | 4625 return previous_; |
| 4604 } | 4626 } |
| 4605 | 4627 |
| 4606 | 4628 |
| 4607 #undef __ | 4629 #undef __ |
| 4608 | 4630 |
| 4609 } } // namespace v8::internal | 4631 } } // namespace v8::internal |
| 4610 | 4632 |
| 4611 #endif // V8_TARGET_ARCH_ARM | 4633 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |