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