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/compiler/instruction-selector-impl.h" | 5 #include "src/compiler/instruction-selector-impl.h" |
6 #include "src/compiler/node-matchers.h" | 6 #include "src/compiler/node-matchers.h" |
7 | 7 |
8 namespace v8 { | 8 namespace v8 { |
9 namespace internal { | 9 namespace internal { |
10 namespace compiler { | 10 namespace compiler { |
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
684 g.CanBeImmediate(*input) ? g.UseImmediate(*input) : g.Use(*input)); | 684 g.CanBeImmediate(*input) ? g.UseImmediate(*input) : g.Use(*input)); |
685 } | 685 } |
686 | 686 |
687 // Select the appropriate opcode based on the call type. | 687 // Select the appropriate opcode based on the call type. |
688 InstructionCode opcode; | 688 InstructionCode opcode; |
689 switch (descriptor->kind()) { | 689 switch (descriptor->kind()) { |
690 case CallDescriptor::kCallCodeObject: { | 690 case CallDescriptor::kCallCodeObject: { |
691 opcode = kArchCallCodeObject; | 691 opcode = kArchCallCodeObject; |
692 break; | 692 break; |
693 } | 693 } |
694 case CallDescriptor::kCallAddress: | |
695 opcode = kArchCallAddress; | |
696 break; | |
697 case CallDescriptor::kCallJSFunction: | 694 case CallDescriptor::kCallJSFunction: |
698 opcode = kArchCallJSFunction; | 695 opcode = kArchCallJSFunction; |
699 break; | 696 break; |
700 default: | 697 default: |
701 UNREACHABLE(); | 698 UNREACHABLE(); |
702 return; | 699 return; |
703 } | 700 } |
704 opcode |= MiscField::encode(descriptor->flags()); | 701 opcode |= MiscField::encode(descriptor->flags()); |
705 | 702 |
706 // Emit the call instruction. | 703 // Emit the call instruction. |
707 Instruction* call_instr = | 704 Instruction* call_instr = |
708 Emit(opcode, buffer.outputs.size(), &buffer.outputs.front(), | 705 Emit(opcode, buffer.outputs.size(), &buffer.outputs.front(), |
709 buffer.instruction_args.size(), &buffer.instruction_args.front()); | 706 buffer.instruction_args.size(), &buffer.instruction_args.front()); |
710 | 707 |
711 call_instr->MarkAsCall(); | 708 call_instr->MarkAsCall(); |
712 if (deoptimization != NULL) { | 709 if (deoptimization != NULL) { |
713 DCHECK(continuation != NULL); | 710 DCHECK(continuation != NULL); |
714 call_instr->MarkAsControl(); | 711 call_instr->MarkAsControl(); |
715 } | 712 } |
716 | |
717 // Caller clean up of stack for C-style calls. | |
718 if (descriptor->kind() == CallDescriptor::kCallAddress && | |
719 !buffer.pushed_nodes.empty()) { | |
720 DCHECK(deoptimization == NULL && continuation == NULL); | |
721 Emit(kArchDrop | | |
722 MiscField::encode(static_cast<int>(buffer.pushed_nodes.size())), | |
723 NULL); | |
724 } | |
725 } | 713 } |
726 | 714 |
727 } // namespace compiler | 715 } // namespace compiler |
728 } // namespace internal | 716 } // namespace internal |
729 } // namespace v8 | 717 } // namespace v8 |
OLD | NEW |