Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: src/compiler/x87/instruction-selector-x87.cc

Issue 1534593004: [turbofan] Pass type information of arguments to EmitPrepareArguments. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Handle float32 and float64 differently. Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/compiler/x64/instruction-selector-x64.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « src/compiler/x64/instruction-selector-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698