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

Side by Side Diff: src/full-codegen/arm/full-codegen-arm.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/crankshaft/hydrogen.cc ('k') | src/full-codegen/arm64/full-codegen-arm64.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_ARM 5 #if V8_TARGET_ARCH_ARM
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 1750 matching lines...) Expand 10 before | Expand all | Expand 10 after
1761 for (; array_index < length; array_index++) { 1761 for (; array_index < length; array_index++) {
1762 Expression* subexpr = subexprs->at(array_index); 1762 Expression* subexpr = subexprs->at(array_index);
1763 if (subexpr->IsSpread()) break; 1763 if (subexpr->IsSpread()) break;
1764 1764
1765 // If the subexpression is a literal or a simple materialized literal it 1765 // If the subexpression is a literal or a simple materialized literal it
1766 // is already set in the cloned array. 1766 // is already set in the cloned array.
1767 if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue; 1767 if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue;
1768 1768
1769 if (!result_saved) { 1769 if (!result_saved) {
1770 __ push(r0); 1770 __ push(r0);
1771 __ Push(Smi::FromInt(expr->literal_index()));
1772 result_saved = true; 1771 result_saved = true;
1773 } 1772 }
1774 VisitForAccumulatorValue(subexpr); 1773 VisitForAccumulatorValue(subexpr);
1775 1774
1776 __ mov(StoreDescriptor::NameRegister(), Operand(Smi::FromInt(array_index))); 1775 __ mov(StoreDescriptor::NameRegister(), Operand(Smi::FromInt(array_index)));
1777 __ ldr(StoreDescriptor::ReceiverRegister(), MemOperand(sp, kPointerSize)); 1776 __ ldr(StoreDescriptor::ReceiverRegister(), MemOperand(sp, 0));
1778 EmitLoadStoreICSlot(expr->LiteralFeedbackSlot()); 1777 EmitLoadStoreICSlot(expr->LiteralFeedbackSlot());
1779 Handle<Code> ic = 1778 Handle<Code> ic =
1780 CodeFactory::KeyedStoreIC(isolate(), language_mode()).code(); 1779 CodeFactory::KeyedStoreIC(isolate(), language_mode()).code();
1781 CallIC(ic); 1780 CallIC(ic);
1782 1781
1783 PrepareForBailoutForId(expr->GetIdForElement(array_index), NO_REGISTERS); 1782 PrepareForBailoutForId(expr->GetIdForElement(array_index), NO_REGISTERS);
1784 } 1783 }
1785 1784
1786 // In case the array literal contains spread expressions it has two parts. The 1785 // In case the array literal contains spread expressions it has two parts. The
1787 // first part is the "static" array which has a literal index is handled 1786 // first part is the "static" array which has a literal index is handled
1788 // above. The second part is the part after the first spread expression 1787 // above. The second part is the part after the first spread expression
1789 // (inclusive) and these elements gets appended to the array. Note that the 1788 // (inclusive) and these elements gets appended to the array. Note that the
1790 // number elements an iterable produces is unknown ahead of time. 1789 // number elements an iterable produces is unknown ahead of time.
1791 if (array_index < length && result_saved) { 1790 if (array_index < length && result_saved) {
1792 __ pop(); // literal index
1793 __ Pop(r0); 1791 __ Pop(r0);
1794 result_saved = false; 1792 result_saved = false;
1795 } 1793 }
1796 for (; array_index < length; array_index++) { 1794 for (; array_index < length; array_index++) {
1797 Expression* subexpr = subexprs->at(array_index); 1795 Expression* subexpr = subexprs->at(array_index);
1798 1796
1799 __ Push(r0); 1797 __ Push(r0);
1800 if (subexpr->IsSpread()) { 1798 if (subexpr->IsSpread()) {
1801 VisitForStackValue(subexpr->AsSpread()->expression()); 1799 VisitForStackValue(subexpr->AsSpread()->expression());
1802 __ InvokeBuiltin(Context::CONCAT_ITERABLE_TO_ARRAY_BUILTIN_INDEX, 1800 __ InvokeBuiltin(Context::CONCAT_ITERABLE_TO_ARRAY_BUILTIN_INDEX,
1803 CALL_FUNCTION); 1801 CALL_FUNCTION);
1804 } else { 1802 } else {
1805 VisitForStackValue(subexpr); 1803 VisitForStackValue(subexpr);
1806 __ CallRuntime(Runtime::kAppendElement, 2); 1804 __ CallRuntime(Runtime::kAppendElement, 2);
1807 } 1805 }
1808 1806
1809 PrepareForBailoutForId(expr->GetIdForElement(array_index), NO_REGISTERS); 1807 PrepareForBailoutForId(expr->GetIdForElement(array_index), NO_REGISTERS);
1810 } 1808 }
1811 1809
1812 if (result_saved) { 1810 if (result_saved) {
1813 __ pop(); // literal index
1814 context()->PlugTOS(); 1811 context()->PlugTOS();
1815 } else { 1812 } else {
1816 context()->Plug(r0); 1813 context()->Plug(r0);
1817 } 1814 }
1818 } 1815 }
1819 1816
1820 1817
1821 void FullCodeGenerator::VisitAssignment(Assignment* expr) { 1818 void FullCodeGenerator::VisitAssignment(Assignment* expr) {
1822 DCHECK(expr->target()->IsValidReferenceExpressionOrThis()); 1819 DCHECK(expr->target()->IsValidReferenceExpressionOrThis());
1823 1820
(...skipping 3229 matching lines...) Expand 10 before | Expand all | Expand 10 after
5053 DCHECK(interrupt_address == 5050 DCHECK(interrupt_address ==
5054 isolate->builtins()->OsrAfterStackCheck()->entry()); 5051 isolate->builtins()->OsrAfterStackCheck()->entry());
5055 return OSR_AFTER_STACK_CHECK; 5052 return OSR_AFTER_STACK_CHECK;
5056 } 5053 }
5057 5054
5058 5055
5059 } // namespace internal 5056 } // namespace internal
5060 } // namespace v8 5057 } // namespace v8
5061 5058
5062 #endif // V8_TARGET_ARCH_ARM 5059 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/crankshaft/hydrogen.cc ('k') | src/full-codegen/arm64/full-codegen-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698