| 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 | 9 |
| 10 namespace v8 { | 10 namespace v8 { |
| (...skipping 878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 889 void InstructionSelector::VisitFloat32RoundTiesEven(Node* node) { | 889 void InstructionSelector::VisitFloat32RoundTiesEven(Node* node) { |
| 890 VisitRR(this, node, kSSEFloat32Round | MiscField::encode(kRoundToNearest)); | 890 VisitRR(this, node, kSSEFloat32Round | MiscField::encode(kRoundToNearest)); |
| 891 } | 891 } |
| 892 | 892 |
| 893 | 893 |
| 894 void InstructionSelector::VisitFloat64RoundTiesEven(Node* node) { | 894 void InstructionSelector::VisitFloat64RoundTiesEven(Node* node) { |
| 895 VisitRR(this, node, kSSEFloat64Round | MiscField::encode(kRoundToNearest)); | 895 VisitRR(this, node, kSSEFloat64Round | MiscField::encode(kRoundToNearest)); |
| 896 } | 896 } |
| 897 | 897 |
| 898 | 898 |
| 899 void InstructionSelector::EmitPrepareArguments(NodeVector* arguments, | 899 void InstructionSelector::EmitPrepareArguments( |
| 900 const CallDescriptor* descriptor, | 900 ZoneVector<PushParameter>* arguments, const CallDescriptor* descriptor, |
| 901 Node* node) { | 901 Node* node) { |
| 902 IA32OperandGenerator g(this); | 902 IA32OperandGenerator g(this); |
| 903 | 903 |
| 904 // Prepare for C function call. | 904 // Prepare for C function call. |
| 905 if (descriptor->IsCFunctionCall()) { | 905 if (descriptor->IsCFunctionCall()) { |
| 906 InstructionOperand temps[] = {g.TempRegister()}; | 906 InstructionOperand temps[] = {g.TempRegister()}; |
| 907 size_t const temp_count = arraysize(temps); | 907 size_t const temp_count = arraysize(temps); |
| 908 Emit(kArchPrepareCallCFunction | | 908 Emit(kArchPrepareCallCFunction | |
| 909 MiscField::encode(static_cast<int>(descriptor->CParameterCount())), | 909 MiscField::encode(static_cast<int>(descriptor->CParameterCount())), |
| 910 0, nullptr, 0, nullptr, temp_count, temps); | 910 0, nullptr, 0, nullptr, temp_count, temps); |
| 911 | 911 |
| 912 // Poke any stack arguments. | 912 // Poke any stack arguments. |
| 913 for (size_t n = 0; n < arguments->size(); ++n) { | 913 for (size_t n = 0; n < arguments->size(); ++n) { |
| 914 if (Node* input = (*arguments)[n]) { | 914 PushParameter input = (*arguments)[n]; |
| 915 if (input.node()) { |
| 915 int const slot = static_cast<int>(n); | 916 int const slot = static_cast<int>(n); |
| 916 InstructionOperand value = g.CanBeImmediate(node) | 917 InstructionOperand value = g.CanBeImmediate(node) |
| 917 ? g.UseImmediate(input) | 918 ? g.UseImmediate(input.node()) |
| 918 : g.UseRegister(input); | 919 : g.UseRegister(input.node()); |
| 919 Emit(kIA32Poke | MiscField::encode(slot), g.NoOutput(), value); | 920 Emit(kIA32Poke | MiscField::encode(slot), g.NoOutput(), value); |
| 920 } | 921 } |
| 921 } | 922 } |
| 922 } else { | 923 } else { |
| 923 // Push any stack arguments. | 924 // Push any stack arguments. |
| 924 for (Node* input : base::Reversed(*arguments)) { | 925 for (PushParameter input : base::Reversed(*arguments)) { |
| 925 // Skip any alignment holes in pushed nodes. | 926 // Skip any alignment holes in pushed nodes. |
| 926 if (input == nullptr) continue; | 927 if (input.node() == nullptr) continue; |
| 927 // TODO(titzer): IA32Push cannot handle stack->stack double moves | |
| 928 // because there is no way to encode fixed double slots. | |
| 929 InstructionOperand value = | 928 InstructionOperand value = |
| 930 g.CanBeImmediate(input) | 929 g.CanBeImmediate(input.node()) |
| 931 ? g.UseImmediate(input) | 930 ? g.UseImmediate(input.node()) |
| 932 : IsSupported(ATOM) || | 931 : IsSupported(ATOM) || |
| 933 sequence()->IsFloat(GetVirtualRegister(input)) | 932 sequence()->IsFloat(GetVirtualRegister(input.node())) |
| 934 ? g.UseRegister(input) | 933 ? g.UseRegister(input.node()) |
| 935 : g.Use(input); | 934 : g.Use(input.node()); |
| 936 Emit(kIA32Push, g.NoOutput(), value); | 935 if (input.type() == MachineType::Float32()) { |
| 936 Emit(kIA32PushFloat32, g.NoOutput(), value); |
| 937 } else if (input.type() == MachineType::Float64()) { |
| 938 Emit(kIA32PushFloat64, g.NoOutput(), value); |
| 939 } else { |
| 940 Emit(kIA32Push, g.NoOutput(), value); |
| 941 } |
| 937 } | 942 } |
| 938 } | 943 } |
| 939 } | 944 } |
| 940 | 945 |
| 941 | 946 |
| 942 bool InstructionSelector::IsTailCallAddressImmediate() { return true; } | 947 bool InstructionSelector::IsTailCallAddressImmediate() { return true; } |
| 943 | 948 |
| 944 | 949 |
| 945 namespace { | 950 namespace { |
| 946 | 951 |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1312 MachineOperatorBuilder::kFloat64RoundTruncate | | 1317 MachineOperatorBuilder::kFloat64RoundTruncate | |
| 1313 MachineOperatorBuilder::kFloat32RoundTiesEven | | 1318 MachineOperatorBuilder::kFloat32RoundTiesEven | |
| 1314 MachineOperatorBuilder::kFloat64RoundTiesEven; | 1319 MachineOperatorBuilder::kFloat64RoundTiesEven; |
| 1315 } | 1320 } |
| 1316 return flags; | 1321 return flags; |
| 1317 } | 1322 } |
| 1318 | 1323 |
| 1319 } // namespace compiler | 1324 } // namespace compiler |
| 1320 } // namespace internal | 1325 } // namespace internal |
| 1321 } // namespace v8 | 1326 } // namespace v8 |
| OLD | NEW |