| 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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 UnallocatedOperand Use(Node* node, UnallocatedOperand operand) { | 201 UnallocatedOperand Use(Node* node, UnallocatedOperand operand) { |
| 202 DCHECK_NOT_NULL(node); | 202 DCHECK_NOT_NULL(node); |
| 203 DCHECK_EQ(operand.virtual_register(), GetVReg(node)); | 203 DCHECK_EQ(operand.virtual_register(), GetVReg(node)); |
| 204 selector()->MarkAsUsed(node); | 204 selector()->MarkAsUsed(node); |
| 205 return operand; | 205 return operand; |
| 206 } | 206 } |
| 207 | 207 |
| 208 UnallocatedOperand ToUnallocatedOperand(LinkageLocation location, | 208 UnallocatedOperand ToUnallocatedOperand(LinkageLocation location, |
| 209 MachineType type, | 209 MachineType type, |
| 210 int virtual_register) { | 210 int virtual_register) { |
| 211 if (location.location_ == LinkageLocation::ANY_REGISTER) { | 211 if (location.IsAnyRegister()) { |
| 212 // any machine register. | 212 // any machine register. |
| 213 return UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER, | 213 return UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER, |
| 214 virtual_register); | 214 virtual_register); |
| 215 } | 215 } |
| 216 if (location.location_ < 0) { | 216 if (location.IsCallerFrameSlot()) { |
| 217 // a location on the caller frame. | 217 // a location on the caller frame. |
| 218 return UnallocatedOperand(UnallocatedOperand::FIXED_SLOT, | 218 return UnallocatedOperand(UnallocatedOperand::FIXED_SLOT, |
| 219 location.location_, virtual_register); | 219 location.AsCallerFrameSlot(), virtual_register); |
| 220 } | 220 } |
| 221 if (location.location_ > LinkageLocation::ANY_REGISTER) { | 221 if (location.IsCalleeFrameSlot()) { |
| 222 // a spill location on this (callee) frame. | 222 // a spill location on this (callee) frame. |
| 223 return UnallocatedOperand( | 223 return UnallocatedOperand(UnallocatedOperand::FIXED_SLOT, |
| 224 UnallocatedOperand::FIXED_SLOT, | 224 location.AsCalleeFrameSlot(), virtual_register); |
| 225 location.location_ - LinkageLocation::ANY_REGISTER - 1, | |
| 226 virtual_register); | |
| 227 } | 225 } |
| 228 // a fixed register. | 226 // a fixed register. |
| 229 if (RepresentationOf(type) == kRepFloat64) { | 227 if (RepresentationOf(type) == kRepFloat64) { |
| 230 return UnallocatedOperand(UnallocatedOperand::FIXED_DOUBLE_REGISTER, | 228 return UnallocatedOperand(UnallocatedOperand::FIXED_DOUBLE_REGISTER, |
| 231 location.location_, virtual_register); | 229 location.AsRegister(), virtual_register); |
| 232 } | 230 } |
| 233 return UnallocatedOperand(UnallocatedOperand::FIXED_REGISTER, | 231 return UnallocatedOperand(UnallocatedOperand::FIXED_REGISTER, |
| 234 location.location_, virtual_register); | 232 location.AsRegister(), virtual_register); |
| 235 } | 233 } |
| 236 | 234 |
| 237 InstructionSelector* selector_; | 235 InstructionSelector* selector_; |
| 238 }; | 236 }; |
| 239 | 237 |
| 240 | 238 |
| 241 // The flags continuation is a way to combine a branch or a materialization | 239 // The flags continuation is a way to combine a branch or a materialization |
| 242 // of a boolean value with an instruction that sets the flags register. | 240 // of a boolean value with an instruction that sets the flags register. |
| 243 // The whole instruction is treated as a unit by the register allocator, and | 241 // The whole instruction is treated as a unit by the register allocator, and |
| 244 // thus no spills or moves can be introduced between the flags-setting | 242 // thus no spills or moves can be introduced between the flags-setting |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 : (frame_state_descriptor->GetTotalSize() + | 375 : (frame_state_descriptor->GetTotalSize() + |
| 378 1); // Include deopt id. | 376 1); // Include deopt id. |
| 379 } | 377 } |
| 380 }; | 378 }; |
| 381 | 379 |
| 382 } // namespace compiler | 380 } // namespace compiler |
| 383 } // namespace internal | 381 } // namespace internal |
| 384 } // namespace v8 | 382 } // namespace v8 |
| 385 | 383 |
| 386 #endif // V8_COMPILER_INSTRUCTION_SELECTOR_IMPL_H_ | 384 #endif // V8_COMPILER_INSTRUCTION_SELECTOR_IMPL_H_ |
| OLD | NEW |