OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_PPC | 5 #if V8_TARGET_ARCH_PPC |
6 | 6 |
7 #include "src/full-codegen/full-codegen.h" | 7 #include "src/full-codegen/full-codegen.h" |
8 #include "src/ast/compile-time-value.h" | 8 #include "src/ast/compile-time-value.h" |
9 #include "src/ast/scopes.h" | 9 #include "src/ast/scopes.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 1535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1546 __ CallStub(&stub); | 1546 __ CallStub(&stub); |
1547 } | 1547 } |
1548 PrepareForBailoutForId(expr->CreateLiteralId(), BailoutState::TOS_REGISTER); | 1548 PrepareForBailoutForId(expr->CreateLiteralId(), BailoutState::TOS_REGISTER); |
1549 | 1549 |
1550 bool result_saved = false; // Is the result saved to the stack? | 1550 bool result_saved = false; // Is the result saved to the stack? |
1551 ZoneList<Expression*>* subexprs = expr->values(); | 1551 ZoneList<Expression*>* subexprs = expr->values(); |
1552 int length = subexprs->length(); | 1552 int length = subexprs->length(); |
1553 | 1553 |
1554 // Emit code to evaluate all the non-constant subexpressions and to store | 1554 // Emit code to evaluate all the non-constant subexpressions and to store |
1555 // them into the newly cloned array. | 1555 // them into the newly cloned array. |
1556 int array_index = 0; | 1556 for (int array_index = 0; array_index < length; array_index++) { |
1557 for (; array_index < length; array_index++) { | |
1558 Expression* subexpr = subexprs->at(array_index); | 1557 Expression* subexpr = subexprs->at(array_index); |
1559 DCHECK(!subexpr->IsSpread()); | 1558 DCHECK(!subexpr->IsSpread()); |
1560 // If the subexpression is a literal or a simple materialized literal it | 1559 // If the subexpression is a literal or a simple materialized literal it |
1561 // is already set in the cloned array. | 1560 // is already set in the cloned array. |
1562 if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue; | 1561 if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue; |
1563 | 1562 |
1564 if (!result_saved) { | 1563 if (!result_saved) { |
1565 PushOperand(r3); | 1564 PushOperand(r3); |
1566 result_saved = true; | 1565 result_saved = true; |
1567 } | 1566 } |
1568 VisitForAccumulatorValue(subexpr); | 1567 VisitForAccumulatorValue(subexpr); |
1569 | 1568 |
1570 __ LoadSmiLiteral(StoreDescriptor::NameRegister(), | 1569 __ LoadSmiLiteral(StoreDescriptor::NameRegister(), |
1571 Smi::FromInt(array_index)); | 1570 Smi::FromInt(array_index)); |
1572 __ LoadP(StoreDescriptor::ReceiverRegister(), MemOperand(sp, 0)); | 1571 __ LoadP(StoreDescriptor::ReceiverRegister(), MemOperand(sp, 0)); |
1573 EmitLoadStoreICSlot(expr->LiteralFeedbackSlot()); | 1572 EmitLoadStoreICSlot(expr->LiteralFeedbackSlot()); |
1574 CallKeyedStoreIC(); | 1573 CallKeyedStoreIC(); |
1575 | 1574 |
1576 PrepareForBailoutForId(expr->GetIdForElement(array_index), | 1575 PrepareForBailoutForId(expr->GetIdForElement(array_index), |
1577 BailoutState::NO_REGISTERS); | 1576 BailoutState::NO_REGISTERS); |
1578 } | 1577 } |
1579 | 1578 |
1580 // In case the array literal contains spread expressions it has two parts. The | |
1581 // first part is the "static" array which has a literal index is handled | |
1582 // above. The second part is the part after the first spread expression | |
1583 // (inclusive) and these elements gets appended to the array. Note that the | |
1584 // number elements an iterable produces is unknown ahead of time. | |
1585 if (array_index < length && result_saved) { | |
1586 PopOperand(r3); | |
1587 result_saved = false; | |
1588 } | |
1589 for (; array_index < length; array_index++) { | |
1590 Expression* subexpr = subexprs->at(array_index); | |
1591 | |
1592 PushOperand(r3); | |
1593 DCHECK(!subexpr->IsSpread()); | |
1594 VisitForStackValue(subexpr); | |
1595 CallRuntimeWithOperands(Runtime::kAppendElement); | |
1596 | |
1597 PrepareForBailoutForId(expr->GetIdForElement(array_index), | |
1598 BailoutState::NO_REGISTERS); | |
1599 } | |
1600 | |
1601 if (result_saved) { | 1579 if (result_saved) { |
1602 context()->PlugTOS(); | 1580 context()->PlugTOS(); |
1603 } else { | 1581 } else { |
1604 context()->Plug(r3); | 1582 context()->Plug(r3); |
1605 } | 1583 } |
1606 } | 1584 } |
1607 | 1585 |
1608 | 1586 |
1609 void FullCodeGenerator::VisitAssignment(Assignment* expr) { | 1587 void FullCodeGenerator::VisitAssignment(Assignment* expr) { |
1610 DCHECK(expr->target()->IsValidReferenceExpressionOrThis()); | 1588 DCHECK(expr->target()->IsValidReferenceExpressionOrThis()); |
(...skipping 2108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3719 | 3697 |
3720 DCHECK(Assembler::IsCrSet(Assembler::instr_at(cmp_address))); | 3698 DCHECK(Assembler::IsCrSet(Assembler::instr_at(cmp_address))); |
3721 | 3699 |
3722 DCHECK(interrupt_address == | 3700 DCHECK(interrupt_address == |
3723 isolate->builtins()->OnStackReplacement()->entry()); | 3701 isolate->builtins()->OnStackReplacement()->entry()); |
3724 return ON_STACK_REPLACEMENT; | 3702 return ON_STACK_REPLACEMENT; |
3725 } | 3703 } |
3726 } // namespace internal | 3704 } // namespace internal |
3727 } // namespace v8 | 3705 } // namespace v8 |
3728 #endif // V8_TARGET_ARCH_PPC | 3706 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |