| OLD | NEW |
| 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/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 1691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1702 | 1702 |
| 1703 bool result_saved = false; // Is the result saved to the stack? | 1703 bool result_saved = false; // Is the result saved to the stack? |
| 1704 ZoneList<Expression*>* subexprs = expr->values(); | 1704 ZoneList<Expression*>* subexprs = expr->values(); |
| 1705 int length = subexprs->length(); | 1705 int length = subexprs->length(); |
| 1706 | 1706 |
| 1707 // Emit code to evaluate all the non-constant subexpressions and to store | 1707 // Emit code to evaluate all the non-constant subexpressions and to store |
| 1708 // them into the newly cloned array. | 1708 // them into the newly cloned array. |
| 1709 int array_index = 0; | 1709 int array_index = 0; |
| 1710 for (; array_index < length; array_index++) { | 1710 for (; array_index < length; array_index++) { |
| 1711 Expression* subexpr = subexprs->at(array_index); | 1711 Expression* subexpr = subexprs->at(array_index); |
| 1712 if (subexpr->IsSpread()) break; | 1712 DCHECK(!subexpr->IsSpread()); |
| 1713 | 1713 |
| 1714 // If the subexpression is a literal or a simple materialized literal it | 1714 // If the subexpression is a literal or a simple materialized literal it |
| 1715 // is already set in the cloned array. | 1715 // is already set in the cloned array. |
| 1716 if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue; | 1716 if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue; |
| 1717 | 1717 |
| 1718 if (!result_saved) { | 1718 if (!result_saved) { |
| 1719 __ Push(x0); | 1719 __ Push(x0); |
| 1720 result_saved = true; | 1720 result_saved = true; |
| 1721 } | 1721 } |
| 1722 VisitForAccumulatorValue(subexpr); | 1722 VisitForAccumulatorValue(subexpr); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1737 // (inclusive) and these elements gets appended to the array. Note that the | 1737 // (inclusive) and these elements gets appended to the array. Note that the |
| 1738 // number elements an iterable produces is unknown ahead of time. | 1738 // number elements an iterable produces is unknown ahead of time. |
| 1739 if (array_index < length && result_saved) { | 1739 if (array_index < length && result_saved) { |
| 1740 __ Pop(x0); | 1740 __ Pop(x0); |
| 1741 result_saved = false; | 1741 result_saved = false; |
| 1742 } | 1742 } |
| 1743 for (; array_index < length; array_index++) { | 1743 for (; array_index < length; array_index++) { |
| 1744 Expression* subexpr = subexprs->at(array_index); | 1744 Expression* subexpr = subexprs->at(array_index); |
| 1745 | 1745 |
| 1746 __ Push(x0); | 1746 __ Push(x0); |
| 1747 if (subexpr->IsSpread()) { | 1747 DCHECK(!subexpr->IsSpread()); |
| 1748 VisitForStackValue(subexpr->AsSpread()->expression()); | 1748 VisitForStackValue(subexpr); |
| 1749 __ InvokeBuiltin(Context::CONCAT_ITERABLE_TO_ARRAY_BUILTIN_INDEX, | 1749 __ CallRuntime(Runtime::kAppendElement); |
| 1750 CALL_FUNCTION); | |
| 1751 } else { | |
| 1752 VisitForStackValue(subexpr); | |
| 1753 __ CallRuntime(Runtime::kAppendElement); | |
| 1754 } | |
| 1755 | 1750 |
| 1756 PrepareForBailoutForId(expr->GetIdForElement(array_index), NO_REGISTERS); | 1751 PrepareForBailoutForId(expr->GetIdForElement(array_index), NO_REGISTERS); |
| 1757 } | 1752 } |
| 1758 | 1753 |
| 1759 if (result_saved) { | 1754 if (result_saved) { |
| 1760 context()->PlugTOS(); | 1755 context()->PlugTOS(); |
| 1761 } else { | 1756 } else { |
| 1762 context()->Plug(x0); | 1757 context()->Plug(x0); |
| 1763 } | 1758 } |
| 1764 } | 1759 } |
| (...skipping 3100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4865 } | 4860 } |
| 4866 | 4861 |
| 4867 return INTERRUPT; | 4862 return INTERRUPT; |
| 4868 } | 4863 } |
| 4869 | 4864 |
| 4870 | 4865 |
| 4871 } // namespace internal | 4866 } // namespace internal |
| 4872 } // namespace v8 | 4867 } // namespace v8 |
| 4873 | 4868 |
| 4874 #endif // V8_TARGET_ARCH_ARM64 | 4869 #endif // V8_TARGET_ARCH_ARM64 |
| OLD | NEW |