| 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/bits.h" | 5 #include "src/base/bits.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 | 9 |
| 10 namespace v8 { | 10 namespace v8 { |
| (...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 void InstructionSelector::VisitFloat64RoundTruncate(Node* node) { | 622 void InstructionSelector::VisitFloat64RoundTruncate(Node* node) { |
| 623 VisitRR(this, kMips64Float64RoundTruncate, node); | 623 VisitRR(this, kMips64Float64RoundTruncate, node); |
| 624 } | 624 } |
| 625 | 625 |
| 626 | 626 |
| 627 void InstructionSelector::VisitFloat64RoundTiesAway(Node* node) { | 627 void InstructionSelector::VisitFloat64RoundTiesAway(Node* node) { |
| 628 UNREACHABLE(); | 628 UNREACHABLE(); |
| 629 } | 629 } |
| 630 | 630 |
| 631 | 631 |
| 632 void InstructionSelector::VisitCall(Node* node) { | 632 void InstructionSelector::VisitCall(Node* node, BasicBlock* handler) { |
| 633 Mips64OperandGenerator g(this); | 633 Mips64OperandGenerator g(this); |
| 634 const CallDescriptor* descriptor = OpParameter<const CallDescriptor*>(node); | 634 const CallDescriptor* descriptor = OpParameter<const CallDescriptor*>(node); |
| 635 | 635 |
| 636 FrameStateDescriptor* frame_state_descriptor = NULL; | 636 FrameStateDescriptor* frame_state_descriptor = NULL; |
| 637 if (descriptor->NeedsFrameState()) { | 637 if (descriptor->NeedsFrameState()) { |
| 638 frame_state_descriptor = | 638 frame_state_descriptor = |
| 639 GetFrameStateDescriptor(node->InputAt(descriptor->InputCount())); | 639 GetFrameStateDescriptor(node->InputAt(descriptor->InputCount())); |
| 640 } | 640 } |
| 641 | 641 |
| 642 CallBuffer buffer(zone(), descriptor, frame_state_descriptor); | 642 CallBuffer buffer(zone(), descriptor, frame_state_descriptor); |
| 643 | 643 |
| 644 // Compute InstructionOperands for inputs and outputs. | 644 // Compute InstructionOperands for inputs and outputs. |
| 645 InitializeCallBuffer(node, &buffer, true, false); | 645 InitializeCallBuffer(node, &buffer, true, false); |
| 646 | 646 |
| 647 int push_count = buffer.pushed_nodes.size(); | 647 int push_count = buffer.pushed_nodes.size(); |
| 648 if (push_count > 0) { | 648 if (push_count > 0) { |
| 649 Emit(kMips64StackClaim | MiscField::encode(push_count), g.NoOutput()); | 649 Emit(kMips64StackClaim | MiscField::encode(push_count), g.NoOutput()); |
| 650 } | 650 } |
| 651 int slot = buffer.pushed_nodes.size() - 1; | 651 int slot = buffer.pushed_nodes.size() - 1; |
| 652 for (auto i = buffer.pushed_nodes.rbegin(); i != buffer.pushed_nodes.rend(); | 652 for (auto i = buffer.pushed_nodes.rbegin(); i != buffer.pushed_nodes.rend(); |
| 653 ++i) { | 653 ++i) { |
| 654 Emit(kMips64StoreToStackSlot | MiscField::encode(slot), g.NoOutput(), | 654 Emit(kMips64StoreToStackSlot | MiscField::encode(slot), g.NoOutput(), |
| 655 g.UseRegister(*i)); | 655 g.UseRegister(*i)); |
| 656 slot--; | 656 slot--; |
| 657 } | 657 } |
| 658 | 658 |
| 659 // Pass label of exception handler block. |
| 660 CallDescriptor::Flags flags = descriptor->flags(); |
| 661 if (handler != nullptr) { |
| 662 flags |= CallDescriptor::kHasExceptionHandler; |
| 663 buffer.instruction_args.push_back(g.Label(handler)); |
| 664 } |
| 665 |
| 659 // Select the appropriate opcode based on the call type. | 666 // Select the appropriate opcode based on the call type. |
| 660 InstructionCode opcode; | 667 InstructionCode opcode; |
| 661 switch (descriptor->kind()) { | 668 switch (descriptor->kind()) { |
| 662 case CallDescriptor::kCallCodeObject: { | 669 case CallDescriptor::kCallCodeObject: { |
| 663 opcode = kArchCallCodeObject; | 670 opcode = kArchCallCodeObject; |
| 664 break; | 671 break; |
| 665 } | 672 } |
| 666 case CallDescriptor::kCallJSFunction: | 673 case CallDescriptor::kCallJSFunction: |
| 667 opcode = kArchCallJSFunction; | 674 opcode = kArchCallJSFunction; |
| 668 break; | 675 break; |
| 669 default: | 676 default: |
| 670 UNREACHABLE(); | 677 UNREACHABLE(); |
| 671 return; | 678 return; |
| 672 } | 679 } |
| 673 opcode |= MiscField::encode(descriptor->flags()); | 680 opcode |= MiscField::encode(flags); |
| 674 | 681 |
| 675 // Emit the call instruction. | 682 // Emit the call instruction. |
| 676 Instruction* call_instr = | 683 Instruction* call_instr = |
| 677 Emit(opcode, buffer.outputs.size(), &buffer.outputs.front(), | 684 Emit(opcode, buffer.outputs.size(), &buffer.outputs.front(), |
| 678 buffer.instruction_args.size(), &buffer.instruction_args.front()); | 685 buffer.instruction_args.size(), &buffer.instruction_args.front()); |
| 679 | 686 |
| 680 call_instr->MarkAsCall(); | 687 call_instr->MarkAsCall(); |
| 681 } | 688 } |
| 682 | 689 |
| 683 | 690 |
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1134 MachineOperatorBuilder::Flags | 1141 MachineOperatorBuilder::Flags |
| 1135 InstructionSelector::SupportedMachineOperatorFlags() { | 1142 InstructionSelector::SupportedMachineOperatorFlags() { |
| 1136 return MachineOperatorBuilder::kFloat64Floor | | 1143 return MachineOperatorBuilder::kFloat64Floor | |
| 1137 MachineOperatorBuilder::kFloat64Ceil | | 1144 MachineOperatorBuilder::kFloat64Ceil | |
| 1138 MachineOperatorBuilder::kFloat64RoundTruncate; | 1145 MachineOperatorBuilder::kFloat64RoundTruncate; |
| 1139 } | 1146 } |
| 1140 | 1147 |
| 1141 } // namespace compiler | 1148 } // namespace compiler |
| 1142 } // namespace internal | 1149 } // namespace internal |
| 1143 } // namespace v8 | 1150 } // namespace v8 |
| OLD | NEW |