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 #ifndef V8_COMPILER_INSTRUCTION_SELECTOR_IMPL_H_ | 5 #ifndef V8_COMPILER_INSTRUCTION_SELECTOR_IMPL_H_ |
6 #define V8_COMPILER_INSTRUCTION_SELECTOR_IMPL_H_ | 6 #define V8_COMPILER_INSTRUCTION_SELECTOR_IMPL_H_ |
7 | 7 |
8 #include "src/compiler/instruction.h" | 8 #include "src/compiler/instruction.h" |
9 #include "src/compiler/instruction-selector.h" | 9 #include "src/compiler/instruction-selector.h" |
10 #include "src/compiler/linkage.h" | 10 #include "src/compiler/linkage.h" |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 InstructionOperand TempLocation(LinkageLocation location, MachineType type) { | 186 InstructionOperand TempLocation(LinkageLocation location, MachineType type) { |
187 return ToUnallocatedOperand(location, type, | 187 return ToUnallocatedOperand(location, type, |
188 sequence()->NextVirtualRegister()); | 188 sequence()->NextVirtualRegister()); |
189 } | 189 } |
190 | 190 |
191 InstructionOperand Label(BasicBlock* block) { | 191 InstructionOperand Label(BasicBlock* block) { |
192 return sequence()->AddImmediate( | 192 return sequence()->AddImmediate( |
193 Constant(RpoNumber::FromInt(block->rpo_number()))); | 193 Constant(RpoNumber::FromInt(block->rpo_number()))); |
194 } | 194 } |
195 | 195 |
| 196 InstructionOperand UseForDeopt(Node* node, FrameStateInputKind kind) { |
| 197 switch (node->opcode()) { |
| 198 case IrOpcode::kInt32Constant: |
| 199 case IrOpcode::kNumberConstant: |
| 200 case IrOpcode::kFloat32Constant: |
| 201 case IrOpcode::kFloat64Constant: |
| 202 case IrOpcode::kHeapConstant: |
| 203 return UseImmediate(node); |
| 204 default: |
| 205 switch (kind) { |
| 206 case FrameStateInputKind::kStackSlot: |
| 207 return UseUniqueSlot(node); |
| 208 case FrameStateInputKind::kAny: |
| 209 return UseAny(node); |
| 210 } |
| 211 } |
| 212 UNREACHABLE(); |
| 213 } |
| 214 |
196 protected: | 215 protected: |
197 InstructionSelector* selector() const { return selector_; } | 216 InstructionSelector* selector() const { return selector_; } |
198 InstructionSequence* sequence() const { return selector()->sequence(); } | 217 InstructionSequence* sequence() const { return selector()->sequence(); } |
199 Zone* zone() const { return selector()->instruction_zone(); } | 218 Zone* zone() const { return selector()->instruction_zone(); } |
200 | 219 |
201 private: | 220 private: |
202 int GetVReg(Node* node) const { return selector_->GetVirtualRegister(node); } | 221 int GetVReg(Node* node) const { return selector_->GetVirtualRegister(node); } |
203 | 222 |
204 static Constant ToConstant(const Node* node) { | 223 static Constant ToConstant(const Node* node) { |
205 switch (node->opcode()) { | 224 switch (node->opcode()) { |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 Node* result_; // Only valid if mode_ == kFlags_set. | 378 Node* result_; // Only valid if mode_ == kFlags_set. |
360 BasicBlock* true_block_; // Only valid if mode_ == kFlags_branch. | 379 BasicBlock* true_block_; // Only valid if mode_ == kFlags_branch. |
361 BasicBlock* false_block_; // Only valid if mode_ == kFlags_branch. | 380 BasicBlock* false_block_; // Only valid if mode_ == kFlags_branch. |
362 }; | 381 }; |
363 | 382 |
364 } // namespace compiler | 383 } // namespace compiler |
365 } // namespace internal | 384 } // namespace internal |
366 } // namespace v8 | 385 } // namespace v8 |
367 | 386 |
368 #endif // V8_COMPILER_INSTRUCTION_SELECTOR_IMPL_H_ | 387 #endif // V8_COMPILER_INSTRUCTION_SELECTOR_IMPL_H_ |
OLD | NEW |