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_H_ | 5 #ifndef V8_COMPILER_INSTRUCTION_SELECTOR_H_ |
6 #define V8_COMPILER_INSTRUCTION_SELECTOR_H_ | 6 #define V8_COMPILER_INSTRUCTION_SELECTOR_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "src/compiler/common-operator.h" | 10 #include "src/compiler/common-operator.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 // Forward declarations. | 21 // Forward declarations. |
22 class BasicBlock; | 22 class BasicBlock; |
23 struct CallBuffer; // TODO(bmeurer): Remove this. | 23 struct CallBuffer; // TODO(bmeurer): Remove this. |
24 class FlagsContinuation; | 24 class FlagsContinuation; |
25 class Linkage; | 25 class Linkage; |
26 class OperandGenerator; | 26 class OperandGenerator; |
27 struct SwitchInfo; | 27 struct SwitchInfo; |
28 | 28 |
29 typedef ZoneVector<InstructionOperand> InstructionOperandVector; | 29 typedef ZoneVector<InstructionOperand> InstructionOperandVector; |
30 | 30 |
| 31 // This struct connects nodes of parameters which are going to be pushed on the |
| 32 // call stack with their parameter index in the call descriptor of the callee. |
| 33 class PushParameter { |
| 34 public: |
| 35 PushParameter() : node_(nullptr), type_(MachineType::None()) {} |
| 36 PushParameter(Node* node, MachineType type) : node_(node), type_(type) {} |
| 37 |
| 38 Node* node() const { return node_; } |
| 39 MachineType type() const { return type_; } |
| 40 |
| 41 private: |
| 42 Node* node_; |
| 43 MachineType type_; |
| 44 }; |
31 | 45 |
32 // Instruction selection generates an InstructionSequence for a given Schedule. | 46 // Instruction selection generates an InstructionSequence for a given Schedule. |
33 class InstructionSelector final { | 47 class InstructionSelector final { |
34 public: | 48 public: |
35 // Forward declarations. | 49 // Forward declarations. |
36 class Features; | 50 class Features; |
37 | 51 |
38 enum SourcePositionMode { kCallSourcePositions, kAllSourcePositions }; | 52 enum SourcePositionMode { kCallSourcePositions, kAllSourcePositions }; |
39 | 53 |
40 InstructionSelector( | 54 InstructionSelector( |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 void VisitConstant(Node* node); | 240 void VisitConstant(Node* node); |
227 void VisitCall(Node* call, BasicBlock* handler = nullptr); | 241 void VisitCall(Node* call, BasicBlock* handler = nullptr); |
228 void VisitTailCall(Node* call); | 242 void VisitTailCall(Node* call); |
229 void VisitGoto(BasicBlock* target); | 243 void VisitGoto(BasicBlock* target); |
230 void VisitBranch(Node* input, BasicBlock* tbranch, BasicBlock* fbranch); | 244 void VisitBranch(Node* input, BasicBlock* tbranch, BasicBlock* fbranch); |
231 void VisitSwitch(Node* node, const SwitchInfo& sw); | 245 void VisitSwitch(Node* node, const SwitchInfo& sw); |
232 void VisitDeoptimize(DeoptimizeKind kind, Node* value); | 246 void VisitDeoptimize(DeoptimizeKind kind, Node* value); |
233 void VisitReturn(Node* ret); | 247 void VisitReturn(Node* ret); |
234 void VisitThrow(Node* value); | 248 void VisitThrow(Node* value); |
235 | 249 |
236 void EmitPrepareArguments(NodeVector* arguments, | 250 void EmitPrepareArguments(ZoneVector<compiler::PushParameter>* arguments, |
237 const CallDescriptor* descriptor, Node* node); | 251 const CallDescriptor* descriptor, Node* node); |
238 | 252 |
239 // =========================================================================== | 253 // =========================================================================== |
240 | 254 |
241 Schedule* schedule() const { return schedule_; } | 255 Schedule* schedule() const { return schedule_; } |
242 Linkage* linkage() const { return linkage_; } | 256 Linkage* linkage() const { return linkage_; } |
243 InstructionSequence* sequence() const { return sequence_; } | 257 InstructionSequence* sequence() const { return sequence_; } |
244 Zone* instruction_zone() const { return sequence()->zone(); } | 258 Zone* instruction_zone() const { return sequence()->zone(); } |
245 Zone* zone() const { return zone_; } | 259 Zone* zone() const { return zone_; } |
246 | 260 |
(...skipping 12 matching lines...) Expand all Loading... |
259 BoolVector used_; | 273 BoolVector used_; |
260 IntVector virtual_registers_; | 274 IntVector virtual_registers_; |
261 InstructionScheduler* scheduler_; | 275 InstructionScheduler* scheduler_; |
262 }; | 276 }; |
263 | 277 |
264 } // namespace compiler | 278 } // namespace compiler |
265 } // namespace internal | 279 } // namespace internal |
266 } // namespace v8 | 280 } // namespace v8 |
267 | 281 |
268 #endif // V8_COMPILER_INSTRUCTION_SELECTOR_H_ | 282 #endif // V8_COMPILER_INSTRUCTION_SELECTOR_H_ |
OLD | NEW |