| 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/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 Loading... |
| 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 Finish/Phi nodes. | 202 // Propagate "doubleness" throughout 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 switch (user->opcode()) { | 205 switch (user->opcode()) { |
| 206 case IrOpcode::kFinish: | |
| 207 case IrOpcode::kPhi: | 206 case IrOpcode::kPhi: |
| 208 if (IsDouble(user)) continue; | 207 if (IsDouble(user)) continue; |
| 209 MarkAsDouble(user); | 208 MarkAsDouble(user); |
| 210 break; | 209 break; |
| 211 default: | 210 default: |
| 212 break; | 211 break; |
| 213 } | 212 } |
| 214 } | 213 } |
| 215 } | 214 } |
| 216 | 215 |
| 217 | 216 |
| 218 bool InstructionSelector::IsReference(const Node* node) const { | 217 bool InstructionSelector::IsReference(const Node* node) const { |
| 219 DCHECK_NOT_NULL(node); | 218 DCHECK_NOT_NULL(node); |
| 220 return sequence()->IsReference(node->id()); | 219 return sequence()->IsReference(node->id()); |
| 221 } | 220 } |
| 222 | 221 |
| 223 | 222 |
| 224 void InstructionSelector::MarkAsReference(Node* node) { | 223 void InstructionSelector::MarkAsReference(Node* node) { |
| 225 DCHECK_NOT_NULL(node); | 224 DCHECK_NOT_NULL(node); |
| 226 DCHECK(!IsDouble(node)); | 225 DCHECK(!IsDouble(node)); |
| 227 sequence()->MarkAsReference(node->id()); | 226 sequence()->MarkAsReference(node->id()); |
| 228 | 227 |
| 229 // Propagate "referenceness" throughout Finish/Phi nodes. | 228 // Propagate "referenceness" throughout Phi nodes. |
| 230 for (UseIter i = node->uses().begin(); i != node->uses().end(); ++i) { | 229 for (UseIter i = node->uses().begin(); i != node->uses().end(); ++i) { |
| 231 Node* user = *i; | 230 Node* user = *i; |
| 232 switch (user->opcode()) { | 231 switch (user->opcode()) { |
| 233 case IrOpcode::kFinish: | |
| 234 case IrOpcode::kPhi: | 232 case IrOpcode::kPhi: |
| 235 if (IsReference(user)) continue; | 233 if (IsReference(user)) continue; |
| 236 MarkAsReference(user); | 234 MarkAsReference(user); |
| 237 break; | 235 break; |
| 238 default: | 236 default: |
| 239 break; | 237 break; |
| 240 } | 238 } |
| 241 } | 239 } |
| 242 } | 240 } |
| 243 | 241 |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 case IrOpcode::kLoop: | 473 case IrOpcode::kLoop: |
| 476 case IrOpcode::kEnd: | 474 case IrOpcode::kEnd: |
| 477 case IrOpcode::kBranch: | 475 case IrOpcode::kBranch: |
| 478 case IrOpcode::kIfTrue: | 476 case IrOpcode::kIfTrue: |
| 479 case IrOpcode::kIfFalse: | 477 case IrOpcode::kIfFalse: |
| 480 case IrOpcode::kEffectPhi: | 478 case IrOpcode::kEffectPhi: |
| 481 case IrOpcode::kMerge: | 479 case IrOpcode::kMerge: |
| 482 // No code needed for these graph artifacts. | 480 // No code needed for these graph artifacts. |
| 483 return; | 481 return; |
| 484 case IrOpcode::kFinish: | 482 case IrOpcode::kFinish: |
| 485 return VisitFinish(node); | 483 return MarkAsReference(node), VisitFinish(node); |
| 486 case IrOpcode::kParameter: { | 484 case IrOpcode::kParameter: { |
| 487 LinkageLocation location = | 485 LinkageLocation location = |
| 488 linkage()->GetParameterLocation(OpParameter<int>(node)); | 486 linkage()->GetParameterLocation(OpParameter<int>(node)); |
| 489 MarkAsRepresentation(location.representation(), node); | 487 MarkAsRepresentation(location.representation(), node); |
| 490 return VisitParameter(node); | 488 return VisitParameter(node); |
| 491 } | 489 } |
| 492 case IrOpcode::kPhi: | 490 case IrOpcode::kPhi: |
| 493 return VisitPhi(node); | 491 return VisitPhi(node); |
| 494 case IrOpcode::kProjection: | 492 case IrOpcode::kProjection: |
| 495 return VisitProjection(node); | 493 return VisitProjection(node); |
| (...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1096 | 1094 |
| 1097 | 1095 |
| 1098 void InstructionSelector::VisitCall(Node* call, BasicBlock* continuation, | 1096 void InstructionSelector::VisitCall(Node* call, BasicBlock* continuation, |
| 1099 BasicBlock* deoptimization) {} | 1097 BasicBlock* deoptimization) {} |
| 1100 | 1098 |
| 1101 #endif // !V8_TURBOFAN_BACKEND | 1099 #endif // !V8_TURBOFAN_BACKEND |
| 1102 | 1100 |
| 1103 } // namespace compiler | 1101 } // namespace compiler |
| 1104 } // namespace internal | 1102 } // namespace internal |
| 1105 } // namespace v8 | 1103 } // namespace v8 |
| OLD | NEW |