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 1752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1763 } else { | 1763 } else { |
1764 context()->Plug(r0); | 1764 context()->Plug(r0); |
1765 } | 1765 } |
1766 } | 1766 } |
1767 | 1767 |
1768 | 1768 |
1769 void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) { | 1769 void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) { |
1770 Comment cmnt(masm_, "[ ArrayLiteral"); | 1770 Comment cmnt(masm_, "[ ArrayLiteral"); |
1771 | 1771 |
1772 expr->BuildConstantElements(isolate()); | 1772 expr->BuildConstantElements(isolate()); |
| 1773 int flags = expr->depth() == 1 |
| 1774 ? ArrayLiteral::kShallowElements |
| 1775 : ArrayLiteral::kNoFlags; |
| 1776 |
1773 ZoneList<Expression*>* subexprs = expr->values(); | 1777 ZoneList<Expression*>* subexprs = expr->values(); |
1774 int length = subexprs->length(); | 1778 int length = subexprs->length(); |
1775 Handle<FixedArray> constant_elements = expr->constant_elements(); | 1779 Handle<FixedArray> constant_elements = expr->constant_elements(); |
1776 ASSERT_EQ(2, constant_elements->length()); | 1780 ASSERT_EQ(2, constant_elements->length()); |
1777 ElementsKind constant_elements_kind = | 1781 ElementsKind constant_elements_kind = |
1778 static_cast<ElementsKind>(Smi::cast(constant_elements->get(0))->value()); | 1782 static_cast<ElementsKind>(Smi::cast(constant_elements->get(0))->value()); |
1779 bool has_fast_elements = IsFastObjectElementsKind(constant_elements_kind); | 1783 bool has_fast_elements = IsFastObjectElementsKind(constant_elements_kind); |
1780 Handle<FixedArrayBase> constant_elements_values( | 1784 Handle<FixedArrayBase> constant_elements_values( |
1781 FixedArrayBase::cast(constant_elements->get(1))); | 1785 FixedArrayBase::cast(constant_elements->get(1))); |
1782 | 1786 |
1783 __ ldr(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 1787 __ ldr(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
1784 __ ldr(r3, FieldMemOperand(r3, JSFunction::kLiteralsOffset)); | 1788 __ ldr(r3, FieldMemOperand(r3, JSFunction::kLiteralsOffset)); |
1785 __ mov(r2, Operand(Smi::FromInt(expr->literal_index()))); | 1789 __ mov(r2, Operand(Smi::FromInt(expr->literal_index()))); |
1786 __ mov(r1, Operand(constant_elements)); | 1790 __ mov(r1, Operand(constant_elements)); |
1787 if (has_fast_elements && constant_elements_values->map() == | 1791 if (has_fast_elements && constant_elements_values->map() == |
1788 isolate()->heap()->fixed_cow_array_map()) { | 1792 isolate()->heap()->fixed_cow_array_map()) { |
1789 FastCloneShallowArrayStub stub( | 1793 FastCloneShallowArrayStub stub( |
1790 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS, | 1794 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS, |
1791 DONT_TRACK_ALLOCATION_SITE, | 1795 DONT_TRACK_ALLOCATION_SITE, |
1792 length); | 1796 length); |
1793 __ CallStub(&stub); | 1797 __ CallStub(&stub); |
1794 __ IncrementCounter( | 1798 __ IncrementCounter( |
1795 isolate()->counters()->cow_arrays_created_stub(), 1, r1, r2); | 1799 isolate()->counters()->cow_arrays_created_stub(), 1, r1, r2); |
1796 } else if (expr->depth() > 1 || Serializer::enabled() || | 1800 } else if (expr->depth() > 1 || Serializer::enabled() || |
1797 length > FastCloneShallowArrayStub::kMaximumClonedLength) { | 1801 length > FastCloneShallowArrayStub::kMaximumClonedLength) { |
1798 __ Push(r3, r2, r1); | 1802 __ mov(r0, Operand(Smi::FromInt(flags))); |
1799 __ CallRuntime(Runtime::kCreateArrayLiteral, 3); | 1803 __ Push(r3, r2, r1, r0); |
| 1804 __ CallRuntime(Runtime::kCreateArrayLiteral, 4); |
1800 } else { | 1805 } else { |
1801 ASSERT(IsFastSmiOrObjectElementsKind(constant_elements_kind) || | 1806 ASSERT(IsFastSmiOrObjectElementsKind(constant_elements_kind) || |
1802 FLAG_smi_only_arrays); | 1807 FLAG_smi_only_arrays); |
1803 FastCloneShallowArrayStub::Mode mode = | 1808 FastCloneShallowArrayStub::Mode mode = |
1804 FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS; | 1809 FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS; |
1805 AllocationSiteMode allocation_site_mode = FLAG_track_allocation_sites | 1810 AllocationSiteMode allocation_site_mode = FLAG_track_allocation_sites |
1806 ? TRACK_ALLOCATION_SITE : DONT_TRACK_ALLOCATION_SITE; | 1811 ? TRACK_ALLOCATION_SITE : DONT_TRACK_ALLOCATION_SITE; |
1807 | 1812 |
1808 if (has_fast_elements) { | 1813 if (has_fast_elements) { |
1809 mode = FastCloneShallowArrayStub::CLONE_ELEMENTS; | 1814 mode = FastCloneShallowArrayStub::CLONE_ELEMENTS; |
(...skipping 3153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4963 ASSERT(Memory::uint32_at(interrupt_address_pointer) == | 4968 ASSERT(Memory::uint32_at(interrupt_address_pointer) == |
4964 reinterpret_cast<uint32_t>( | 4969 reinterpret_cast<uint32_t>( |
4965 isolate->builtins()->OsrAfterStackCheck()->entry())); | 4970 isolate->builtins()->OsrAfterStackCheck()->entry())); |
4966 return OSR_AFTER_STACK_CHECK; | 4971 return OSR_AFTER_STACK_CHECK; |
4967 } | 4972 } |
4968 | 4973 |
4969 | 4974 |
4970 } } // namespace v8::internal | 4975 } } // namespace v8::internal |
4971 | 4976 |
4972 #endif // V8_TARGET_ARCH_ARM | 4977 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |