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

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

Issue 490673006: [turbofan] Add support for Finish to the InstructionSelector. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 4 months 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 | Annotate | Revision Log
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/compiler/instruction-selector.h" 5 #include "src/compiler/instruction-selector.h"
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-inl.h" 9 #include "src/compiler/node-properties-inl.h"
10 #include "src/compiler/pipeline.h" 10 #include "src/compiler/pipeline.h"
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 DCHECK_NOT_NULL(node); 192 DCHECK_NOT_NULL(node);
193 return sequence()->IsDouble(node->id()); 193 return sequence()->IsDouble(node->id());
194 } 194 }
195 195
196 196
197 void InstructionSelector::MarkAsDouble(Node* node) { 197 void InstructionSelector::MarkAsDouble(Node* node) {
198 DCHECK_NOT_NULL(node); 198 DCHECK_NOT_NULL(node);
199 DCHECK(!IsReference(node)); 199 DCHECK(!IsReference(node));
200 sequence()->MarkAsDouble(node->id()); 200 sequence()->MarkAsDouble(node->id());
201 201
202 // Propagate "doubleness" throughout phis. 202 // Propagate "doubleness" throughout Finish/Phi nodes.
203 for (UseIter i = node->uses().begin(); i != node->uses().end(); ++i) { 203 for (UseIter i = node->uses().begin(); i != node->uses().end(); ++i) {
204 Node* user = *i; 204 Node* user = *i;
205 if (user->opcode() != IrOpcode::kPhi) continue; 205 switch (user->opcode()) {
206 if (IsDouble(user)) continue; 206 case IrOpcode::kFinish:
207 MarkAsDouble(user); 207 case IrOpcode::kPhi:
208 if (IsDouble(user)) continue;
209 MarkAsDouble(user);
210 break;
211 default:
212 break;
213 }
208 } 214 }
209 } 215 }
210 216
211 217
212 bool InstructionSelector::IsReference(const Node* node) const { 218 bool InstructionSelector::IsReference(const Node* node) const {
213 DCHECK_NOT_NULL(node); 219 DCHECK_NOT_NULL(node);
214 return sequence()->IsReference(node->id()); 220 return sequence()->IsReference(node->id());
215 } 221 }
216 222
217 223
218 void InstructionSelector::MarkAsReference(Node* node) { 224 void InstructionSelector::MarkAsReference(Node* node) {
219 DCHECK_NOT_NULL(node); 225 DCHECK_NOT_NULL(node);
220 DCHECK(!IsDouble(node)); 226 DCHECK(!IsDouble(node));
221 sequence()->MarkAsReference(node->id()); 227 sequence()->MarkAsReference(node->id());
222 228
223 // Propagate "referenceness" throughout phis. 229 // Propagate "referenceness" throughout Finish/Phi nodes.
224 for (UseIter i = node->uses().begin(); i != node->uses().end(); ++i) { 230 for (UseIter i = node->uses().begin(); i != node->uses().end(); ++i) {
225 Node* user = *i; 231 Node* user = *i;
226 if (user->opcode() != IrOpcode::kPhi) continue; 232 switch (user->opcode()) {
227 if (IsReference(user)) continue; 233 case IrOpcode::kFinish:
228 MarkAsReference(user); 234 case IrOpcode::kPhi:
235 if (IsReference(user)) continue;
236 MarkAsReference(user);
237 break;
238 default:
239 break;
240 }
229 } 241 }
230 } 242 }
231 243
232 244
233 void InstructionSelector::MarkAsRepresentation(MachineType rep, Node* node) { 245 void InstructionSelector::MarkAsRepresentation(MachineType rep, Node* node) {
234 DCHECK_NOT_NULL(node); 246 DCHECK_NOT_NULL(node);
235 if (RepresentationOf(rep) == kRepFloat64) MarkAsDouble(node); 247 if (RepresentationOf(rep) == kRepFloat64) MarkAsDouble(node);
236 if (RepresentationOf(rep) == kRepTagged) MarkAsReference(node); 248 if (RepresentationOf(rep) == kRepTagged) MarkAsReference(node);
237 } 249 }
238 250
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 case IrOpcode::kEnd: 469 case IrOpcode::kEnd:
458 case IrOpcode::kBranch: 470 case IrOpcode::kBranch:
459 case IrOpcode::kIfTrue: 471 case IrOpcode::kIfTrue:
460 case IrOpcode::kIfFalse: 472 case IrOpcode::kIfFalse:
461 case IrOpcode::kEffectPhi: 473 case IrOpcode::kEffectPhi:
462 case IrOpcode::kMerge: 474 case IrOpcode::kMerge:
463 case IrOpcode::kLazyDeoptimization: 475 case IrOpcode::kLazyDeoptimization:
464 case IrOpcode::kContinuation: 476 case IrOpcode::kContinuation:
465 // No code needed for these graph artifacts. 477 // No code needed for these graph artifacts.
466 return; 478 return;
479 case IrOpcode::kFinish:
480 return VisitFinish(node);
467 case IrOpcode::kParameter: { 481 case IrOpcode::kParameter: {
468 int index = OpParameter<int>(node); 482 LinkageLocation location =
469 MachineType rep = linkage() 483 linkage()->GetParameterLocation(OpParameter<int>(node));
470 ->GetIncomingDescriptor() 484 MarkAsRepresentation(location.representation(), node);
471 ->GetInputLocation(index)
472 .representation();
473 MarkAsRepresentation(rep, node);
474 return VisitParameter(node); 485 return VisitParameter(node);
475 } 486 }
476 case IrOpcode::kPhi: 487 case IrOpcode::kPhi:
477 return VisitPhi(node); 488 return VisitPhi(node);
478 case IrOpcode::kProjection: 489 case IrOpcode::kProjection:
479 return VisitProjection(node); 490 return VisitProjection(node);
480 case IrOpcode::kInt32Constant: 491 case IrOpcode::kInt32Constant:
481 case IrOpcode::kInt64Constant: 492 case IrOpcode::kInt64Constant:
482 case IrOpcode::kExternalConstant: 493 case IrOpcode::kExternalConstant:
483 return VisitConstant(node); 494 return VisitConstant(node);
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 801
791 802
792 void InstructionSelector::VisitWord64Compare(Node* node, 803 void InstructionSelector::VisitWord64Compare(Node* node,
793 FlagsContinuation* cont) { 804 FlagsContinuation* cont) {
794 UNIMPLEMENTED(); 805 UNIMPLEMENTED();
795 } 806 }
796 807
797 #endif // V8_TARGET_ARCH_32_BIT || !V8_TURBOFAN_BACKEND 808 #endif // V8_TARGET_ARCH_32_BIT || !V8_TURBOFAN_BACKEND
798 809
799 810
811 void InstructionSelector::VisitFinish(Node* node) {
812 OperandGenerator g(this);
813 Node* value = node->InputAt(0);
814 Emit(kArchNop, g.DefineSameAsFirst(node), g.Use(value));
815 }
816
817
800 void InstructionSelector::VisitParameter(Node* node) { 818 void InstructionSelector::VisitParameter(Node* node) {
801 OperandGenerator g(this); 819 OperandGenerator g(this);
802 Emit(kArchNop, g.DefineAsLocation(node, linkage()->GetParameterLocation( 820 Emit(kArchNop, g.DefineAsLocation(node, linkage()->GetParameterLocation(
803 OpParameter<int>(node)))); 821 OpParameter<int>(node))));
804 } 822 }
805 823
806 824
807 void InstructionSelector::VisitPhi(Node* node) { 825 void InstructionSelector::VisitPhi(Node* node) {
808 // TODO(bmeurer): Emit a PhiInstruction here. 826 // TODO(bmeurer): Emit a PhiInstruction here.
809 for (InputIter i = node->inputs().begin(); i != node->inputs().end(); ++i) { 827 for (InputIter i = node->inputs().begin(); i != node->inputs().end(); ++i) {
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
1067 1085
1068 1086
1069 void InstructionSelector::VisitCall(Node* call, BasicBlock* continuation, 1087 void InstructionSelector::VisitCall(Node* call, BasicBlock* continuation,
1070 BasicBlock* deoptimization) {} 1088 BasicBlock* deoptimization) {}
1071 1089
1072 #endif // !V8_TURBOFAN_BACKEND 1090 #endif // !V8_TURBOFAN_BACKEND
1073 1091
1074 } // namespace compiler 1092 } // namespace compiler
1075 } // namespace internal 1093 } // namespace internal
1076 } // namespace v8 1094 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/instruction-selector.h ('k') | test/compiler-unittests/instruction-selector-unittest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698