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 1701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1712 FixedArrayBase::cast(constant_elements->get(1))); | 1712 FixedArrayBase::cast(constant_elements->get(1))); |
1713 | 1713 |
1714 __ ldr(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 1714 __ ldr(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
1715 __ ldr(r3, FieldMemOperand(r3, JSFunction::kLiteralsOffset)); | 1715 __ ldr(r3, FieldMemOperand(r3, JSFunction::kLiteralsOffset)); |
1716 __ mov(r2, Operand(Smi::FromInt(expr->literal_index()))); | 1716 __ mov(r2, Operand(Smi::FromInt(expr->literal_index()))); |
1717 __ mov(r1, Operand(constant_elements)); | 1717 __ mov(r1, Operand(constant_elements)); |
1718 __ Push(r3, r2, r1); | 1718 __ Push(r3, r2, r1); |
1719 if (has_fast_elements && constant_elements_values->map() == | 1719 if (has_fast_elements && constant_elements_values->map() == |
1720 isolate()->heap()->fixed_cow_array_map()) { | 1720 isolate()->heap()->fixed_cow_array_map()) { |
1721 FastCloneShallowArrayStub stub( | 1721 FastCloneShallowArrayStub stub( |
1722 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS, length); | 1722 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS, |
| 1723 DONT_TRACK_ALLOCATION_SITE, |
| 1724 length); |
1723 __ CallStub(&stub); | 1725 __ CallStub(&stub); |
1724 __ IncrementCounter( | 1726 __ IncrementCounter( |
1725 isolate()->counters()->cow_arrays_created_stub(), 1, r1, r2); | 1727 isolate()->counters()->cow_arrays_created_stub(), 1, r1, r2); |
1726 } else if (expr->depth() > 1) { | 1728 } else if (expr->depth() > 1) { |
1727 __ CallRuntime(Runtime::kCreateArrayLiteral, 3); | 1729 __ CallRuntime(Runtime::kCreateArrayLiteral, 3); |
1728 } else if (length > FastCloneShallowArrayStub::kMaximumClonedLength) { | 1730 } else if (length > FastCloneShallowArrayStub::kMaximumClonedLength) { |
1729 __ CallRuntime(Runtime::kCreateArrayLiteralShallow, 3); | 1731 __ CallRuntime(Runtime::kCreateArrayLiteralShallow, 3); |
1730 } else { | 1732 } else { |
1731 ASSERT(IsFastSmiOrObjectElementsKind(constant_elements_kind) || | 1733 ASSERT(IsFastSmiOrObjectElementsKind(constant_elements_kind) || |
1732 FLAG_smi_only_arrays); | 1734 FLAG_smi_only_arrays); |
1733 FastCloneShallowArrayStub::Mode mode = has_fast_elements | 1735 FastCloneShallowArrayStub::Mode mode = |
1734 ? FastCloneShallowArrayStub::CLONE_ELEMENTS | 1736 FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS; |
1735 : FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS; | 1737 AllocationSiteMode allocation_site_mode = FLAG_track_allocation_sites |
| 1738 ? TRACK_ALLOCATION_SITE : DONT_TRACK_ALLOCATION_SITE; |
1736 | 1739 |
1737 // Tracking allocation info allows us to pre-transition later if it makes | 1740 if (has_fast_elements) { |
1738 // sense. | 1741 mode = FastCloneShallowArrayStub::CLONE_ELEMENTS; |
1739 if (mode == FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS && | 1742 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE; |
1740 FLAG_track_allocation_sites) { | |
1741 mode = FastCloneShallowArrayStub:: | |
1742 CLONE_ANY_ELEMENTS_WITH_ALLOCATION_SITE_INFO; | |
1743 } | 1743 } |
1744 | 1744 |
1745 FastCloneShallowArrayStub stub(mode, length); | 1745 FastCloneShallowArrayStub stub(mode, allocation_site_mode, length); |
1746 __ CallStub(&stub); | 1746 __ CallStub(&stub); |
1747 } | 1747 } |
1748 | 1748 |
1749 bool result_saved = false; // Is the result saved to the stack? | 1749 bool result_saved = false; // Is the result saved to the stack? |
1750 | 1750 |
1751 // Emit code to evaluate all the non-constant subexpressions and to store | 1751 // Emit code to evaluate all the non-constant subexpressions and to store |
1752 // them into the newly cloned array. | 1752 // them into the newly cloned array. |
1753 for (int i = 0; i < length; i++) { | 1753 for (int i = 0; i < length; i++) { |
1754 Expression* subexpr = subexprs->at(i); | 1754 Expression* subexpr = subexprs->at(i); |
1755 // If the subexpression is a literal or a simple materialized literal it | 1755 // If the subexpression is a literal or a simple materialized literal it |
(...skipping 2806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4562 *context_length = 0; | 4562 *context_length = 0; |
4563 return previous_; | 4563 return previous_; |
4564 } | 4564 } |
4565 | 4565 |
4566 | 4566 |
4567 #undef __ | 4567 #undef __ |
4568 | 4568 |
4569 } } // namespace v8::internal | 4569 } } // namespace v8::internal |
4570 | 4570 |
4571 #endif // V8_TARGET_ARCH_ARM | 4571 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |