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 <algorithm> | 5 #include <algorithm> |
6 | 6 |
7 #include "src/compiler/instruction-selector-impl.h" | 7 #include "src/compiler/instruction-selector-impl.h" |
8 #include "src/compiler/node-matchers.h" | 8 #include "src/compiler/node-matchers.h" |
9 #include "src/compiler/node-properties.h" | 9 #include "src/compiler/node-properties.h" |
10 | 10 |
(...skipping 922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
933 DCHECK(CpuFeatures::IsSupported(SSE4_1)); | 933 DCHECK(CpuFeatures::IsSupported(SSE4_1)); |
934 VisitRRFloat64(this, kSSEFloat64RoundTruncate, node); | 934 VisitRRFloat64(this, kSSEFloat64RoundTruncate, node); |
935 } | 935 } |
936 | 936 |
937 | 937 |
938 void InstructionSelector::VisitFloat64RoundTiesAway(Node* node) { | 938 void InstructionSelector::VisitFloat64RoundTiesAway(Node* node) { |
939 UNREACHABLE(); | 939 UNREACHABLE(); |
940 } | 940 } |
941 | 941 |
942 | 942 |
943 void InstructionSelector::VisitCall(Node* node) { | 943 void InstructionSelector::VisitCall(Node* node, BasicBlock* handler) { |
944 X64OperandGenerator g(this); | 944 X64OperandGenerator g(this); |
945 const CallDescriptor* descriptor = OpParameter<const CallDescriptor*>(node); | 945 const CallDescriptor* descriptor = OpParameter<const CallDescriptor*>(node); |
946 | 946 |
947 FrameStateDescriptor* frame_state_descriptor = NULL; | 947 FrameStateDescriptor* frame_state_descriptor = NULL; |
948 if (descriptor->NeedsFrameState()) { | 948 if (descriptor->NeedsFrameState()) { |
949 frame_state_descriptor = GetFrameStateDescriptor( | 949 frame_state_descriptor = GetFrameStateDescriptor( |
950 node->InputAt(static_cast<int>(descriptor->InputCount()))); | 950 node->InputAt(static_cast<int>(descriptor->InputCount()))); |
951 } | 951 } |
952 | 952 |
953 CallBuffer buffer(zone(), descriptor, frame_state_descriptor); | 953 CallBuffer buffer(zone(), descriptor, frame_state_descriptor); |
954 | 954 |
955 // Compute InstructionOperands for inputs and outputs. | 955 // Compute InstructionOperands for inputs and outputs. |
956 InitializeCallBuffer(node, &buffer, true, true); | 956 InitializeCallBuffer(node, &buffer, true, true); |
957 | 957 |
958 // Push any stack arguments. | 958 // Push any stack arguments. |
959 for (auto i = buffer.pushed_nodes.rbegin(); i != buffer.pushed_nodes.rend(); | 959 for (auto i = buffer.pushed_nodes.rbegin(); i != buffer.pushed_nodes.rend(); |
960 ++i) { | 960 ++i) { |
961 // TODO(titzer): handle pushing double parameters. | 961 // TODO(titzer): handle pushing double parameters. |
962 InstructionOperand value = | 962 InstructionOperand value = |
963 g.CanBeImmediate(*i) ? g.UseImmediate(*i) : IsSupported(ATOM) | 963 g.CanBeImmediate(*i) ? g.UseImmediate(*i) : IsSupported(ATOM) |
964 ? g.UseRegister(*i) | 964 ? g.UseRegister(*i) |
965 : g.Use(*i); | 965 : g.Use(*i); |
966 Emit(kX64Push, g.NoOutput(), value); | 966 Emit(kX64Push, g.NoOutput(), value); |
967 } | 967 } |
968 | 968 |
| 969 // Pass label of exception handler block. |
| 970 CallDescriptor::Flags flags = descriptor->flags(); |
| 971 if (handler != nullptr) { |
| 972 flags |= CallDescriptor::kHasExceptionHandler; |
| 973 buffer.instruction_args.push_back(g.Label(handler)); |
| 974 } |
| 975 |
969 // Select the appropriate opcode based on the call type. | 976 // Select the appropriate opcode based on the call type. |
970 InstructionCode opcode; | 977 InstructionCode opcode; |
971 switch (descriptor->kind()) { | 978 switch (descriptor->kind()) { |
972 case CallDescriptor::kCallCodeObject: { | 979 case CallDescriptor::kCallCodeObject: { |
973 opcode = kArchCallCodeObject; | 980 opcode = kArchCallCodeObject; |
974 break; | 981 break; |
975 } | 982 } |
976 case CallDescriptor::kCallJSFunction: | 983 case CallDescriptor::kCallJSFunction: |
977 opcode = kArchCallJSFunction; | 984 opcode = kArchCallJSFunction; |
978 break; | 985 break; |
979 default: | 986 default: |
980 UNREACHABLE(); | 987 UNREACHABLE(); |
981 return; | 988 return; |
982 } | 989 } |
983 opcode |= MiscField::encode(descriptor->flags()); | 990 opcode |= MiscField::encode(flags); |
984 | 991 |
985 // Emit the call instruction. | 992 // Emit the call instruction. |
986 InstructionOperand* first_output = | 993 InstructionOperand* first_output = |
987 buffer.outputs.size() > 0 ? &buffer.outputs.front() : NULL; | 994 buffer.outputs.size() > 0 ? &buffer.outputs.front() : NULL; |
988 Instruction* call_instr = | 995 Instruction* call_instr = |
989 Emit(opcode, buffer.outputs.size(), first_output, | 996 Emit(opcode, buffer.outputs.size(), first_output, |
990 buffer.instruction_args.size(), &buffer.instruction_args.front()); | 997 buffer.instruction_args.size(), &buffer.instruction_args.front()); |
991 call_instr->MarkAsCall(); | 998 call_instr->MarkAsCall(); |
992 } | 999 } |
993 | 1000 |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1397 MachineOperatorBuilder::kFloat64Ceil | | 1404 MachineOperatorBuilder::kFloat64Ceil | |
1398 MachineOperatorBuilder::kFloat64RoundTruncate | | 1405 MachineOperatorBuilder::kFloat64RoundTruncate | |
1399 MachineOperatorBuilder::kWord32ShiftIsSafe; | 1406 MachineOperatorBuilder::kWord32ShiftIsSafe; |
1400 } | 1407 } |
1401 return MachineOperatorBuilder::kNoFlags; | 1408 return MachineOperatorBuilder::kNoFlags; |
1402 } | 1409 } |
1403 | 1410 |
1404 } // namespace compiler | 1411 } // namespace compiler |
1405 } // namespace internal | 1412 } // namespace internal |
1406 } // namespace v8 | 1413 } // namespace v8 |
OLD | NEW |