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 885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
896 } | 896 } |
897 | 897 |
898 | 898 |
899 void InstructionSelector::VisitFloat64RoundTiesEven(Node* node) { | 899 void InstructionSelector::VisitFloat64RoundTiesEven(Node* node) { |
900 X87OperandGenerator g(this); | 900 X87OperandGenerator g(this); |
901 Emit(kX87Float64Round | MiscField::encode(kRoundToNearest), | 901 Emit(kX87Float64Round | MiscField::encode(kRoundToNearest), |
902 g.UseFixed(node, stX_0), g.Use(node->InputAt(0))); | 902 g.UseFixed(node, stX_0), g.Use(node->InputAt(0))); |
903 } | 903 } |
904 | 904 |
905 | 905 |
906 void InstructionSelector::EmitPrepareArguments(NodeVector* arguments, | 906 void InstructionSelector::EmitPrepareArguments( |
907 const CallDescriptor* descriptor, | 907 ZoneVector<PushParameter>* arguments, const CallDescriptor* descriptor, |
908 Node* node) { | 908 Node* node) { |
909 X87OperandGenerator g(this); | 909 X87OperandGenerator g(this); |
910 | 910 |
911 // Prepare for C function call. | 911 // Prepare for C function call. |
912 if (descriptor->IsCFunctionCall()) { | 912 if (descriptor->IsCFunctionCall()) { |
913 InstructionOperand temps[] = {g.TempRegister()}; | 913 InstructionOperand temps[] = {g.TempRegister()}; |
914 size_t const temp_count = arraysize(temps); | 914 size_t const temp_count = arraysize(temps); |
915 Emit(kArchPrepareCallCFunction | | 915 Emit(kArchPrepareCallCFunction | |
916 MiscField::encode(static_cast<int>(descriptor->CParameterCount())), | 916 MiscField::encode(static_cast<int>(descriptor->CParameterCount())), |
917 0, nullptr, 0, nullptr, temp_count, temps); | 917 0, nullptr, 0, nullptr, temp_count, temps); |
918 | 918 |
919 // Poke any stack arguments. | 919 // Poke any stack arguments. |
920 for (size_t n = 0; n < arguments->size(); ++n) { | 920 for (size_t n = 0; n < arguments->size(); ++n) { |
921 if (Node* input = (*arguments)[n]) { | 921 PushParameter input = (*arguments)[n]; |
| 922 if (input.node()) { |
922 int const slot = static_cast<int>(n); | 923 int const slot = static_cast<int>(n); |
923 InstructionOperand value = g.CanBeImmediate(input) | 924 InstructionOperand value = g.CanBeImmediate(input.node()) |
924 ? g.UseImmediate(input) | 925 ? g.UseImmediate(input.node()) |
925 : g.UseRegister(input); | 926 : g.UseRegister(input.node()); |
926 Emit(kX87Poke | MiscField::encode(slot), g.NoOutput(), value); | 927 Emit(kX87Poke | MiscField::encode(slot), g.NoOutput(), value); |
927 } | 928 } |
928 } | 929 } |
929 } else { | 930 } else { |
930 // Push any stack arguments. | 931 // Push any stack arguments. |
931 for (Node* input : base::Reversed(*arguments)) { | 932 for (PushParameter input : base::Reversed(*arguments)) { |
932 // TODO(titzer): handle pushing double parameters. | 933 // TODO(titzer): handle pushing double parameters. |
933 if (input == nullptr) continue; | 934 if (input.node() == nullptr) continue; |
934 InstructionOperand value = | 935 InstructionOperand value = |
935 g.CanBeImmediate(input) | 936 g.CanBeImmediate(input.node()) |
936 ? g.UseImmediate(input) | 937 ? g.UseImmediate(input.node()) |
937 : IsSupported(ATOM) || | 938 : IsSupported(ATOM) || |
938 sequence()->IsFloat(GetVirtualRegister(input)) | 939 sequence()->IsFloat(GetVirtualRegister(input.node())) |
939 ? g.UseRegister(input) | 940 ? g.UseRegister(input.node()) |
940 : g.Use(input); | 941 : g.Use(input.node()); |
941 Emit(kX87Push, g.NoOutput(), value); | 942 Emit(kX87Push, g.NoOutput(), value); |
942 } | 943 } |
943 } | 944 } |
944 } | 945 } |
945 | 946 |
946 | 947 |
947 bool InstructionSelector::IsTailCallAddressImmediate() { return true; } | 948 bool InstructionSelector::IsTailCallAddressImmediate() { return true; } |
948 | 949 |
949 | 950 |
950 namespace { | 951 namespace { |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1326 MachineOperatorBuilder::kFloat32RoundTruncate | | 1327 MachineOperatorBuilder::kFloat32RoundTruncate | |
1327 MachineOperatorBuilder::kFloat64RoundTruncate | | 1328 MachineOperatorBuilder::kFloat64RoundTruncate | |
1328 MachineOperatorBuilder::kFloat32RoundTiesEven | | 1329 MachineOperatorBuilder::kFloat32RoundTiesEven | |
1329 MachineOperatorBuilder::kFloat64RoundTiesEven; | 1330 MachineOperatorBuilder::kFloat64RoundTiesEven; |
1330 return flags; | 1331 return flags; |
1331 } | 1332 } |
1332 | 1333 |
1333 } // namespace compiler | 1334 } // namespace compiler |
1334 } // namespace internal | 1335 } // namespace internal |
1335 } // namespace v8 | 1336 } // namespace v8 |
OLD | NEW |