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

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

Issue 1592713002: Clean up dead code after spread desugaring (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix bug that visited dead AST node in for/of Created 4 years, 11 months 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/ppc/full-codegen-ppc.cc ('k') | src/full-codegen/x87/full-codegen-x87.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_X64 5 #if V8_TARGET_ARCH_X64
6 6
7 #include "src/ast/scopes.h" 7 #include "src/ast/scopes.h"
8 #include "src/code-factory.h" 8 #include "src/code-factory.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 1643 matching lines...) Expand 10 before | Expand all | Expand 10 after
1654 1654
1655 bool result_saved = false; // Is the result saved to the stack? 1655 bool result_saved = false; // Is the result saved to the stack?
1656 ZoneList<Expression*>* subexprs = expr->values(); 1656 ZoneList<Expression*>* subexprs = expr->values();
1657 int length = subexprs->length(); 1657 int length = subexprs->length();
1658 1658
1659 // Emit code to evaluate all the non-constant subexpressions and to store 1659 // Emit code to evaluate all the non-constant subexpressions and to store
1660 // them into the newly cloned array. 1660 // them into the newly cloned array.
1661 int array_index = 0; 1661 int array_index = 0;
1662 for (; array_index < length; array_index++) { 1662 for (; array_index < length; array_index++) {
1663 Expression* subexpr = subexprs->at(array_index); 1663 Expression* subexpr = subexprs->at(array_index);
1664 if (subexpr->IsSpread()) break; 1664 DCHECK(!subexpr->IsSpread());
1665 1665
1666 // If the subexpression is a literal or a simple materialized literal it 1666 // If the subexpression is a literal or a simple materialized literal it
1667 // is already set in the cloned array. 1667 // is already set in the cloned array.
1668 if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue; 1668 if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue;
1669 1669
1670 if (!result_saved) { 1670 if (!result_saved) {
1671 __ Push(rax); // array literal 1671 __ Push(rax); // array literal
1672 result_saved = true; 1672 result_saved = true;
1673 } 1673 }
1674 VisitForAccumulatorValue(subexpr); 1674 VisitForAccumulatorValue(subexpr);
(...skipping 14 matching lines...) Expand all
1689 // (inclusive) and these elements gets appended to the array. Note that the 1689 // (inclusive) and these elements gets appended to the array. Note that the
1690 // number elements an iterable produces is unknown ahead of time. 1690 // number elements an iterable produces is unknown ahead of time.
1691 if (array_index < length && result_saved) { 1691 if (array_index < length && result_saved) {
1692 __ Pop(rax); 1692 __ Pop(rax);
1693 result_saved = false; 1693 result_saved = false;
1694 } 1694 }
1695 for (; array_index < length; array_index++) { 1695 for (; array_index < length; array_index++) {
1696 Expression* subexpr = subexprs->at(array_index); 1696 Expression* subexpr = subexprs->at(array_index);
1697 1697
1698 __ Push(rax); 1698 __ Push(rax);
1699 if (subexpr->IsSpread()) { 1699 DCHECK(!subexpr->IsSpread());
1700 VisitForStackValue(subexpr->AsSpread()->expression()); 1700 VisitForStackValue(subexpr);
1701 __ InvokeBuiltin(Context::CONCAT_ITERABLE_TO_ARRAY_BUILTIN_INDEX, 1701 __ CallRuntime(Runtime::kAppendElement);
1702 CALL_FUNCTION);
1703 } else {
1704 VisitForStackValue(subexpr);
1705 __ CallRuntime(Runtime::kAppendElement);
1706 }
1707 1702
1708 PrepareForBailoutForId(expr->GetIdForElement(array_index), NO_REGISTERS); 1703 PrepareForBailoutForId(expr->GetIdForElement(array_index), NO_REGISTERS);
1709 } 1704 }
1710 1705
1711 if (result_saved) { 1706 if (result_saved) {
1712 context()->PlugTOS(); 1707 context()->PlugTOS();
1713 } else { 1708 } else {
1714 context()->Plug(rax); 1709 context()->Plug(rax);
1715 } 1710 }
1716 } 1711 }
(...skipping 3034 matching lines...) Expand 10 before | Expand all | Expand 10 after
4751 Assembler::target_address_at(call_target_address, 4746 Assembler::target_address_at(call_target_address,
4752 unoptimized_code)); 4747 unoptimized_code));
4753 return OSR_AFTER_STACK_CHECK; 4748 return OSR_AFTER_STACK_CHECK;
4754 } 4749 }
4755 4750
4756 4751
4757 } // namespace internal 4752 } // namespace internal
4758 } // namespace v8 4753 } // namespace v8
4759 4754
4760 #endif // V8_TARGET_ARCH_X64 4755 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/full-codegen/ppc/full-codegen-ppc.cc ('k') | src/full-codegen/x87/full-codegen-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698