| OLD | NEW |
| 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/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 1610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1621 | 1621 |
| 1622 bool result_saved = false; // Is the result saved to the stack? | 1622 bool result_saved = false; // Is the result saved to the stack? |
| 1623 ZoneList<Expression*>* subexprs = expr->values(); | 1623 ZoneList<Expression*>* subexprs = expr->values(); |
| 1624 int length = subexprs->length(); | 1624 int length = subexprs->length(); |
| 1625 | 1625 |
| 1626 // Emit code to evaluate all the non-constant subexpressions and to store | 1626 // Emit code to evaluate all the non-constant subexpressions and to store |
| 1627 // them into the newly cloned array. | 1627 // them into the newly cloned array. |
| 1628 int array_index = 0; | 1628 int array_index = 0; |
| 1629 for (; array_index < length; array_index++) { | 1629 for (; array_index < length; array_index++) { |
| 1630 Expression* subexpr = subexprs->at(array_index); | 1630 Expression* subexpr = subexprs->at(array_index); |
| 1631 if (subexpr->IsSpread()) break; | 1631 DCHECK(!subexpr->IsSpread()); |
| 1632 | 1632 |
| 1633 // If the subexpression is a literal or a simple materialized literal it | 1633 // If the subexpression is a literal or a simple materialized literal it |
| 1634 // is already set in the cloned array. | 1634 // is already set in the cloned array. |
| 1635 if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue; | 1635 if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue; |
| 1636 | 1636 |
| 1637 if (!result_saved) { | 1637 if (!result_saved) { |
| 1638 __ push(eax); // array literal. | 1638 __ push(eax); // array literal. |
| 1639 result_saved = true; | 1639 result_saved = true; |
| 1640 } | 1640 } |
| 1641 VisitForAccumulatorValue(subexpr); | 1641 VisitForAccumulatorValue(subexpr); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1656 // (inclusive) and these elements gets appended to the array. Note that the | 1656 // (inclusive) and these elements gets appended to the array. Note that the |
| 1657 // number elements an iterable produces is unknown ahead of time. | 1657 // number elements an iterable produces is unknown ahead of time. |
| 1658 if (array_index < length && result_saved) { | 1658 if (array_index < length && result_saved) { |
| 1659 __ Pop(eax); | 1659 __ Pop(eax); |
| 1660 result_saved = false; | 1660 result_saved = false; |
| 1661 } | 1661 } |
| 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 | 1664 |
| 1665 __ Push(eax); | 1665 __ Push(eax); |
| 1666 if (subexpr->IsSpread()) { | 1666 DCHECK(!subexpr->IsSpread()); |
| 1667 VisitForStackValue(subexpr->AsSpread()->expression()); | 1667 VisitForStackValue(subexpr); |
| 1668 __ InvokeBuiltin(Context::CONCAT_ITERABLE_TO_ARRAY_BUILTIN_INDEX, | 1668 __ CallRuntime(Runtime::kAppendElement); |
| 1669 CALL_FUNCTION); | |
| 1670 } else { | |
| 1671 VisitForStackValue(subexpr); | |
| 1672 __ CallRuntime(Runtime::kAppendElement); | |
| 1673 } | |
| 1674 | 1669 |
| 1675 PrepareForBailoutForId(expr->GetIdForElement(array_index), NO_REGISTERS); | 1670 PrepareForBailoutForId(expr->GetIdForElement(array_index), NO_REGISTERS); |
| 1676 } | 1671 } |
| 1677 | 1672 |
| 1678 if (result_saved) { | 1673 if (result_saved) { |
| 1679 context()->PlugTOS(); | 1674 context()->PlugTOS(); |
| 1680 } else { | 1675 } else { |
| 1681 context()->Plug(eax); | 1676 context()->Plug(eax); |
| 1682 } | 1677 } |
| 1683 } | 1678 } |
| (...skipping 3055 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4739 Assembler::target_address_at(call_target_address, | 4734 Assembler::target_address_at(call_target_address, |
| 4740 unoptimized_code)); | 4735 unoptimized_code)); |
| 4741 return OSR_AFTER_STACK_CHECK; | 4736 return OSR_AFTER_STACK_CHECK; |
| 4742 } | 4737 } |
| 4743 | 4738 |
| 4744 | 4739 |
| 4745 } // namespace internal | 4740 } // namespace internal |
| 4746 } // namespace v8 | 4741 } // namespace v8 |
| 4747 | 4742 |
| 4748 #endif // V8_TARGET_ARCH_X87 | 4743 #endif // V8_TARGET_ARCH_X87 |
| OLD | NEW |