Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(56)

Side by Side Diff: src/full-codegen/ia32/full-codegen-ia32.cc

Issue 1405503002: VectorICs: use a vector slot to aid in array literal processing. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Code comments. Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_IA32 5 #if V8_TARGET_ARCH_IA32
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 1657 matching lines...) Expand 10 before | Expand all | Expand 10 after
1668 context()->PlugTOS(); 1668 context()->PlugTOS();
1669 } else { 1669 } else {
1670 context()->Plug(eax); 1670 context()->Plug(eax);
1671 } 1671 }
1672 } 1672 }
1673 1673
1674 1674
1675 void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) { 1675 void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
1676 Comment cmnt(masm_, "[ ArrayLiteral"); 1676 Comment cmnt(masm_, "[ ArrayLiteral");
1677 1677
1678 expr->BuildConstantElements(isolate());
1679 Handle<FixedArray> constant_elements = expr->constant_elements(); 1678 Handle<FixedArray> constant_elements = expr->constant_elements();
1680 bool has_constant_fast_elements = 1679 bool has_constant_fast_elements =
1681 IsFastObjectElementsKind(expr->constant_elements_kind()); 1680 IsFastObjectElementsKind(expr->constant_elements_kind());
1682 1681
1683 AllocationSiteMode allocation_site_mode = TRACK_ALLOCATION_SITE; 1682 AllocationSiteMode allocation_site_mode = TRACK_ALLOCATION_SITE;
1684 if (has_constant_fast_elements && !FLAG_allocation_site_pretenuring) { 1683 if (has_constant_fast_elements && !FLAG_allocation_site_pretenuring) {
1685 // If the only customer of allocation sites is transitioning, then 1684 // If the only customer of allocation sites is transitioning, then
1686 // we can turn it off if we don't have anywhere else to transition to. 1685 // we can turn it off if we don't have anywhere else to transition to.
1687 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE; 1686 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE;
1688 } 1687 }
(...skipping 30 matching lines...) Expand all
1719 // is already set in the cloned array. 1718 // is already set in the cloned array.
1720 if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue; 1719 if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue;
1721 1720
1722 if (!result_saved) { 1721 if (!result_saved) {
1723 __ push(eax); // array literal. 1722 __ push(eax); // array literal.
1724 __ push(Immediate(Smi::FromInt(expr->literal_index()))); 1723 __ push(Immediate(Smi::FromInt(expr->literal_index())));
1725 result_saved = true; 1724 result_saved = true;
1726 } 1725 }
1727 VisitForAccumulatorValue(subexpr); 1726 VisitForAccumulatorValue(subexpr);
1728 1727
1729 if (has_constant_fast_elements) { 1728 if (FLAG_vector_stores) {
1729 __ mov(StoreDescriptor::NameRegister(),
1730 Immediate(Smi::FromInt(array_index)));
1731 __ mov(StoreDescriptor::ReceiverRegister(), Operand(esp, kPointerSize));
1732 EmitLoadStoreICSlot(expr->LiteralFeedbackSlot());
1733 Handle<Code> ic =
1734 CodeFactory::KeyedStoreIC(isolate(), language_mode()).code();
1735 CallIC(ic);
1736 } else if (has_constant_fast_elements) {
1730 // Fast-case array literal with ElementsKind of FAST_*_ELEMENTS, they 1737 // Fast-case array literal with ElementsKind of FAST_*_ELEMENTS, they
1731 // cannot transition and don't need to call the runtime stub. 1738 // cannot transition and don't need to call the runtime stub.
1732 int offset = FixedArray::kHeaderSize + (array_index * kPointerSize); 1739 int offset = FixedArray::kHeaderSize + (array_index * kPointerSize);
1733 __ mov(ebx, Operand(esp, kPointerSize)); // Copy of array literal. 1740 __ mov(ebx, Operand(esp, kPointerSize)); // Copy of array literal.
1734 __ mov(ebx, FieldOperand(ebx, JSObject::kElementsOffset)); 1741 __ mov(ebx, FieldOperand(ebx, JSObject::kElementsOffset));
1735 // Store the subexpression value in the array's elements. 1742 // Store the subexpression value in the array's elements.
1736 __ mov(FieldOperand(ebx, offset), result_register()); 1743 __ mov(FieldOperand(ebx, offset), result_register());
1737 // Update the write barrier for the array store. 1744 // Update the write barrier for the array store.
1738 __ RecordWriteField(ebx, offset, result_register(), ecx, 1745 __ RecordWriteField(ebx, offset, result_register(), ecx, kDontSaveFPRegs,
1739 kDontSaveFPRegs, 1746 EMIT_REMEMBERED_SET, INLINE_SMI_CHECK);
1740 EMIT_REMEMBERED_SET,
1741 INLINE_SMI_CHECK);
1742 } else { 1747 } else {
1743 // Store the subexpression value in the array's elements. 1748 // Store the subexpression value in the array's elements.
1744 __ mov(ecx, Immediate(Smi::FromInt(array_index))); 1749 __ mov(ecx, Immediate(Smi::FromInt(array_index)));
1745 StoreArrayLiteralElementStub stub(isolate()); 1750 StoreArrayLiteralElementStub stub(isolate());
1746 __ CallStub(&stub); 1751 __ CallStub(&stub);
1747 } 1752 }
1748
1749 PrepareForBailoutForId(expr->GetIdForElement(array_index), NO_REGISTERS); 1753 PrepareForBailoutForId(expr->GetIdForElement(array_index), NO_REGISTERS);
1750 } 1754 }
1751 1755
1752 // In case the array literal contains spread expressions it has two parts. The 1756 // In case the array literal contains spread expressions it has two parts. The
1753 // first part is the "static" array which has a literal index is handled 1757 // first part is the "static" array which has a literal index is handled
1754 // above. The second part is the part after the first spread expression 1758 // above. The second part is the part after the first spread expression
1755 // (inclusive) and these elements gets appended to the array. Note that the 1759 // (inclusive) and these elements gets appended to the array. Note that the
1756 // number elements an iterable produces is unknown ahead of time. 1760 // number elements an iterable produces is unknown ahead of time.
1757 if (array_index < length && result_saved) { 1761 if (array_index < length && result_saved) {
1758 __ Drop(1); // literal index 1762 __ Drop(1); // literal index
(...skipping 3393 matching lines...) Expand 10 before | Expand all | Expand 10 after
5152 Assembler::target_address_at(call_target_address, 5156 Assembler::target_address_at(call_target_address,
5153 unoptimized_code)); 5157 unoptimized_code));
5154 return OSR_AFTER_STACK_CHECK; 5158 return OSR_AFTER_STACK_CHECK;
5155 } 5159 }
5156 5160
5157 5161
5158 } // namespace internal 5162 } // namespace internal
5159 } // namespace v8 5163 } // namespace v8
5160 5164
5161 #endif // V8_TARGET_ARCH_IA32 5165 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/full-codegen/arm64/full-codegen-arm64.cc ('k') | src/full-codegen/mips/full-codegen-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698