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

Side by Side Diff: src/full-codegen/arm64/full-codegen-arm64.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/arm/full-codegen-arm.cc ('k') | src/full-codegen/ia32/full-codegen-ia32.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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_ARM64 5 #if V8_TARGET_ARCH_ARM64
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 1732 matching lines...) Expand 10 before | Expand all | Expand 10 after
1743 int array_index = 0; 1743 int array_index = 0;
1744 for (; array_index < length; array_index++) { 1744 for (; array_index < length; array_index++) {
1745 Expression* subexpr = subexprs->at(array_index); 1745 Expression* subexpr = subexprs->at(array_index);
1746 if (subexpr->IsSpread()) break; 1746 if (subexpr->IsSpread()) break;
1747 1747
1748 // If the subexpression is a literal or a simple materialized literal it 1748 // If the subexpression is a literal or a simple materialized literal it
1749 // is already set in the cloned array. 1749 // is already set in the cloned array.
1750 if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue; 1750 if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue;
1751 1751
1752 if (!result_saved) { 1752 if (!result_saved) {
1753 __ Mov(x1, Smi::FromInt(expr->literal_index())); 1753 __ Push(x0);
1754 __ Push(x0, x1);
1755 result_saved = true; 1754 result_saved = true;
1756 } 1755 }
1757 VisitForAccumulatorValue(subexpr); 1756 VisitForAccumulatorValue(subexpr);
1758 1757
1759 __ Mov(StoreDescriptor::NameRegister(), Smi::FromInt(array_index)); 1758 __ Mov(StoreDescriptor::NameRegister(), Smi::FromInt(array_index));
1760 __ Peek(StoreDescriptor::ReceiverRegister(), kPointerSize); 1759 __ Peek(StoreDescriptor::ReceiverRegister(), 0);
1761 EmitLoadStoreICSlot(expr->LiteralFeedbackSlot()); 1760 EmitLoadStoreICSlot(expr->LiteralFeedbackSlot());
1762 Handle<Code> ic = 1761 Handle<Code> ic =
1763 CodeFactory::KeyedStoreIC(isolate(), language_mode()).code(); 1762 CodeFactory::KeyedStoreIC(isolate(), language_mode()).code();
1764 CallIC(ic); 1763 CallIC(ic);
1765 1764
1766 PrepareForBailoutForId(expr->GetIdForElement(array_index), NO_REGISTERS); 1765 PrepareForBailoutForId(expr->GetIdForElement(array_index), NO_REGISTERS);
1767 } 1766 }
1768 1767
1769 // In case the array literal contains spread expressions it has two parts. The 1768 // In case the array literal contains spread expressions it has two parts. The
1770 // first part is the "static" array which has a literal index is handled 1769 // first part is the "static" array which has a literal index is handled
1771 // above. The second part is the part after the first spread expression 1770 // above. The second part is the part after the first spread expression
1772 // (inclusive) and these elements gets appended to the array. Note that the 1771 // (inclusive) and these elements gets appended to the array. Note that the
1773 // number elements an iterable produces is unknown ahead of time. 1772 // number elements an iterable produces is unknown ahead of time.
1774 if (array_index < length && result_saved) { 1773 if (array_index < length && result_saved) {
1775 __ Drop(1); // literal index
1776 __ Pop(x0); 1774 __ Pop(x0);
1777 result_saved = false; 1775 result_saved = false;
1778 } 1776 }
1779 for (; array_index < length; array_index++) { 1777 for (; array_index < length; array_index++) {
1780 Expression* subexpr = subexprs->at(array_index); 1778 Expression* subexpr = subexprs->at(array_index);
1781 1779
1782 __ Push(x0); 1780 __ Push(x0);
1783 if (subexpr->IsSpread()) { 1781 if (subexpr->IsSpread()) {
1784 VisitForStackValue(subexpr->AsSpread()->expression()); 1782 VisitForStackValue(subexpr->AsSpread()->expression());
1785 __ InvokeBuiltin(Context::CONCAT_ITERABLE_TO_ARRAY_BUILTIN_INDEX, 1783 __ InvokeBuiltin(Context::CONCAT_ITERABLE_TO_ARRAY_BUILTIN_INDEX,
1786 CALL_FUNCTION); 1784 CALL_FUNCTION);
1787 } else { 1785 } else {
1788 VisitForStackValue(subexpr); 1786 VisitForStackValue(subexpr);
1789 __ CallRuntime(Runtime::kAppendElement, 2); 1787 __ CallRuntime(Runtime::kAppendElement, 2);
1790 } 1788 }
1791 1789
1792 PrepareForBailoutForId(expr->GetIdForElement(array_index), NO_REGISTERS); 1790 PrepareForBailoutForId(expr->GetIdForElement(array_index), NO_REGISTERS);
1793 } 1791 }
1794 1792
1795 if (result_saved) { 1793 if (result_saved) {
1796 __ Drop(1); // literal index
1797 context()->PlugTOS(); 1794 context()->PlugTOS();
1798 } else { 1795 } else {
1799 context()->Plug(x0); 1796 context()->Plug(x0);
1800 } 1797 }
1801 } 1798 }
1802 1799
1803 1800
1804 void FullCodeGenerator::VisitAssignment(Assignment* expr) { 1801 void FullCodeGenerator::VisitAssignment(Assignment* expr) {
1805 DCHECK(expr->target()->IsValidReferenceExpressionOrThis()); 1802 DCHECK(expr->target()->IsValidReferenceExpressionOrThis());
1806 1803
(...skipping 3234 matching lines...) Expand 10 before | Expand all | Expand 10 after
5041 } 5038 }
5042 5039
5043 return INTERRUPT; 5040 return INTERRUPT;
5044 } 5041 }
5045 5042
5046 5043
5047 } // namespace internal 5044 } // namespace internal
5048 } // namespace v8 5045 } // namespace v8
5049 5046
5050 #endif // V8_TARGET_ARCH_ARM64 5047 #endif // V8_TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « src/full-codegen/arm/full-codegen-arm.cc ('k') | src/full-codegen/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698