| 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_MIPS64 | 5 #if V8_TARGET_ARCH_MIPS64 |
| 6 | 6 |
| 7 // Note on Mips implementation: | 7 // Note on Mips implementation: |
| 8 // | 8 // |
| 9 // The result_register() for mips is the 'v0' register, which is defined | 9 // The result_register() for mips is the 'v0' register, which is defined |
| 10 // by the ABI to contain function return values. However, the first | 10 // by the ABI to contain function return values. However, the first |
| (...skipping 1570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1581 __ CallStub(&stub); | 1581 __ CallStub(&stub); |
| 1582 } | 1582 } |
| 1583 PrepareForBailoutForId(expr->CreateLiteralId(), BailoutState::TOS_REGISTER); | 1583 PrepareForBailoutForId(expr->CreateLiteralId(), BailoutState::TOS_REGISTER); |
| 1584 | 1584 |
| 1585 bool result_saved = false; // Is the result saved to the stack? | 1585 bool result_saved = false; // Is the result saved to the stack? |
| 1586 ZoneList<Expression*>* subexprs = expr->values(); | 1586 ZoneList<Expression*>* subexprs = expr->values(); |
| 1587 int length = subexprs->length(); | 1587 int length = subexprs->length(); |
| 1588 | 1588 |
| 1589 // Emit code to evaluate all the non-constant subexpressions and to store | 1589 // Emit code to evaluate all the non-constant subexpressions and to store |
| 1590 // them into the newly cloned array. | 1590 // them into the newly cloned array. |
| 1591 int array_index = 0; | 1591 for (int array_index = 0; array_index < length; array_index++) { |
| 1592 for (; array_index < length; array_index++) { | |
| 1593 Expression* subexpr = subexprs->at(array_index); | 1592 Expression* subexpr = subexprs->at(array_index); |
| 1594 DCHECK(!subexpr->IsSpread()); | 1593 DCHECK(!subexpr->IsSpread()); |
| 1595 | 1594 |
| 1596 // If the subexpression is a literal or a simple materialized literal it | 1595 // If the subexpression is a literal or a simple materialized literal it |
| 1597 // is already set in the cloned array. | 1596 // is already set in the cloned array. |
| 1598 if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue; | 1597 if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue; |
| 1599 | 1598 |
| 1600 if (!result_saved) { | 1599 if (!result_saved) { |
| 1601 PushOperand(v0); // array literal | 1600 PushOperand(v0); // array literal |
| 1602 result_saved = true; | 1601 result_saved = true; |
| 1603 } | 1602 } |
| 1604 | 1603 |
| 1605 VisitForAccumulatorValue(subexpr); | 1604 VisitForAccumulatorValue(subexpr); |
| 1606 | 1605 |
| 1607 __ li(StoreDescriptor::NameRegister(), Operand(Smi::FromInt(array_index))); | 1606 __ li(StoreDescriptor::NameRegister(), Operand(Smi::FromInt(array_index))); |
| 1608 __ ld(StoreDescriptor::ReceiverRegister(), MemOperand(sp, 0)); | 1607 __ ld(StoreDescriptor::ReceiverRegister(), MemOperand(sp, 0)); |
| 1609 __ mov(StoreDescriptor::ValueRegister(), result_register()); | 1608 __ mov(StoreDescriptor::ValueRegister(), result_register()); |
| 1610 EmitLoadStoreICSlot(expr->LiteralFeedbackSlot()); | 1609 EmitLoadStoreICSlot(expr->LiteralFeedbackSlot()); |
| 1611 CallKeyedStoreIC(); | 1610 CallKeyedStoreIC(); |
| 1612 | 1611 |
| 1613 PrepareForBailoutForId(expr->GetIdForElement(array_index), | 1612 PrepareForBailoutForId(expr->GetIdForElement(array_index), |
| 1614 BailoutState::NO_REGISTERS); | 1613 BailoutState::NO_REGISTERS); |
| 1615 } | 1614 } |
| 1616 | 1615 |
| 1617 // In case the array literal contains spread expressions it has two parts. The | |
| 1618 // first part is the "static" array which has a literal index is handled | |
| 1619 // above. The second part is the part after the first spread expression | |
| 1620 // (inclusive) and these elements gets appended to the array. Note that the | |
| 1621 // number elements an iterable produces is unknown ahead of time. | |
| 1622 if (array_index < length && result_saved) { | |
| 1623 PopOperand(v0); | |
| 1624 result_saved = false; | |
| 1625 } | |
| 1626 for (; array_index < length; array_index++) { | |
| 1627 Expression* subexpr = subexprs->at(array_index); | |
| 1628 | |
| 1629 PushOperand(v0); | |
| 1630 DCHECK(!subexpr->IsSpread()); | |
| 1631 VisitForStackValue(subexpr); | |
| 1632 CallRuntimeWithOperands(Runtime::kAppendElement); | |
| 1633 | |
| 1634 PrepareForBailoutForId(expr->GetIdForElement(array_index), | |
| 1635 BailoutState::NO_REGISTERS); | |
| 1636 } | |
| 1637 | |
| 1638 if (result_saved) { | 1616 if (result_saved) { |
| 1639 context()->PlugTOS(); | 1617 context()->PlugTOS(); |
| 1640 } else { | 1618 } else { |
| 1641 context()->Plug(v0); | 1619 context()->Plug(v0); |
| 1642 } | 1620 } |
| 1643 } | 1621 } |
| 1644 | 1622 |
| 1645 | 1623 |
| 1646 void FullCodeGenerator::VisitAssignment(Assignment* expr) { | 1624 void FullCodeGenerator::VisitAssignment(Assignment* expr) { |
| 1647 DCHECK(expr->target()->IsValidReferenceExpressionOrThis()); | 1625 DCHECK(expr->target()->IsValidReferenceExpressionOrThis()); |
| (...skipping 2097 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3745 reinterpret_cast<uint64_t>( | 3723 reinterpret_cast<uint64_t>( |
| 3746 isolate->builtins()->OnStackReplacement()->entry())); | 3724 isolate->builtins()->OnStackReplacement()->entry())); |
| 3747 return ON_STACK_REPLACEMENT; | 3725 return ON_STACK_REPLACEMENT; |
| 3748 } | 3726 } |
| 3749 | 3727 |
| 3750 | 3728 |
| 3751 } // namespace internal | 3729 } // namespace internal |
| 3752 } // namespace v8 | 3730 } // namespace v8 |
| 3753 | 3731 |
| 3754 #endif // V8_TARGET_ARCH_MIPS64 | 3732 #endif // V8_TARGET_ARCH_MIPS64 |
| OLD | NEW |