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 1712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1723 | 1723 |
1724 __ mov(a0, result_register()); | 1724 __ mov(a0, result_register()); |
1725 __ lw(a3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 1725 __ lw(a3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
1726 __ lw(a3, FieldMemOperand(a3, JSFunction::kLiteralsOffset)); | 1726 __ lw(a3, FieldMemOperand(a3, JSFunction::kLiteralsOffset)); |
1727 __ li(a2, Operand(Smi::FromInt(expr->literal_index()))); | 1727 __ li(a2, Operand(Smi::FromInt(expr->literal_index()))); |
1728 __ li(a1, Operand(constant_elements)); | 1728 __ li(a1, Operand(constant_elements)); |
1729 __ Push(a3, a2, a1); | 1729 __ Push(a3, a2, a1); |
1730 if (has_fast_elements && constant_elements_values->map() == | 1730 if (has_fast_elements && constant_elements_values->map() == |
1731 isolate()->heap()->fixed_cow_array_map()) { | 1731 isolate()->heap()->fixed_cow_array_map()) { |
1732 FastCloneShallowArrayStub stub( | 1732 FastCloneShallowArrayStub stub( |
1733 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS, length); | 1733 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS, |
| 1734 DONT_TRACK_ALLOCATION_SITE, |
| 1735 length); |
1734 __ CallStub(&stub); | 1736 __ CallStub(&stub); |
1735 __ IncrementCounter(isolate()->counters()->cow_arrays_created_stub(), | 1737 __ IncrementCounter(isolate()->counters()->cow_arrays_created_stub(), |
1736 1, a1, a2); | 1738 1, a1, a2); |
1737 } else if (expr->depth() > 1) { | 1739 } else if (expr->depth() > 1) { |
1738 __ CallRuntime(Runtime::kCreateArrayLiteral, 3); | 1740 __ CallRuntime(Runtime::kCreateArrayLiteral, 3); |
1739 } else if (length > FastCloneShallowArrayStub::kMaximumClonedLength) { | 1741 } else if (length > FastCloneShallowArrayStub::kMaximumClonedLength) { |
1740 __ CallRuntime(Runtime::kCreateArrayLiteralShallow, 3); | 1742 __ CallRuntime(Runtime::kCreateArrayLiteralShallow, 3); |
1741 } else { | 1743 } else { |
1742 ASSERT(IsFastSmiOrObjectElementsKind(constant_elements_kind) || | 1744 ASSERT(IsFastSmiOrObjectElementsKind(constant_elements_kind) || |
1743 FLAG_smi_only_arrays); | 1745 FLAG_smi_only_arrays); |
1744 FastCloneShallowArrayStub::Mode mode = has_fast_elements | 1746 FastCloneShallowArrayStub::Mode mode = |
1745 ? FastCloneShallowArrayStub::CLONE_ELEMENTS | 1747 FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS; |
1746 : FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS; | 1748 AllocationSiteMode allocation_site_mode = FLAG_track_allocation_sites |
| 1749 ? TRACK_ALLOCATION_SITE : DONT_TRACK_ALLOCATION_SITE; |
1747 | 1750 |
1748 // Tracking allocation info allows us to pre-transition later if it makes | 1751 if (has_fast_elements) { |
1749 // sense. | 1752 mode = FastCloneShallowArrayStub::CLONE_ELEMENTS; |
1750 if (mode == FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS && | 1753 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE; |
1751 FLAG_track_allocation_sites) { | |
1752 mode = FastCloneShallowArrayStub:: | |
1753 CLONE_ANY_ELEMENTS_WITH_ALLOCATION_SITE_INFO; | |
1754 } | 1754 } |
1755 | 1755 |
1756 FastCloneShallowArrayStub stub(mode, length); | 1756 FastCloneShallowArrayStub stub(mode, allocation_site_mode, length); |
1757 __ CallStub(&stub); | 1757 __ CallStub(&stub); |
1758 } | 1758 } |
1759 | 1759 |
1760 bool result_saved = false; // Is the result saved to the stack? | 1760 bool result_saved = false; // Is the result saved to the stack? |
1761 | 1761 |
1762 // Emit code to evaluate all the non-constant subexpressions and to store | 1762 // Emit code to evaluate all the non-constant subexpressions and to store |
1763 // them into the newly cloned array. | 1763 // them into the newly cloned array. |
1764 for (int i = 0; i < length; i++) { | 1764 for (int i = 0; i < length; i++) { |
1765 Expression* subexpr = subexprs->at(i); | 1765 Expression* subexpr = subexprs->at(i); |
1766 // If the subexpression is a literal or a simple materialized literal it | 1766 // If the subexpression is a literal or a simple materialized literal it |
(...skipping 2818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4585 *context_length = 0; | 4585 *context_length = 0; |
4586 return previous_; | 4586 return previous_; |
4587 } | 4587 } |
4588 | 4588 |
4589 | 4589 |
4590 #undef __ | 4590 #undef __ |
4591 | 4591 |
4592 } } // namespace v8::internal | 4592 } } // namespace v8::internal |
4593 | 4593 |
4594 #endif // V8_TARGET_ARCH_MIPS | 4594 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |