| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 sequence()->AddConstant(virtual_register, ToConstant(node)); | 68 sequence()->AddConstant(virtual_register, ToConstant(node)); |
| 69 return ConstantOperand(virtual_register); | 69 return ConstantOperand(virtual_register); |
| 70 } | 70 } |
| 71 | 71 |
| 72 InstructionOperand DefineAsLocation(Node* node, LinkageLocation location, | 72 InstructionOperand DefineAsLocation(Node* node, LinkageLocation location, |
| 73 MachineType type) { | 73 MachineType type) { |
| 74 return Define(node, ToUnallocatedOperand(location, type, GetVReg(node))); | 74 return Define(node, ToUnallocatedOperand(location, type, GetVReg(node))); |
| 75 } | 75 } |
| 76 | 76 |
| 77 InstructionOperand Use(Node* node) { | 77 InstructionOperand Use(Node* node) { |
| 78 return Use(node, UnallocatedOperand(UnallocatedOperand::NONE, | 78 IrOpcode::Value opcode = node->opcode(); |
| 79 UnallocatedOperand::USED_AT_START, | 79 if (opcode == IrOpcode::kLoadFramePointer) { |
| 80 GetVReg(node))); | 80 return FramePointerOperand(); |
| 81 } else if (opcode == IrOpcode::kLoadStackPointer) { |
| 82 return StackPointerOperand(); |
| 83 } else { |
| 84 return Use(node, UnallocatedOperand(UnallocatedOperand::NONE, |
| 85 UnallocatedOperand::USED_AT_START, |
| 86 GetVReg(node))); |
| 87 } |
| 81 } | 88 } |
| 82 | 89 |
| 83 InstructionOperand UseRegister(Node* node) { | 90 InstructionOperand UseRegister(Node* node) { |
| 84 return Use(node, UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER, | 91 IrOpcode::Value opcode = node->opcode(); |
| 85 UnallocatedOperand::USED_AT_START, | 92 if (opcode == IrOpcode::kLoadFramePointer) { |
| 86 GetVReg(node))); | 93 return FramePointerOperand(); |
| 94 } else if (opcode == IrOpcode::kLoadStackPointer) { |
| 95 return StackPointerOperand(); |
| 96 } else { |
| 97 return Use(node, UnallocatedOperand( |
| 98 UnallocatedOperand::MUST_HAVE_REGISTER, |
| 99 UnallocatedOperand::USED_AT_START, GetVReg(node))); |
| 100 } |
| 87 } | 101 } |
| 88 | 102 |
| 89 InstructionOperand UseUniqueSlot(Node* node) { | 103 InstructionOperand UseUniqueSlot(Node* node) { |
| 90 return Use(node, UnallocatedOperand(UnallocatedOperand::MUST_HAVE_SLOT, | 104 return Use(node, UnallocatedOperand(UnallocatedOperand::MUST_HAVE_SLOT, |
| 91 GetVReg(node))); | 105 GetVReg(node))); |
| 92 } | 106 } |
| 93 | 107 |
| 94 // Use register or operand for the node. If a register is chosen, it won't | 108 // Use register or operand for the node. If a register is chosen, it won't |
| 95 // alias any temporary or output registers. | 109 // alias any temporary or output registers. |
| 96 InstructionOperand UseUnique(Node* node) { | 110 InstructionOperand UseUnique(Node* node) { |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 : (frame_state_descriptor->GetTotalSize() + | 391 : (frame_state_descriptor->GetTotalSize() + |
| 378 1); // Include deopt id. | 392 1); // Include deopt id. |
| 379 } | 393 } |
| 380 }; | 394 }; |
| 381 | 395 |
| 382 } // namespace compiler | 396 } // namespace compiler |
| 383 } // namespace internal | 397 } // namespace internal |
| 384 } // namespace v8 | 398 } // namespace v8 |
| 385 | 399 |
| 386 #endif // V8_COMPILER_INSTRUCTION_SELECTOR_IMPL_H_ | 400 #endif // V8_COMPILER_INSTRUCTION_SELECTOR_IMPL_H_ |
| OLD | NEW |