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

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

Issue 1468273005: PPC: [compiler] No need to push literal index in VisitArrayLiteral. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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_PPC 5 #if V8_TARGET_ARCH_PPC
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 1712 matching lines...) Expand 10 before | Expand all | Expand 10 after
1723 int array_index = 0; 1723 int array_index = 0;
1724 for (; array_index < length; array_index++) { 1724 for (; array_index < length; array_index++) {
1725 Expression* subexpr = subexprs->at(array_index); 1725 Expression* subexpr = subexprs->at(array_index);
1726 if (subexpr->IsSpread()) break; 1726 if (subexpr->IsSpread()) break;
1727 // If the subexpression is a literal or a simple materialized literal it 1727 // If the subexpression is a literal or a simple materialized literal it
1728 // is already set in the cloned array. 1728 // is already set in the cloned array.
1729 if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue; 1729 if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue;
1730 1730
1731 if (!result_saved) { 1731 if (!result_saved) {
1732 __ push(r3); 1732 __ push(r3);
1733 __ Push(Smi::FromInt(expr->literal_index()));
1734 result_saved = true; 1733 result_saved = true;
1735 } 1734 }
1736 VisitForAccumulatorValue(subexpr); 1735 VisitForAccumulatorValue(subexpr);
1737 1736
1738 __ LoadSmiLiteral(StoreDescriptor::NameRegister(), 1737 __ LoadSmiLiteral(StoreDescriptor::NameRegister(),
1739 Smi::FromInt(array_index)); 1738 Smi::FromInt(array_index));
1740 __ LoadP(StoreDescriptor::ReceiverRegister(), MemOperand(sp, kPointerSize)); 1739 __ LoadP(StoreDescriptor::ReceiverRegister(), MemOperand(sp, 0));
1741 EmitLoadStoreICSlot(expr->LiteralFeedbackSlot()); 1740 EmitLoadStoreICSlot(expr->LiteralFeedbackSlot());
1742 Handle<Code> ic = 1741 Handle<Code> ic =
1743 CodeFactory::KeyedStoreIC(isolate(), language_mode()).code(); 1742 CodeFactory::KeyedStoreIC(isolate(), language_mode()).code();
1744 CallIC(ic); 1743 CallIC(ic);
1745 1744
1746 PrepareForBailoutForId(expr->GetIdForElement(array_index), NO_REGISTERS); 1745 PrepareForBailoutForId(expr->GetIdForElement(array_index), NO_REGISTERS);
1747 } 1746 }
1748 1747
1749 // In case the array literal contains spread expressions it has two parts. The 1748 // In case the array literal contains spread expressions it has two parts. The
1750 // first part is the "static" array which has a literal index is handled 1749 // first part is the "static" array which has a literal index is handled
1751 // above. The second part is the part after the first spread expression 1750 // above. The second part is the part after the first spread expression
1752 // (inclusive) and these elements gets appended to the array. Note that the 1751 // (inclusive) and these elements gets appended to the array. Note that the
1753 // number elements an iterable produces is unknown ahead of time. 1752 // number elements an iterable produces is unknown ahead of time.
1754 if (array_index < length && result_saved) { 1753 if (array_index < length && result_saved) {
1755 __ Drop(1); // literal index
1756 __ Pop(r3); 1754 __ Pop(r3);
1757 result_saved = false; 1755 result_saved = false;
1758 } 1756 }
1759 for (; array_index < length; array_index++) { 1757 for (; array_index < length; array_index++) {
1760 Expression* subexpr = subexprs->at(array_index); 1758 Expression* subexpr = subexprs->at(array_index);
1761 1759
1762 __ Push(r3); 1760 __ Push(r3);
1763 if (subexpr->IsSpread()) { 1761 if (subexpr->IsSpread()) {
1764 VisitForStackValue(subexpr->AsSpread()->expression()); 1762 VisitForStackValue(subexpr->AsSpread()->expression());
1765 __ InvokeBuiltin(Context::CONCAT_ITERABLE_TO_ARRAY_BUILTIN_INDEX, 1763 __ InvokeBuiltin(Context::CONCAT_ITERABLE_TO_ARRAY_BUILTIN_INDEX,
1766 CALL_FUNCTION); 1764 CALL_FUNCTION);
1767 } else { 1765 } else {
1768 VisitForStackValue(subexpr); 1766 VisitForStackValue(subexpr);
1769 __ CallRuntime(Runtime::kAppendElement, 2); 1767 __ CallRuntime(Runtime::kAppendElement, 2);
1770 } 1768 }
1771 1769
1772 PrepareForBailoutForId(expr->GetIdForElement(array_index), NO_REGISTERS); 1770 PrepareForBailoutForId(expr->GetIdForElement(array_index), NO_REGISTERS);
1773 } 1771 }
1774 1772
1775 if (result_saved) { 1773 if (result_saved) {
1776 __ Drop(1); // literal index
1777 context()->PlugTOS(); 1774 context()->PlugTOS();
1778 } else { 1775 } else {
1779 context()->Plug(r3); 1776 context()->Plug(r3);
1780 } 1777 }
1781 } 1778 }
1782 1779
1783 1780
1784 void FullCodeGenerator::VisitAssignment(Assignment* expr) { 1781 void FullCodeGenerator::VisitAssignment(Assignment* expr) {
1785 DCHECK(expr->target()->IsValidReferenceExpressionOrThis()); 1782 DCHECK(expr->target()->IsValidReferenceExpressionOrThis());
1786 1783
(...skipping 3215 matching lines...) Expand 10 before | Expand all | Expand 10 after
5002 return ON_STACK_REPLACEMENT; 4999 return ON_STACK_REPLACEMENT;
5003 } 5000 }
5004 5001
5005 DCHECK(interrupt_address == 5002 DCHECK(interrupt_address ==
5006 isolate->builtins()->OsrAfterStackCheck()->entry()); 5003 isolate->builtins()->OsrAfterStackCheck()->entry());
5007 return OSR_AFTER_STACK_CHECK; 5004 return OSR_AFTER_STACK_CHECK;
5008 } 5005 }
5009 } // namespace internal 5006 } // namespace internal
5010 } // namespace v8 5007 } // namespace v8
5011 #endif // V8_TARGET_ARCH_PPC 5008 #endif // V8_TARGET_ARCH_PPC
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698