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 1687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1698 } else { | 1698 } else { |
1699 context()->Plug(eax); | 1699 context()->Plug(eax); |
1700 } | 1700 } |
1701 } | 1701 } |
1702 | 1702 |
1703 | 1703 |
1704 void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) { | 1704 void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) { |
1705 Comment cmnt(masm_, "[ ArrayLiteral"); | 1705 Comment cmnt(masm_, "[ ArrayLiteral"); |
1706 | 1706 |
1707 expr->BuildConstantElements(isolate()); | 1707 expr->BuildConstantElements(isolate()); |
| 1708 int flags = expr->depth() == 1 |
| 1709 ? ArrayLiteral::kShallowElements |
| 1710 : ArrayLiteral::kNoFlags; |
| 1711 |
1708 ZoneList<Expression*>* subexprs = expr->values(); | 1712 ZoneList<Expression*>* subexprs = expr->values(); |
1709 int length = subexprs->length(); | 1713 int length = subexprs->length(); |
1710 Handle<FixedArray> constant_elements = expr->constant_elements(); | 1714 Handle<FixedArray> constant_elements = expr->constant_elements(); |
1711 ASSERT_EQ(2, constant_elements->length()); | 1715 ASSERT_EQ(2, constant_elements->length()); |
1712 ElementsKind constant_elements_kind = | 1716 ElementsKind constant_elements_kind = |
1713 static_cast<ElementsKind>(Smi::cast(constant_elements->get(0))->value()); | 1717 static_cast<ElementsKind>(Smi::cast(constant_elements->get(0))->value()); |
1714 bool has_constant_fast_elements = | 1718 bool has_constant_fast_elements = |
1715 IsFastObjectElementsKind(constant_elements_kind); | 1719 IsFastObjectElementsKind(constant_elements_kind); |
1716 Handle<FixedArrayBase> constant_elements_values( | 1720 Handle<FixedArrayBase> constant_elements_values( |
1717 FixedArrayBase::cast(constant_elements->get(1))); | 1721 FixedArrayBase::cast(constant_elements->get(1))); |
(...skipping 12 matching lines...) Expand all Loading... |
1730 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS, | 1734 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS, |
1731 DONT_TRACK_ALLOCATION_SITE, | 1735 DONT_TRACK_ALLOCATION_SITE, |
1732 length); | 1736 length); |
1733 __ CallStub(&stub); | 1737 __ CallStub(&stub); |
1734 } else if (expr->depth() > 1 || Serializer::enabled() || | 1738 } else if (expr->depth() > 1 || Serializer::enabled() || |
1735 length > FastCloneShallowArrayStub::kMaximumClonedLength) { | 1739 length > FastCloneShallowArrayStub::kMaximumClonedLength) { |
1736 __ mov(ebx, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); | 1740 __ mov(ebx, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); |
1737 __ push(FieldOperand(ebx, JSFunction::kLiteralsOffset)); | 1741 __ push(FieldOperand(ebx, JSFunction::kLiteralsOffset)); |
1738 __ push(Immediate(Smi::FromInt(expr->literal_index()))); | 1742 __ push(Immediate(Smi::FromInt(expr->literal_index()))); |
1739 __ push(Immediate(constant_elements)); | 1743 __ push(Immediate(constant_elements)); |
1740 __ CallRuntime(Runtime::kCreateArrayLiteral, 3); | 1744 __ push(Immediate(Smi::FromInt(flags))); |
| 1745 __ CallRuntime(Runtime::kCreateArrayLiteral, 4); |
1741 } else { | 1746 } else { |
1742 ASSERT(IsFastSmiOrObjectElementsKind(constant_elements_kind) || | 1747 ASSERT(IsFastSmiOrObjectElementsKind(constant_elements_kind) || |
1743 FLAG_smi_only_arrays); | 1748 FLAG_smi_only_arrays); |
1744 FastCloneShallowArrayStub::Mode mode = | 1749 FastCloneShallowArrayStub::Mode mode = |
1745 FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS; | 1750 FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS; |
1746 AllocationSiteMode allocation_site_mode = FLAG_track_allocation_sites | 1751 AllocationSiteMode allocation_site_mode = FLAG_track_allocation_sites |
1747 ? TRACK_ALLOCATION_SITE : DONT_TRACK_ALLOCATION_SITE; | 1752 ? TRACK_ALLOCATION_SITE : DONT_TRACK_ALLOCATION_SITE; |
1748 | 1753 |
1749 // If the elements are already FAST_*_ELEMENTS, the boilerplate cannot | 1754 // If the elements are already FAST_*_ELEMENTS, the boilerplate cannot |
1750 // change, so it's possible to specialize the stub in advance. | 1755 // change, so it's possible to specialize the stub in advance. |
(...skipping 3203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4954 | 4959 |
4955 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 4960 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
4956 Assembler::target_address_at(call_target_address)); | 4961 Assembler::target_address_at(call_target_address)); |
4957 return OSR_AFTER_STACK_CHECK; | 4962 return OSR_AFTER_STACK_CHECK; |
4958 } | 4963 } |
4959 | 4964 |
4960 | 4965 |
4961 } } // namespace v8::internal | 4966 } } // namespace v8::internal |
4962 | 4967 |
4963 #endif // V8_TARGET_ARCH_IA32 | 4968 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |