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 1685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1696 } else if (length > FastCloneShallowArrayStub::kMaximumClonedLength) { | 1696 } else if (length > FastCloneShallowArrayStub::kMaximumClonedLength) { |
1697 __ CallRuntime(Runtime::kCreateArrayLiteralShallow, 3); | 1697 __ CallRuntime(Runtime::kCreateArrayLiteralShallow, 3); |
1698 } else { | 1698 } else { |
1699 ASSERT(IsFastSmiOrObjectElementsKind(constant_elements_kind) || | 1699 ASSERT(IsFastSmiOrObjectElementsKind(constant_elements_kind) || |
1700 FLAG_smi_only_arrays); | 1700 FLAG_smi_only_arrays); |
1701 // If the elements are already FAST_*_ELEMENTS, the boilerplate cannot | 1701 // If the elements are already FAST_*_ELEMENTS, the boilerplate cannot |
1702 // change, so it's possible to specialize the stub in advance. | 1702 // change, so it's possible to specialize the stub in advance. |
1703 FastCloneShallowArrayStub::Mode mode = has_constant_fast_elements | 1703 FastCloneShallowArrayStub::Mode mode = has_constant_fast_elements |
1704 ? FastCloneShallowArrayStub::CLONE_ELEMENTS | 1704 ? FastCloneShallowArrayStub::CLONE_ELEMENTS |
1705 : FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS; | 1705 : FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS; |
| 1706 |
| 1707 // Tracking allocation info allows us to pre-transition later if it makes |
| 1708 // sense. |
| 1709 if (mode == FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS && |
| 1710 FLAG_track_allocation_sites) { |
| 1711 mode = FastCloneShallowArrayStub:: |
| 1712 CLONE_ANY_ELEMENTS_WITH_ALLOCATION_SITE_INFO; |
| 1713 } |
| 1714 |
1706 FastCloneShallowArrayStub stub(mode, length); | 1715 FastCloneShallowArrayStub stub(mode, length); |
1707 __ CallStub(&stub); | 1716 __ CallStub(&stub); |
1708 } | 1717 } |
1709 | 1718 |
1710 bool result_saved = false; // Is the result saved to the stack? | 1719 bool result_saved = false; // Is the result saved to the stack? |
1711 | 1720 |
1712 // Emit code to evaluate all the non-constant subexpressions and to store | 1721 // Emit code to evaluate all the non-constant subexpressions and to store |
1713 // them into the newly cloned array. | 1722 // them into the newly cloned array. |
1714 for (int i = 0; i < length; i++) { | 1723 for (int i = 0; i < length; i++) { |
1715 Expression* subexpr = subexprs->at(i); | 1724 Expression* subexpr = subexprs->at(i); |
(...skipping 2802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4518 *context_length = 0; | 4527 *context_length = 0; |
4519 return previous_; | 4528 return previous_; |
4520 } | 4529 } |
4521 | 4530 |
4522 | 4531 |
4523 #undef __ | 4532 #undef __ |
4524 | 4533 |
4525 } } // namespace v8::internal | 4534 } } // namespace v8::internal |
4526 | 4535 |
4527 #endif // V8_TARGET_ARCH_X64 | 4536 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |