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_X87 | 5 #if V8_TARGET_ARCH_X87 |
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 1635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1646 context()->PlugTOS(); | 1646 context()->PlugTOS(); |
1647 } else { | 1647 } else { |
1648 context()->Plug(eax); | 1648 context()->Plug(eax); |
1649 } | 1649 } |
1650 } | 1650 } |
1651 | 1651 |
1652 | 1652 |
1653 void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) { | 1653 void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) { |
1654 Comment cmnt(masm_, "[ ArrayLiteral"); | 1654 Comment cmnt(masm_, "[ ArrayLiteral"); |
1655 | 1655 |
1656 expr->BuildConstantElements(isolate()); | |
1657 Handle<FixedArray> constant_elements = expr->constant_elements(); | 1656 Handle<FixedArray> constant_elements = expr->constant_elements(); |
1658 bool has_constant_fast_elements = | 1657 bool has_constant_fast_elements = |
1659 IsFastObjectElementsKind(expr->constant_elements_kind()); | 1658 IsFastObjectElementsKind(expr->constant_elements_kind()); |
1660 | 1659 |
1661 AllocationSiteMode allocation_site_mode = TRACK_ALLOCATION_SITE; | 1660 AllocationSiteMode allocation_site_mode = TRACK_ALLOCATION_SITE; |
1662 if (has_constant_fast_elements && !FLAG_allocation_site_pretenuring) { | 1661 if (has_constant_fast_elements && !FLAG_allocation_site_pretenuring) { |
1663 // If the only customer of allocation sites is transitioning, then | 1662 // If the only customer of allocation sites is transitioning, then |
1664 // we can turn it off if we don't have anywhere else to transition to. | 1663 // we can turn it off if we don't have anywhere else to transition to. |
1665 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE; | 1664 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE; |
1666 } | 1665 } |
(...skipping 30 matching lines...) Expand all Loading... |
1697 // is already set in the cloned array. | 1696 // is already set in the cloned array. |
1698 if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue; | 1697 if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue; |
1699 | 1698 |
1700 if (!result_saved) { | 1699 if (!result_saved) { |
1701 __ push(eax); // array literal. | 1700 __ push(eax); // array literal. |
1702 __ push(Immediate(Smi::FromInt(expr->literal_index()))); | 1701 __ push(Immediate(Smi::FromInt(expr->literal_index()))); |
1703 result_saved = true; | 1702 result_saved = true; |
1704 } | 1703 } |
1705 VisitForAccumulatorValue(subexpr); | 1704 VisitForAccumulatorValue(subexpr); |
1706 | 1705 |
1707 if (has_constant_fast_elements) { | 1706 if (FLAG_vector_stores) { |
| 1707 __ mov(StoreDescriptor::NameRegister(), |
| 1708 Immediate(Smi::FromInt(array_index))); |
| 1709 __ mov(StoreDescriptor::ReceiverRegister(), Operand(esp, kPointerSize)); |
| 1710 EmitLoadStoreICSlot(expr->LiteralFeedbackSlot()); |
| 1711 Handle<Code> ic = |
| 1712 CodeFactory::KeyedStoreIC(isolate(), language_mode()).code(); |
| 1713 CallIC(ic); |
| 1714 } else if (has_constant_fast_elements) { |
1708 // Fast-case array literal with ElementsKind of FAST_*_ELEMENTS, they | 1715 // Fast-case array literal with ElementsKind of FAST_*_ELEMENTS, they |
1709 // cannot transition and don't need to call the runtime stub. | 1716 // cannot transition and don't need to call the runtime stub. |
1710 int offset = FixedArray::kHeaderSize + (array_index * kPointerSize); | 1717 int offset = FixedArray::kHeaderSize + (array_index * kPointerSize); |
1711 __ mov(ebx, Operand(esp, kPointerSize)); // Copy of array literal. | 1718 __ mov(ebx, Operand(esp, kPointerSize)); // Copy of array literal. |
1712 __ mov(ebx, FieldOperand(ebx, JSObject::kElementsOffset)); | 1719 __ mov(ebx, FieldOperand(ebx, JSObject::kElementsOffset)); |
1713 // Store the subexpression value in the array's elements. | 1720 // Store the subexpression value in the array's elements. |
1714 __ mov(FieldOperand(ebx, offset), result_register()); | 1721 __ mov(FieldOperand(ebx, offset), result_register()); |
1715 // Update the write barrier for the array store. | 1722 // Update the write barrier for the array store. |
1716 __ RecordWriteField(ebx, offset, result_register(), ecx, kDontSaveFPRegs, | 1723 __ RecordWriteField(ebx, offset, result_register(), ecx, kDontSaveFPRegs, |
1717 EMIT_REMEMBERED_SET, INLINE_SMI_CHECK); | 1724 EMIT_REMEMBERED_SET, INLINE_SMI_CHECK); |
(...skipping 3323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5041 Assembler::target_address_at(call_target_address, | 5048 Assembler::target_address_at(call_target_address, |
5042 unoptimized_code)); | 5049 unoptimized_code)); |
5043 return OSR_AFTER_STACK_CHECK; | 5050 return OSR_AFTER_STACK_CHECK; |
5044 } | 5051 } |
5045 | 5052 |
5046 | 5053 |
5047 } // namespace internal | 5054 } // namespace internal |
5048 } // namespace v8 | 5055 } // namespace v8 |
5049 | 5056 |
5050 #endif // V8_TARGET_ARCH_X87 | 5057 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |