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 1660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1671 } else if (length > FastCloneShallowArrayStub::kMaximumClonedLength) { | 1671 } else if (length > FastCloneShallowArrayStub::kMaximumClonedLength) { |
1672 __ CallRuntime(Runtime::kCreateArrayLiteralShallow, 3); | 1672 __ CallRuntime(Runtime::kCreateArrayLiteralShallow, 3); |
1673 } else { | 1673 } else { |
1674 ASSERT(IsFastSmiOrObjectElementsKind(constant_elements_kind) || | 1674 ASSERT(IsFastSmiOrObjectElementsKind(constant_elements_kind) || |
1675 FLAG_smi_only_arrays); | 1675 FLAG_smi_only_arrays); |
1676 // If the elements are already FAST_*_ELEMENTS, the boilerplate cannot | 1676 // If the elements are already FAST_*_ELEMENTS, the boilerplate cannot |
1677 // change, so it's possible to specialize the stub in advance. | 1677 // change, so it's possible to specialize the stub in advance. |
1678 FastCloneShallowArrayStub::Mode mode = has_constant_fast_elements | 1678 FastCloneShallowArrayStub::Mode mode = has_constant_fast_elements |
1679 ? FastCloneShallowArrayStub::CLONE_ELEMENTS | 1679 ? FastCloneShallowArrayStub::CLONE_ELEMENTS |
1680 : FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS; | 1680 : FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS; |
| 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 } |
| 1689 |
1681 FastCloneShallowArrayStub stub(mode, length); | 1690 FastCloneShallowArrayStub stub(mode, length); |
1682 __ CallStub(&stub); | 1691 __ CallStub(&stub); |
1683 } | 1692 } |
1684 | 1693 |
1685 bool result_saved = false; // Is the result saved to the stack? | 1694 bool result_saved = false; // Is the result saved to the stack? |
1686 | 1695 |
1687 // Emit code to evaluate all the non-constant subexpressions and to store | 1696 // Emit code to evaluate all the non-constant subexpressions and to store |
1688 // them into the newly cloned array. | 1697 // them into the newly cloned array. |
1689 for (int i = 0; i < length; i++) { | 1698 for (int i = 0; i < length; i++) { |
1690 Expression* subexpr = subexprs->at(i); | 1699 Expression* subexpr = subexprs->at(i); |
(...skipping 2828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4519 *stack_depth = 0; | 4528 *stack_depth = 0; |
4520 *context_length = 0; | 4529 *context_length = 0; |
4521 return previous_; | 4530 return previous_; |
4522 } | 4531 } |
4523 | 4532 |
4524 #undef __ | 4533 #undef __ |
4525 | 4534 |
4526 } } // namespace v8::internal | 4535 } } // namespace v8::internal |
4527 | 4536 |
4528 #endif // V8_TARGET_ARCH_IA32 | 4537 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |