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

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

Issue 1471893003: [compiler] No need to push literal index in VisitArrayLiteral. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Comment Created 5 years 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
« no previous file with comments | « src/full-codegen/mips/full-codegen-mips.cc ('k') | src/full-codegen/x64/full-codegen-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_MIPS64 5 #if V8_TARGET_ARCH_MIPS64
6 6
7 // Note on Mips implementation: 7 // Note on Mips implementation:
8 // 8 //
9 // The result_register() for mips is the 'v0' register, which is defined 9 // The result_register() for mips is the 'v0' register, which is defined
10 // by the ABI to contain function return values. However, the first 10 // by the ABI to contain function return values. However, the first
(...skipping 1746 matching lines...) Expand 10 before | Expand all | Expand 10 after
1757 for (; array_index < length; array_index++) { 1757 for (; array_index < length; array_index++) {
1758 Expression* subexpr = subexprs->at(array_index); 1758 Expression* subexpr = subexprs->at(array_index);
1759 if (subexpr->IsSpread()) break; 1759 if (subexpr->IsSpread()) break;
1760 1760
1761 // If the subexpression is a literal or a simple materialized literal it 1761 // If the subexpression is a literal or a simple materialized literal it
1762 // is already set in the cloned array. 1762 // is already set in the cloned array.
1763 if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue; 1763 if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue;
1764 1764
1765 if (!result_saved) { 1765 if (!result_saved) {
1766 __ push(v0); // array literal 1766 __ push(v0); // array literal
1767 __ Push(Smi::FromInt(expr->literal_index()));
1768 result_saved = true; 1767 result_saved = true;
1769 } 1768 }
1770 1769
1771 VisitForAccumulatorValue(subexpr); 1770 VisitForAccumulatorValue(subexpr);
1772 1771
1773 __ li(StoreDescriptor::NameRegister(), Operand(Smi::FromInt(array_index))); 1772 __ li(StoreDescriptor::NameRegister(), Operand(Smi::FromInt(array_index)));
1774 __ ld(StoreDescriptor::ReceiverRegister(), MemOperand(sp, kPointerSize)); 1773 __ ld(StoreDescriptor::ReceiverRegister(), MemOperand(sp, 0));
1775 __ mov(StoreDescriptor::ValueRegister(), result_register()); 1774 __ mov(StoreDescriptor::ValueRegister(), result_register());
1776 EmitLoadStoreICSlot(expr->LiteralFeedbackSlot()); 1775 EmitLoadStoreICSlot(expr->LiteralFeedbackSlot());
1777 Handle<Code> ic = 1776 Handle<Code> ic =
1778 CodeFactory::KeyedStoreIC(isolate(), language_mode()).code(); 1777 CodeFactory::KeyedStoreIC(isolate(), language_mode()).code();
1779 CallIC(ic); 1778 CallIC(ic);
1780 1779
1781 PrepareForBailoutForId(expr->GetIdForElement(array_index), NO_REGISTERS); 1780 PrepareForBailoutForId(expr->GetIdForElement(array_index), NO_REGISTERS);
1782 } 1781 }
1783 1782
1784 // In case the array literal contains spread expressions it has two parts. The 1783 // In case the array literal contains spread expressions it has two parts. The
1785 // first part is the "static" array which has a literal index is handled 1784 // first part is the "static" array which has a literal index is handled
1786 // above. The second part is the part after the first spread expression 1785 // above. The second part is the part after the first spread expression
1787 // (inclusive) and these elements gets appended to the array. Note that the 1786 // (inclusive) and these elements gets appended to the array. Note that the
1788 // number elements an iterable produces is unknown ahead of time. 1787 // number elements an iterable produces is unknown ahead of time.
1789 if (array_index < length && result_saved) { 1788 if (array_index < length && result_saved) {
1790 __ Pop(); // literal index
1791 __ Pop(v0); 1789 __ Pop(v0);
1792 result_saved = false; 1790 result_saved = false;
1793 } 1791 }
1794 for (; array_index < length; array_index++) { 1792 for (; array_index < length; array_index++) {
1795 Expression* subexpr = subexprs->at(array_index); 1793 Expression* subexpr = subexprs->at(array_index);
1796 1794
1797 __ Push(v0); 1795 __ Push(v0);
1798 if (subexpr->IsSpread()) { 1796 if (subexpr->IsSpread()) {
1799 VisitForStackValue(subexpr->AsSpread()->expression()); 1797 VisitForStackValue(subexpr->AsSpread()->expression());
1800 __ InvokeBuiltin(Context::CONCAT_ITERABLE_TO_ARRAY_BUILTIN_INDEX, 1798 __ InvokeBuiltin(Context::CONCAT_ITERABLE_TO_ARRAY_BUILTIN_INDEX,
1801 CALL_FUNCTION); 1799 CALL_FUNCTION);
1802 } else { 1800 } else {
1803 VisitForStackValue(subexpr); 1801 VisitForStackValue(subexpr);
1804 __ CallRuntime(Runtime::kAppendElement, 2); 1802 __ CallRuntime(Runtime::kAppendElement, 2);
1805 } 1803 }
1806 1804
1807 PrepareForBailoutForId(expr->GetIdForElement(array_index), NO_REGISTERS); 1805 PrepareForBailoutForId(expr->GetIdForElement(array_index), NO_REGISTERS);
1808 } 1806 }
1809 1807
1810 if (result_saved) { 1808 if (result_saved) {
1811 __ Pop(); // literal index
1812 context()->PlugTOS(); 1809 context()->PlugTOS();
1813 } else { 1810 } else {
1814 context()->Plug(v0); 1811 context()->Plug(v0);
1815 } 1812 }
1816 } 1813 }
1817 1814
1818 1815
1819 void FullCodeGenerator::VisitAssignment(Assignment* expr) { 1816 void FullCodeGenerator::VisitAssignment(Assignment* expr) {
1820 DCHECK(expr->target()->IsValidReferenceExpressionOrThis()); 1817 DCHECK(expr->target()->IsValidReferenceExpressionOrThis());
1821 1818
(...skipping 3203 matching lines...) Expand 10 before | Expand all | Expand 10 after
5025 reinterpret_cast<uint64_t>( 5022 reinterpret_cast<uint64_t>(
5026 isolate->builtins()->OsrAfterStackCheck()->entry())); 5023 isolate->builtins()->OsrAfterStackCheck()->entry()));
5027 return OSR_AFTER_STACK_CHECK; 5024 return OSR_AFTER_STACK_CHECK;
5028 } 5025 }
5029 5026
5030 5027
5031 } // namespace internal 5028 } // namespace internal
5032 } // namespace v8 5029 } // namespace v8
5033 5030
5034 #endif // V8_TARGET_ARCH_MIPS64 5031 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/full-codegen/mips/full-codegen-mips.cc ('k') | src/full-codegen/x64/full-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698