| 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 1646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1657 __ push(Immediate(Smi::FromInt(expr->literal_index()))); | 1657 __ push(Immediate(Smi::FromInt(expr->literal_index()))); |
| 1658 __ push(Immediate(constant_elements)); | 1658 __ push(Immediate(constant_elements)); |
| 1659 Heap* heap = isolate()->heap(); | 1659 Heap* heap = isolate()->heap(); |
| 1660 if (has_constant_fast_elements && | 1660 if (has_constant_fast_elements && |
| 1661 constant_elements_values->map() == heap->fixed_cow_array_map()) { | 1661 constant_elements_values->map() == heap->fixed_cow_array_map()) { |
| 1662 // If the elements are already FAST_*_ELEMENTS, the boilerplate cannot | 1662 // If the elements are already FAST_*_ELEMENTS, the boilerplate cannot |
| 1663 // change, so it's possible to specialize the stub in advance. | 1663 // change, so it's possible to specialize the stub in advance. |
| 1664 __ IncrementCounter(isolate()->counters()->cow_arrays_created_stub(), 1); | 1664 __ IncrementCounter(isolate()->counters()->cow_arrays_created_stub(), 1); |
| 1665 FastCloneShallowArrayStub stub( | 1665 FastCloneShallowArrayStub stub( |
| 1666 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS, | 1666 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS, |
| 1667 DONT_TRACK_ALLOCATION_SITE, |
| 1667 length); | 1668 length); |
| 1668 __ CallStub(&stub); | 1669 __ CallStub(&stub); |
| 1669 } else if (expr->depth() > 1) { | 1670 } else if (expr->depth() > 1) { |
| 1670 __ CallRuntime(Runtime::kCreateArrayLiteral, 3); | 1671 __ CallRuntime(Runtime::kCreateArrayLiteral, 3); |
| 1671 } else if (length > FastCloneShallowArrayStub::kMaximumClonedLength) { | 1672 } else if (length > FastCloneShallowArrayStub::kMaximumClonedLength) { |
| 1672 __ CallRuntime(Runtime::kCreateArrayLiteralShallow, 3); | 1673 __ CallRuntime(Runtime::kCreateArrayLiteralShallow, 3); |
| 1673 } else { | 1674 } else { |
| 1674 ASSERT(IsFastSmiOrObjectElementsKind(constant_elements_kind) || | 1675 ASSERT(IsFastSmiOrObjectElementsKind(constant_elements_kind) || |
| 1675 FLAG_smi_only_arrays); | 1676 FLAG_smi_only_arrays); |
| 1677 FastCloneShallowArrayStub::Mode mode = |
| 1678 FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS; |
| 1679 AllocationSiteMode allocation_site_mode = FLAG_track_allocation_sites |
| 1680 ? TRACK_ALLOCATION_SITE : DONT_TRACK_ALLOCATION_SITE; |
| 1681 |
| 1676 // If the elements are already FAST_*_ELEMENTS, the boilerplate cannot | 1682 // If the elements are already FAST_*_ELEMENTS, the boilerplate cannot |
| 1677 // change, so it's possible to specialize the stub in advance. | 1683 // change, so it's possible to specialize the stub in advance. |
| 1678 FastCloneShallowArrayStub::Mode mode = has_constant_fast_elements | 1684 if (has_constant_fast_elements) { |
| 1679 ? FastCloneShallowArrayStub::CLONE_ELEMENTS | 1685 mode = FastCloneShallowArrayStub::CLONE_ELEMENTS; |
| 1680 : FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS; | 1686 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE; |
| 1681 | |
| 1682 // Tracking allocation info allows us to pre-transition later if it makes | |
| 1683 // sense. | |
| 1684 if (mode == FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS && | |
| 1685 FLAG_track_allocation_sites) { | |
| 1686 mode = FastCloneShallowArrayStub:: | |
| 1687 CLONE_ANY_ELEMENTS_WITH_ALLOCATION_SITE_INFO; | |
| 1688 } | 1687 } |
| 1689 | 1688 |
| 1690 FastCloneShallowArrayStub stub(mode, length); | 1689 FastCloneShallowArrayStub stub(mode, allocation_site_mode, length); |
| 1691 __ CallStub(&stub); | 1690 __ CallStub(&stub); |
| 1692 } | 1691 } |
| 1693 | 1692 |
| 1694 bool result_saved = false; // Is the result saved to the stack? | 1693 bool result_saved = false; // Is the result saved to the stack? |
| 1695 | 1694 |
| 1696 // Emit code to evaluate all the non-constant subexpressions and to store | 1695 // Emit code to evaluate all the non-constant subexpressions and to store |
| 1697 // them into the newly cloned array. | 1696 // them into the newly cloned array. |
| 1698 for (int i = 0; i < length; i++) { | 1697 for (int i = 0; i < length; i++) { |
| 1699 Expression* subexpr = subexprs->at(i); | 1698 Expression* subexpr = subexprs->at(i); |
| 1700 // If the subexpression is a literal or a simple materialized literal it | 1699 // If the subexpression is a literal or a simple materialized literal it |
| (...skipping 2826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4527 *stack_depth = 0; | 4526 *stack_depth = 0; |
| 4528 *context_length = 0; | 4527 *context_length = 0; |
| 4529 return previous_; | 4528 return previous_; |
| 4530 } | 4529 } |
| 4531 | 4530 |
| 4532 #undef __ | 4531 #undef __ |
| 4533 | 4532 |
| 4534 } } // namespace v8::internal | 4533 } } // namespace v8::internal |
| 4535 | 4534 |
| 4536 #endif // V8_TARGET_ARCH_IA32 | 4535 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |