OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #if V8_TARGET_ARCH_X64 | 5 #if V8_TARGET_ARCH_X64 |
6 | 6 |
7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
10 #include "src/debug/debug.h" | 10 #include "src/debug/debug.h" |
(...skipping 1684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1695 context()->PlugTOS(); | 1695 context()->PlugTOS(); |
1696 } else { | 1696 } else { |
1697 context()->Plug(rax); | 1697 context()->Plug(rax); |
1698 } | 1698 } |
1699 } | 1699 } |
1700 | 1700 |
1701 | 1701 |
1702 void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) { | 1702 void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) { |
1703 Comment cmnt(masm_, "[ ArrayLiteral"); | 1703 Comment cmnt(masm_, "[ ArrayLiteral"); |
1704 | 1704 |
1705 expr->BuildConstantElements(isolate()); | |
1706 Handle<FixedArray> constant_elements = expr->constant_elements(); | 1705 Handle<FixedArray> constant_elements = expr->constant_elements(); |
1707 bool has_constant_fast_elements = | 1706 bool has_constant_fast_elements = |
1708 IsFastObjectElementsKind(expr->constant_elements_kind()); | 1707 IsFastObjectElementsKind(expr->constant_elements_kind()); |
1709 | 1708 |
1710 AllocationSiteMode allocation_site_mode = TRACK_ALLOCATION_SITE; | 1709 AllocationSiteMode allocation_site_mode = TRACK_ALLOCATION_SITE; |
1711 if (has_constant_fast_elements && !FLAG_allocation_site_pretenuring) { | 1710 if (has_constant_fast_elements && !FLAG_allocation_site_pretenuring) { |
1712 // If the only customer of allocation sites is transitioning, then | 1711 // If the only customer of allocation sites is transitioning, then |
1713 // we can turn it off if we don't have anywhere else to transition to. | 1712 // we can turn it off if we don't have anywhere else to transition to. |
1714 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE; | 1713 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE; |
1715 } | 1714 } |
(...skipping 30 matching lines...) Expand all Loading... |
1746 // is already set in the cloned array. | 1745 // is already set in the cloned array. |
1747 if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue; | 1746 if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue; |
1748 | 1747 |
1749 if (!result_saved) { | 1748 if (!result_saved) { |
1750 __ Push(rax); // array literal | 1749 __ Push(rax); // array literal |
1751 __ Push(Smi::FromInt(expr->literal_index())); | 1750 __ Push(Smi::FromInt(expr->literal_index())); |
1752 result_saved = true; | 1751 result_saved = true; |
1753 } | 1752 } |
1754 VisitForAccumulatorValue(subexpr); | 1753 VisitForAccumulatorValue(subexpr); |
1755 | 1754 |
1756 if (has_constant_fast_elements) { | 1755 if (FLAG_vector_stores) { |
| 1756 __ Move(StoreDescriptor::NameRegister(), Smi::FromInt(array_index)); |
| 1757 __ movp(StoreDescriptor::ReceiverRegister(), Operand(rsp, kPointerSize)); |
| 1758 EmitLoadStoreICSlot(expr->LiteralFeedbackSlot()); |
| 1759 Handle<Code> ic = |
| 1760 CodeFactory::KeyedStoreIC(isolate(), language_mode()).code(); |
| 1761 CallIC(ic); |
| 1762 } else if (has_constant_fast_elements) { |
1757 // Fast-case array literal with ElementsKind of FAST_*_ELEMENTS, they | 1763 // Fast-case array literal with ElementsKind of FAST_*_ELEMENTS, they |
1758 // cannot transition and don't need to call the runtime stub. | 1764 // cannot transition and don't need to call the runtime stub. |
1759 int offset = FixedArray::kHeaderSize + (array_index * kPointerSize); | 1765 int offset = FixedArray::kHeaderSize + (array_index * kPointerSize); |
1760 __ movp(rbx, Operand(rsp, kPointerSize)); // Copy of array literal. | 1766 __ movp(rbx, Operand(rsp, kPointerSize)); // Copy of array literal. |
1761 __ movp(rbx, FieldOperand(rbx, JSObject::kElementsOffset)); | 1767 __ movp(rbx, FieldOperand(rbx, JSObject::kElementsOffset)); |
1762 // Store the subexpression value in the array's elements. | 1768 // Store the subexpression value in the array's elements. |
1763 __ movp(FieldOperand(rbx, offset), result_register()); | 1769 __ movp(FieldOperand(rbx, offset), result_register()); |
1764 // Update the write barrier for the array store. | 1770 // Update the write barrier for the array store. |
1765 __ RecordWriteField(rbx, offset, result_register(), rcx, | 1771 __ RecordWriteField(rbx, offset, result_register(), rcx, |
1766 kDontSaveFPRegs, | 1772 kDontSaveFPRegs, |
(...skipping 3400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5167 Assembler::target_address_at(call_target_address, | 5173 Assembler::target_address_at(call_target_address, |
5168 unoptimized_code)); | 5174 unoptimized_code)); |
5169 return OSR_AFTER_STACK_CHECK; | 5175 return OSR_AFTER_STACK_CHECK; |
5170 } | 5176 } |
5171 | 5177 |
5172 | 5178 |
5173 } // namespace internal | 5179 } // namespace internal |
5174 } // namespace v8 | 5180 } // namespace v8 |
5175 | 5181 |
5176 #endif // V8_TARGET_ARCH_X64 | 5182 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |