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 #include "src/base/adapters.h" | 5 #include "src/base/adapters.h" |
6 #include "src/compiler/instruction-selector-impl.h" | 6 #include "src/compiler/instruction-selector-impl.h" |
7 #include "src/compiler/node-matchers.h" | 7 #include "src/compiler/node-matchers.h" |
8 #include "src/compiler/node-properties.h" | 8 #include "src/compiler/node-properties.h" |
9 #include "src/ppc/frames-ppc.h" | 9 #include "src/ppc/frames-ppc.h" |
10 | 10 |
(...skipping 1459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1470 for (Node* node : buffer.pushed_nodes) { | 1470 for (Node* node : buffer.pushed_nodes) { |
1471 Emit(kPPC_StoreToStackSlot, g.NoOutput(), g.UseRegister(node), | 1471 Emit(kPPC_StoreToStackSlot, g.NoOutput(), g.UseRegister(node), |
1472 g.TempImmediate(slot)); | 1472 g.TempImmediate(slot)); |
1473 ++slot; | 1473 ++slot; |
1474 } | 1474 } |
1475 } else { | 1475 } else { |
1476 // Push any stack arguments. | 1476 // Push any stack arguments. |
1477 int num_slots = static_cast<int>(descriptor->StackParameterCount()); | 1477 int num_slots = static_cast<int>(descriptor->StackParameterCount()); |
1478 int slot = 0; | 1478 int slot = 0; |
1479 for (Node* input : buffer.pushed_nodes) { | 1479 for (Node* input : buffer.pushed_nodes) { |
1480 // Skip any alignment holes in pushed nodes. | |
1481 if (input == nullptr) continue; | |
1482 if (slot == 0) { | 1480 if (slot == 0) { |
| 1481 DCHECK(input); |
1483 Emit(kPPC_PushFrame, g.NoOutput(), g.UseRegister(input), | 1482 Emit(kPPC_PushFrame, g.NoOutput(), g.UseRegister(input), |
1484 g.TempImmediate(num_slots)); | 1483 g.TempImmediate(num_slots)); |
1485 } else { | 1484 } else { |
1486 Emit(kPPC_StoreToStackSlot, g.NoOutput(), g.UseRegister(input), | 1485 // Skip any alignment holes in pushed nodes. |
1487 g.TempImmediate(slot)); | 1486 if (input) { |
| 1487 Emit(kPPC_StoreToStackSlot, g.NoOutput(), g.UseRegister(input), |
| 1488 g.TempImmediate(slot)); |
| 1489 } |
1488 } | 1490 } |
1489 ++slot; | 1491 ++slot; |
1490 } | 1492 } |
1491 } | 1493 } |
1492 | 1494 |
1493 // Pass label of exception handler block. | 1495 // Pass label of exception handler block. |
1494 CallDescriptor::Flags flags = descriptor->flags(); | 1496 CallDescriptor::Flags flags = descriptor->flags(); |
1495 if (handler) { | 1497 if (handler) { |
1496 DCHECK_EQ(IrOpcode::kIfException, handler->front()->opcode()); | 1498 DCHECK_EQ(IrOpcode::kIfException, handler->front()->opcode()); |
1497 IfExceptionHint hint = OpParameter<IfExceptionHint>(handler->front()); | 1499 IfExceptionHint hint = OpParameter<IfExceptionHint>(handler->front()); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1573 | 1575 |
1574 CallBuffer buffer(zone(), descriptor, frame_state_descriptor); | 1576 CallBuffer buffer(zone(), descriptor, frame_state_descriptor); |
1575 | 1577 |
1576 // Compute InstructionOperands for inputs and outputs. | 1578 // Compute InstructionOperands for inputs and outputs. |
1577 // TODO(turbofan): on PPC it's probably better to use the code object in a | 1579 // TODO(turbofan): on PPC it's probably better to use the code object in a |
1578 // register if there are multiple uses of it. Improve constant pool and the | 1580 // register if there are multiple uses of it. Improve constant pool and the |
1579 // heuristics in the register allocator for where to emit constants. | 1581 // heuristics in the register allocator for where to emit constants. |
1580 InitializeCallBuffer(node, &buffer, true, false); | 1582 InitializeCallBuffer(node, &buffer, true, false); |
1581 | 1583 |
1582 // Push any stack arguments. | 1584 // Push any stack arguments. |
1583 for (Node* input : base::Reversed(buffer.pushed_nodes)) { | 1585 int num_slots = static_cast<int>(descriptor->StackParameterCount()); |
1584 if (input == nullptr) continue; | 1586 int slot = 0; |
1585 Emit(kPPC_Push, g.NoOutput(), g.UseRegister(input)); | 1587 for (Node* input : buffer.pushed_nodes) { |
| 1588 if (slot == 0) { |
| 1589 Emit(kPPC_PushFrame, g.NoOutput(), g.UseRegister(input), |
| 1590 g.TempImmediate(num_slots)); |
| 1591 } else { |
| 1592 Emit(kPPC_StoreToStackSlot, g.NoOutput(), g.UseRegister(input), |
| 1593 g.TempImmediate(slot)); |
| 1594 } |
| 1595 ++slot; |
1586 } | 1596 } |
1587 | 1597 |
1588 // Select the appropriate opcode based on the call type. | 1598 // Select the appropriate opcode based on the call type. |
1589 InstructionCode opcode; | 1599 InstructionCode opcode; |
1590 switch (descriptor->kind()) { | 1600 switch (descriptor->kind()) { |
1591 case CallDescriptor::kCallCodeObject: { | 1601 case CallDescriptor::kCallCodeObject: { |
1592 opcode = kArchCallCodeObject; | 1602 opcode = kArchCallCodeObject; |
1593 break; | 1603 break; |
1594 } | 1604 } |
1595 case CallDescriptor::kCallJSFunction: | 1605 case CallDescriptor::kCallJSFunction: |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1662 InstructionSelector::SupportedMachineOperatorFlags() { | 1672 InstructionSelector::SupportedMachineOperatorFlags() { |
1663 return MachineOperatorBuilder::kFloat64RoundDown | | 1673 return MachineOperatorBuilder::kFloat64RoundDown | |
1664 MachineOperatorBuilder::kFloat64RoundTruncate | | 1674 MachineOperatorBuilder::kFloat64RoundTruncate | |
1665 MachineOperatorBuilder::kFloat64RoundTiesAway; | 1675 MachineOperatorBuilder::kFloat64RoundTiesAway; |
1666 // We omit kWord32ShiftIsSafe as s[rl]w use 0x3f as a mask rather than 0x1f. | 1676 // We omit kWord32ShiftIsSafe as s[rl]w use 0x3f as a mask rather than 0x1f. |
1667 } | 1677 } |
1668 | 1678 |
1669 } // namespace compiler | 1679 } // namespace compiler |
1670 } // namespace internal | 1680 } // namespace internal |
1671 } // namespace v8 | 1681 } // namespace v8 |
OLD | NEW |