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 1708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1719 } else { | 1719 } else { |
1720 context()->Plug(rax); | 1720 context()->Plug(rax); |
1721 } | 1721 } |
1722 } | 1722 } |
1723 | 1723 |
1724 | 1724 |
1725 void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) { | 1725 void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) { |
1726 Comment cmnt(masm_, "[ ArrayLiteral"); | 1726 Comment cmnt(masm_, "[ ArrayLiteral"); |
1727 | 1727 |
1728 expr->BuildConstantElements(isolate()); | 1728 expr->BuildConstantElements(isolate()); |
| 1729 int flags = expr->depth() == 1 |
| 1730 ? ArrayLiteral::kShallowElements |
| 1731 : ArrayLiteral::kNoFlags; |
| 1732 |
1729 ZoneList<Expression*>* subexprs = expr->values(); | 1733 ZoneList<Expression*>* subexprs = expr->values(); |
1730 int length = subexprs->length(); | 1734 int length = subexprs->length(); |
1731 Handle<FixedArray> constant_elements = expr->constant_elements(); | 1735 Handle<FixedArray> constant_elements = expr->constant_elements(); |
1732 ASSERT_EQ(2, constant_elements->length()); | 1736 ASSERT_EQ(2, constant_elements->length()); |
1733 ElementsKind constant_elements_kind = | 1737 ElementsKind constant_elements_kind = |
1734 static_cast<ElementsKind>(Smi::cast(constant_elements->get(0))->value()); | 1738 static_cast<ElementsKind>(Smi::cast(constant_elements->get(0))->value()); |
1735 bool has_constant_fast_elements = | 1739 bool has_constant_fast_elements = |
1736 IsFastObjectElementsKind(constant_elements_kind); | 1740 IsFastObjectElementsKind(constant_elements_kind); |
1737 Handle<FixedArrayBase> constant_elements_values( | 1741 Handle<FixedArrayBase> constant_elements_values( |
1738 FixedArrayBase::cast(constant_elements->get(1))); | 1742 FixedArrayBase::cast(constant_elements->get(1))); |
(...skipping 12 matching lines...) Expand all Loading... |
1751 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS, | 1755 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS, |
1752 DONT_TRACK_ALLOCATION_SITE, | 1756 DONT_TRACK_ALLOCATION_SITE, |
1753 length); | 1757 length); |
1754 __ CallStub(&stub); | 1758 __ CallStub(&stub); |
1755 } else if (expr->depth() > 1 || Serializer::enabled() || | 1759 } else if (expr->depth() > 1 || Serializer::enabled() || |
1756 length > FastCloneShallowArrayStub::kMaximumClonedLength) { | 1760 length > FastCloneShallowArrayStub::kMaximumClonedLength) { |
1757 __ movq(rbx, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); | 1761 __ movq(rbx, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); |
1758 __ push(FieldOperand(rbx, JSFunction::kLiteralsOffset)); | 1762 __ push(FieldOperand(rbx, JSFunction::kLiteralsOffset)); |
1759 __ Push(Smi::FromInt(expr->literal_index())); | 1763 __ Push(Smi::FromInt(expr->literal_index())); |
1760 __ Push(constant_elements); | 1764 __ Push(constant_elements); |
1761 __ CallRuntime(Runtime::kCreateArrayLiteral, 3); | 1765 __ Push(Smi::FromInt(flags)); |
| 1766 __ CallRuntime(Runtime::kCreateArrayLiteral, 4); |
1762 } else { | 1767 } else { |
1763 ASSERT(IsFastSmiOrObjectElementsKind(constant_elements_kind) || | 1768 ASSERT(IsFastSmiOrObjectElementsKind(constant_elements_kind) || |
1764 FLAG_smi_only_arrays); | 1769 FLAG_smi_only_arrays); |
1765 FastCloneShallowArrayStub::Mode mode = | 1770 FastCloneShallowArrayStub::Mode mode = |
1766 FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS; | 1771 FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS; |
1767 AllocationSiteMode allocation_site_mode = FLAG_track_allocation_sites | 1772 AllocationSiteMode allocation_site_mode = FLAG_track_allocation_sites |
1768 ? TRACK_ALLOCATION_SITE : DONT_TRACK_ALLOCATION_SITE; | 1773 ? TRACK_ALLOCATION_SITE : DONT_TRACK_ALLOCATION_SITE; |
1769 | 1774 |
1770 // If the elements are already FAST_*_ELEMENTS, the boilerplate cannot | 1775 // If the elements are already FAST_*_ELEMENTS, the boilerplate cannot |
1771 // change, so it's possible to specialize the stub in advance. | 1776 // change, so it's possible to specialize the stub in advance. |
(...skipping 3165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4937 | 4942 |
4938 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 4943 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
4939 Assembler::target_address_at(call_target_address)); | 4944 Assembler::target_address_at(call_target_address)); |
4940 return OSR_AFTER_STACK_CHECK; | 4945 return OSR_AFTER_STACK_CHECK; |
4941 } | 4946 } |
4942 | 4947 |
4943 | 4948 |
4944 } } // namespace v8::internal | 4949 } } // namespace v8::internal |
4945 | 4950 |
4946 #endif // V8_TARGET_ARCH_X64 | 4951 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |