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

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

Issue 1477673002: X87: [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 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_X87 5 #if V8_TARGET_ARCH_X87
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 1664 matching lines...) Expand 10 before | Expand all | Expand 10 after
1675 for (; array_index < length; array_index++) { 1675 for (; array_index < length; array_index++) {
1676 Expression* subexpr = subexprs->at(array_index); 1676 Expression* subexpr = subexprs->at(array_index);
1677 if (subexpr->IsSpread()) break; 1677 if (subexpr->IsSpread()) break;
1678 1678
1679 // If the subexpression is a literal or a simple materialized literal it 1679 // If the subexpression is a literal or a simple materialized literal it
1680 // is already set in the cloned array. 1680 // is already set in the cloned array.
1681 if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue; 1681 if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue;
1682 1682
1683 if (!result_saved) { 1683 if (!result_saved) {
1684 __ push(eax); // array literal. 1684 __ push(eax); // array literal.
1685 __ push(Immediate(Smi::FromInt(expr->literal_index())));
1686 result_saved = true; 1685 result_saved = true;
1687 } 1686 }
1688 VisitForAccumulatorValue(subexpr); 1687 VisitForAccumulatorValue(subexpr);
1689 1688
1690 __ mov(StoreDescriptor::NameRegister(), 1689 __ mov(StoreDescriptor::NameRegister(),
1691 Immediate(Smi::FromInt(array_index))); 1690 Immediate(Smi::FromInt(array_index)));
1692 __ mov(StoreDescriptor::ReceiverRegister(), Operand(esp, kPointerSize)); 1691 __ mov(StoreDescriptor::ReceiverRegister(), Operand(esp, 0));
1693 EmitLoadStoreICSlot(expr->LiteralFeedbackSlot()); 1692 EmitLoadStoreICSlot(expr->LiteralFeedbackSlot());
1694 Handle<Code> ic = 1693 Handle<Code> ic =
1695 CodeFactory::KeyedStoreIC(isolate(), language_mode()).code(); 1694 CodeFactory::KeyedStoreIC(isolate(), language_mode()).code();
1696 CallIC(ic); 1695 CallIC(ic);
1697 PrepareForBailoutForId(expr->GetIdForElement(array_index), NO_REGISTERS); 1696 PrepareForBailoutForId(expr->GetIdForElement(array_index), NO_REGISTERS);
1698 } 1697 }
1699 1698
1700 // In case the array literal contains spread expressions it has two parts. The 1699 // In case the array literal contains spread expressions it has two parts. The
1701 // first part is the "static" array which has a literal index is handled 1700 // first part is the "static" array which has a literal index is handled
1702 // above. The second part is the part after the first spread expression 1701 // above. The second part is the part after the first spread expression
1703 // (inclusive) and these elements gets appended to the array. Note that the 1702 // (inclusive) and these elements gets appended to the array. Note that the
1704 // number elements an iterable produces is unknown ahead of time. 1703 // number elements an iterable produces is unknown ahead of time.
1705 if (array_index < length && result_saved) { 1704 if (array_index < length && result_saved) {
1706 __ Drop(1); // literal index
1707 __ Pop(eax); 1705 __ Pop(eax);
1708 result_saved = false; 1706 result_saved = false;
1709 } 1707 }
1710 for (; array_index < length; array_index++) { 1708 for (; array_index < length; array_index++) {
1711 Expression* subexpr = subexprs->at(array_index); 1709 Expression* subexpr = subexprs->at(array_index);
1712 1710
1713 __ Push(eax); 1711 __ Push(eax);
1714 if (subexpr->IsSpread()) { 1712 if (subexpr->IsSpread()) {
1715 VisitForStackValue(subexpr->AsSpread()->expression()); 1713 VisitForStackValue(subexpr->AsSpread()->expression());
1716 __ InvokeBuiltin(Context::CONCAT_ITERABLE_TO_ARRAY_BUILTIN_INDEX, 1714 __ InvokeBuiltin(Context::CONCAT_ITERABLE_TO_ARRAY_BUILTIN_INDEX,
1717 CALL_FUNCTION); 1715 CALL_FUNCTION);
1718 } else { 1716 } else {
1719 VisitForStackValue(subexpr); 1717 VisitForStackValue(subexpr);
1720 __ CallRuntime(Runtime::kAppendElement, 2); 1718 __ CallRuntime(Runtime::kAppendElement, 2);
1721 } 1719 }
1722 1720
1723 PrepareForBailoutForId(expr->GetIdForElement(array_index), NO_REGISTERS); 1721 PrepareForBailoutForId(expr->GetIdForElement(array_index), NO_REGISTERS);
1724 } 1722 }
1725 1723
1726 if (result_saved) { 1724 if (result_saved) {
1727 __ Drop(1); // literal index
1728 context()->PlugTOS(); 1725 context()->PlugTOS();
1729 } else { 1726 } else {
1730 context()->Plug(eax); 1727 context()->Plug(eax);
1731 } 1728 }
1732 } 1729 }
1733 1730
1734 1731
1735 void FullCodeGenerator::VisitAssignment(Assignment* expr) { 1732 void FullCodeGenerator::VisitAssignment(Assignment* expr) {
1736 DCHECK(expr->target()->IsValidReferenceExpressionOrThis()); 1733 DCHECK(expr->target()->IsValidReferenceExpressionOrThis());
1737 1734
(...skipping 3173 matching lines...) Expand 10 before | Expand all | Expand 10 after
4911 Assembler::target_address_at(call_target_address, 4908 Assembler::target_address_at(call_target_address,
4912 unoptimized_code)); 4909 unoptimized_code));
4913 return OSR_AFTER_STACK_CHECK; 4910 return OSR_AFTER_STACK_CHECK;
4914 } 4911 }
4915 4912
4916 4913
4917 } // namespace internal 4914 } // namespace internal
4918 } // namespace v8 4915 } // namespace v8
4919 4916
4920 #endif // V8_TARGET_ARCH_X87 4917 #endif // V8_TARGET_ARCH_X87
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