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), parameter_index_(0) {} |
| 36 PushParameter(Node* node, size_t parameter_index) |
| 37 : node_(node), parameter_index_(parameter_index) {} |
| 38 |
| 39 Node* node() const { return node_; } |
| 40 size_t parameter_index() const { return parameter_index_; } |
| 41 |
| 42 private: |
| 43 Node* node_; |
| 44 size_t parameter_index_; |
| 45 }; |
31 | 46 |
32 // Instruction selection generates an InstructionSequence for a given Schedule. | 47 // Instruction selection generates an InstructionSequence for a given Schedule. |
33 class InstructionSelector final { | 48 class InstructionSelector final { |
34 public: | 49 public: |
35 // Forward declarations. | 50 // Forward declarations. |
36 class Features; | 51 class Features; |
37 | 52 |
38 enum SourcePositionMode { kCallSourcePositions, kAllSourcePositions }; | 53 enum SourcePositionMode { kCallSourcePositions, kAllSourcePositions }; |
39 | 54 |
40 InstructionSelector( | 55 InstructionSelector( |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 void VisitConstant(Node* node); | 241 void VisitConstant(Node* node); |
227 void VisitCall(Node* call, BasicBlock* handler = nullptr); | 242 void VisitCall(Node* call, BasicBlock* handler = nullptr); |
228 void VisitTailCall(Node* call); | 243 void VisitTailCall(Node* call); |
229 void VisitGoto(BasicBlock* target); | 244 void VisitGoto(BasicBlock* target); |
230 void VisitBranch(Node* input, BasicBlock* tbranch, BasicBlock* fbranch); | 245 void VisitBranch(Node* input, BasicBlock* tbranch, BasicBlock* fbranch); |
231 void VisitSwitch(Node* node, const SwitchInfo& sw); | 246 void VisitSwitch(Node* node, const SwitchInfo& sw); |
232 void VisitDeoptimize(DeoptimizeKind kind, Node* value); | 247 void VisitDeoptimize(DeoptimizeKind kind, Node* value); |
233 void VisitReturn(Node* ret); | 248 void VisitReturn(Node* ret); |
234 void VisitThrow(Node* value); | 249 void VisitThrow(Node* value); |
235 | 250 |
236 void EmitPrepareArguments(NodeVector* arguments, | 251 void EmitPrepareArguments(ZoneVector<compiler::PushParameter>* arguments, |
237 const CallDescriptor* descriptor, Node* node); | 252 const CallDescriptor* descriptor, Node* node); |
238 | 253 |
239 // =========================================================================== | 254 // =========================================================================== |
240 | 255 |
241 Schedule* schedule() const { return schedule_; } | 256 Schedule* schedule() const { return schedule_; } |
242 Linkage* linkage() const { return linkage_; } | 257 Linkage* linkage() const { return linkage_; } |
243 InstructionSequence* sequence() const { return sequence_; } | 258 InstructionSequence* sequence() const { return sequence_; } |
244 Zone* instruction_zone() const { return sequence()->zone(); } | 259 Zone* instruction_zone() const { return sequence()->zone(); } |
245 Zone* zone() const { return zone_; } | 260 Zone* zone() const { return zone_; } |
246 | 261 |
(...skipping 12 matching lines...) Expand all Loading... |
259 BoolVector used_; | 274 BoolVector used_; |
260 IntVector virtual_registers_; | 275 IntVector virtual_registers_; |
261 InstructionScheduler* scheduler_; | 276 InstructionScheduler* scheduler_; |
262 }; | 277 }; |
263 | 278 |
264 } // namespace compiler | 279 } // namespace compiler |
265 } // namespace internal | 280 } // namespace internal |
266 } // namespace v8 | 281 } // namespace v8 |
267 | 282 |
268 #endif // V8_COMPILER_INSTRUCTION_SELECTOR_H_ | 283 #endif // V8_COMPILER_INSTRUCTION_SELECTOR_H_ |
OLD | NEW |