OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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_S390 | 5 #if V8_TARGET_ARCH_S390 |
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 1495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1506 __ CallStub(&stub); | 1506 __ CallStub(&stub); |
1507 } | 1507 } |
1508 PrepareForBailoutForId(expr->CreateLiteralId(), BailoutState::TOS_REGISTER); | 1508 PrepareForBailoutForId(expr->CreateLiteralId(), BailoutState::TOS_REGISTER); |
1509 | 1509 |
1510 bool result_saved = false; // Is the result saved to the stack? | 1510 bool result_saved = false; // Is the result saved to the stack? |
1511 ZoneList<Expression*>* subexprs = expr->values(); | 1511 ZoneList<Expression*>* subexprs = expr->values(); |
1512 int length = subexprs->length(); | 1512 int length = subexprs->length(); |
1513 | 1513 |
1514 // Emit code to evaluate all the non-constant subexpressions and to store | 1514 // Emit code to evaluate all the non-constant subexpressions and to store |
1515 // them into the newly cloned array. | 1515 // them into the newly cloned array. |
1516 int array_index = 0; | 1516 for (int array_index = 0; array_index < length; array_index++) { |
1517 for (; array_index < length; array_index++) { | |
1518 Expression* subexpr = subexprs->at(array_index); | 1517 Expression* subexpr = subexprs->at(array_index); |
1519 DCHECK(!subexpr->IsSpread()); | 1518 DCHECK(!subexpr->IsSpread()); |
1520 // If the subexpression is a literal or a simple materialized literal it | 1519 // If the subexpression is a literal or a simple materialized literal it |
1521 // is already set in the cloned array. | 1520 // is already set in the cloned array. |
1522 if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue; | 1521 if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue; |
1523 | 1522 |
1524 if (!result_saved) { | 1523 if (!result_saved) { |
1525 PushOperand(r2); | 1524 PushOperand(r2); |
1526 result_saved = true; | 1525 result_saved = true; |
1527 } | 1526 } |
1528 VisitForAccumulatorValue(subexpr); | 1527 VisitForAccumulatorValue(subexpr); |
1529 | 1528 |
1530 __ LoadSmiLiteral(StoreDescriptor::NameRegister(), | 1529 __ LoadSmiLiteral(StoreDescriptor::NameRegister(), |
1531 Smi::FromInt(array_index)); | 1530 Smi::FromInt(array_index)); |
1532 __ LoadP(StoreDescriptor::ReceiverRegister(), MemOperand(sp, 0)); | 1531 __ LoadP(StoreDescriptor::ReceiverRegister(), MemOperand(sp, 0)); |
1533 EmitLoadStoreICSlot(expr->LiteralFeedbackSlot()); | 1532 EmitLoadStoreICSlot(expr->LiteralFeedbackSlot()); |
1534 CallKeyedStoreIC(); | 1533 CallKeyedStoreIC(); |
1535 | 1534 |
1536 PrepareForBailoutForId(expr->GetIdForElement(array_index), | 1535 PrepareForBailoutForId(expr->GetIdForElement(array_index), |
1537 BailoutState::NO_REGISTERS); | 1536 BailoutState::NO_REGISTERS); |
1538 } | 1537 } |
1539 | 1538 |
1540 // In case the array literal contains spread expressions it has two parts. The | |
1541 // first part is the "static" array which has a literal index is handled | |
1542 // above. The second part is the part after the first spread expression | |
1543 // (inclusive) and these elements gets appended to the array. Note that the | |
1544 // number elements an iterable produces is unknown ahead of time. | |
1545 if (array_index < length && result_saved) { | |
1546 PopOperand(r2); | |
1547 result_saved = false; | |
1548 } | |
1549 for (; array_index < length; array_index++) { | |
1550 Expression* subexpr = subexprs->at(array_index); | |
1551 | |
1552 PushOperand(r2); | |
1553 DCHECK(!subexpr->IsSpread()); | |
1554 VisitForStackValue(subexpr); | |
1555 CallRuntimeWithOperands(Runtime::kAppendElement); | |
1556 | |
1557 PrepareForBailoutForId(expr->GetIdForElement(array_index), | |
1558 BailoutState::NO_REGISTERS); | |
1559 } | |
1560 | |
1561 if (result_saved) { | 1539 if (result_saved) { |
1562 context()->PlugTOS(); | 1540 context()->PlugTOS(); |
1563 } else { | 1541 } else { |
1564 context()->Plug(r2); | 1542 context()->Plug(r2); |
1565 } | 1543 } |
1566 } | 1544 } |
1567 | 1545 |
1568 void FullCodeGenerator::VisitAssignment(Assignment* expr) { | 1546 void FullCodeGenerator::VisitAssignment(Assignment* expr) { |
1569 DCHECK(expr->target()->IsValidReferenceExpressionOrThis()); | 1547 DCHECK(expr->target()->IsValidReferenceExpressionOrThis()); |
1570 | 1548 |
(...skipping 2060 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3631 DCHECK(kOSRBranchInstruction == br_instr); | 3609 DCHECK(kOSRBranchInstruction == br_instr); |
3632 | 3610 |
3633 DCHECK(interrupt_address == | 3611 DCHECK(interrupt_address == |
3634 isolate->builtins()->OnStackReplacement()->entry()); | 3612 isolate->builtins()->OnStackReplacement()->entry()); |
3635 return ON_STACK_REPLACEMENT; | 3613 return ON_STACK_REPLACEMENT; |
3636 } | 3614 } |
3637 | 3615 |
3638 } // namespace internal | 3616 } // namespace internal |
3639 } // namespace v8 | 3617 } // namespace v8 |
3640 #endif // V8_TARGET_ARCH_S390 | 3618 #endif // V8_TARGET_ARCH_S390 |
OLD | NEW |