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

Side by Side Diff: src/compiler/x64/instruction-selector-x64.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
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 <algorithm> 5 #include <algorithm>
6 6
7 #include "src/base/adapters.h" 7 #include "src/base/adapters.h"
8 #include "src/compiler/instruction-selector-impl.h" 8 #include "src/compiler/instruction-selector-impl.h"
9 #include "src/compiler/node-matchers.h" 9 #include "src/compiler/node-matchers.h"
10 #include "src/compiler/node-properties.h" 10 #include "src/compiler/node-properties.h"
(...skipping 1215 matching lines...) Expand 10 before | Expand all | Expand 10 after
1226 void InstructionSelector::VisitFloat32RoundTiesEven(Node* node) { 1226 void InstructionSelector::VisitFloat32RoundTiesEven(Node* node) {
1227 VisitRR(this, node, kSSEFloat32Round | MiscField::encode(kRoundToNearest)); 1227 VisitRR(this, node, kSSEFloat32Round | MiscField::encode(kRoundToNearest));
1228 } 1228 }
1229 1229
1230 1230
1231 void InstructionSelector::VisitFloat64RoundTiesEven(Node* node) { 1231 void InstructionSelector::VisitFloat64RoundTiesEven(Node* node) {
1232 VisitRR(this, node, kSSEFloat64Round | MiscField::encode(kRoundToNearest)); 1232 VisitRR(this, node, kSSEFloat64Round | MiscField::encode(kRoundToNearest));
1233 } 1233 }
1234 1234
1235 1235
1236 void InstructionSelector::EmitPrepareArguments(NodeVector* arguments, 1236 void InstructionSelector::EmitPrepareArguments(
1237 const CallDescriptor* descriptor, 1237 ZoneVector<PushParameter>* arguments, const CallDescriptor* descriptor,
1238 Node* node) { 1238 Node* node) {
1239 X64OperandGenerator g(this); 1239 X64OperandGenerator g(this);
1240 1240
1241 // Prepare for C function call. 1241 // Prepare for C function call.
1242 if (descriptor->IsCFunctionCall()) { 1242 if (descriptor->IsCFunctionCall()) {
1243 Emit(kArchPrepareCallCFunction | 1243 Emit(kArchPrepareCallCFunction |
1244 MiscField::encode(static_cast<int>(descriptor->CParameterCount())), 1244 MiscField::encode(static_cast<int>(descriptor->CParameterCount())),
1245 0, nullptr, 0, nullptr); 1245 0, nullptr, 0, nullptr);
1246 1246
1247 // Poke any stack arguments. 1247 // Poke any stack arguments.
1248 for (size_t n = 0; n < arguments->size(); ++n) { 1248 for (size_t n = 0; n < arguments->size(); ++n) {
1249 if (Node* input = (*arguments)[n]) { 1249 PushParameter input = (*arguments)[n];
1250 if (input.node()) {
1250 int slot = static_cast<int>(n); 1251 int slot = static_cast<int>(n);
1251 InstructionOperand value = g.CanBeImmediate(input) 1252 InstructionOperand value = g.CanBeImmediate(input.node())
1252 ? g.UseImmediate(input) 1253 ? g.UseImmediate(input.node())
1253 : g.UseRegister(input); 1254 : g.UseRegister(input.node());
1254 Emit(kX64Poke | MiscField::encode(slot), g.NoOutput(), value); 1255 Emit(kX64Poke | MiscField::encode(slot), g.NoOutput(), value);
1255 } 1256 }
1256 } 1257 }
1257 } else { 1258 } else {
1258 // Push any stack arguments. 1259 // Push any stack arguments.
1259 for (Node* input : base::Reversed(*arguments)) { 1260 for (PushParameter input : base::Reversed(*arguments)) {
1260 // TODO(titzer): X64Push cannot handle stack->stack double moves 1261 // TODO(titzer): X64Push cannot handle stack->stack double moves
1261 // because there is no way to encode fixed double slots. 1262 // because there is no way to encode fixed double slots.
1262 InstructionOperand value = 1263 InstructionOperand value =
1263 g.CanBeImmediate(input) 1264 g.CanBeImmediate(input.node())
1264 ? g.UseImmediate(input) 1265 ? g.UseImmediate(input.node())
1265 : IsSupported(ATOM) || 1266 : IsSupported(ATOM) ||
1266 sequence()->IsFloat(GetVirtualRegister(input)) 1267 sequence()->IsFloat(GetVirtualRegister(input.node()))
1267 ? g.UseRegister(input) 1268 ? g.UseRegister(input.node())
1268 : g.Use(input); 1269 : g.Use(input.node());
1269 Emit(kX64Push, g.NoOutput(), value); 1270 Emit(kX64Push, g.NoOutput(), value);
1270 } 1271 }
1271 } 1272 }
1272 } 1273 }
1273 1274
1274 1275
1275 bool InstructionSelector::IsTailCallAddressImmediate() { return true; } 1276 bool InstructionSelector::IsTailCallAddressImmediate() { return true; }
1276 1277
1277 1278
1278 namespace { 1279 namespace {
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
1769 MachineOperatorBuilder::kFloat64RoundTruncate | 1770 MachineOperatorBuilder::kFloat64RoundTruncate |
1770 MachineOperatorBuilder::kFloat32RoundTiesEven | 1771 MachineOperatorBuilder::kFloat32RoundTiesEven |
1771 MachineOperatorBuilder::kFloat64RoundTiesEven; 1772 MachineOperatorBuilder::kFloat64RoundTiesEven;
1772 } 1773 }
1773 return flags; 1774 return flags;
1774 } 1775 }
1775 1776
1776 } // namespace compiler 1777 } // namespace compiler
1777 } // namespace internal 1778 } // namespace internal
1778 } // namespace v8 1779 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/ppc/instruction-selector-ppc.cc ('k') | src/compiler/x87/instruction-selector-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698