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" |
11 #include "src/compiler/instruction-scheduler.h" | 11 #include "src/compiler/instruction-scheduler.h" |
12 #include "src/compiler/instruction.h" | 12 #include "src/compiler/instruction.h" |
13 #include "src/compiler/machine-operator.h" | 13 #include "src/compiler/machine-operator.h" |
14 #include "src/compiler/node.h" | 14 #include "src/compiler/node.h" |
15 #include "src/globals.h" | 15 #include "src/globals.h" |
16 #include "src/zone/zone-containers.h" | 16 #include "src/zone/zone-containers.h" |
17 | 17 |
18 namespace v8 { | 18 namespace v8 { |
19 namespace internal { | 19 namespace internal { |
20 namespace compiler { | 20 namespace compiler { |
21 | 21 |
22 // Forward declarations. | 22 // Forward declarations. |
23 class BasicBlock; | 23 class BasicBlock; |
24 struct CallBuffer; // TODO(bmeurer): Remove this. | 24 struct CallBuffer; // TODO(bmeurer): Remove this. |
25 class FlagsContinuation; | 25 class FlagsContinuation; |
26 class Linkage; | 26 class Linkage; |
27 class OperandGenerator; | 27 class OperandGenerator; |
28 struct SwitchInfo; | 28 struct SwitchInfo; |
| 29 class StateObjectDeduplicator; |
29 | 30 |
30 // This struct connects nodes of parameters which are going to be pushed on the | 31 // This struct connects nodes of parameters which are going to be pushed on the |
31 // call stack with their parameter index in the call descriptor of the callee. | 32 // call stack with their parameter index in the call descriptor of the callee. |
32 class PushParameter { | 33 class PushParameter { |
33 public: | 34 public: |
34 PushParameter() : node_(nullptr), type_(MachineType::None()) {} | 35 PushParameter() : node_(nullptr), type_(MachineType::None()) {} |
35 PushParameter(Node* node, MachineType type) : node_(node), type_(type) {} | 36 PushParameter(Node* node, MachineType type) : node_(node), type_(type) {} |
36 | 37 |
37 Node* node() const { return node_; } | 38 Node* node() const { return node_; } |
38 MachineType type() const { return type_; } | 39 MachineType type() const { return type_; } |
39 | 40 |
40 private: | 41 private: |
41 Node* node_; | 42 Node* node_; |
42 MachineType type_; | 43 MachineType type_; |
43 }; | 44 }; |
44 | 45 |
| 46 enum class FrameStateInputKind { kAny, kStackSlot }; |
| 47 |
45 // Instruction selection generates an InstructionSequence for a given Schedule. | 48 // Instruction selection generates an InstructionSequence for a given Schedule. |
46 class V8_EXPORT_PRIVATE InstructionSelector final { | 49 class V8_EXPORT_PRIVATE InstructionSelector final { |
47 public: | 50 public: |
48 // Forward declarations. | 51 // Forward declarations. |
49 class Features; | 52 class Features; |
50 | 53 |
51 enum SourcePositionMode { kCallSourcePositions, kAllSourcePositions }; | 54 enum SourcePositionMode { kCallSourcePositions, kAllSourcePositions }; |
52 enum EnableScheduling { kDisableScheduling, kEnableScheduling }; | 55 enum EnableScheduling { kDisableScheduling, kEnableScheduling }; |
53 enum EnableSerialization { kDisableSerialization, kEnableSerialization }; | 56 enum EnableSerialization { kDisableSerialization, kEnableSerialization }; |
54 | 57 |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 // corresponding | 282 // corresponding |
280 // to the inputs and outputs of the call. | 283 // to the inputs and outputs of the call. |
281 // {call_code_immediate} to generate immediate operands to calls of code. | 284 // {call_code_immediate} to generate immediate operands to calls of code. |
282 // {call_address_immediate} to generate immediate operands to address calls. | 285 // {call_address_immediate} to generate immediate operands to address calls. |
283 void InitializeCallBuffer(Node* call, CallBuffer* buffer, | 286 void InitializeCallBuffer(Node* call, CallBuffer* buffer, |
284 CallBufferFlags flags, int stack_slot_delta = 0); | 287 CallBufferFlags flags, int stack_slot_delta = 0); |
285 bool IsTailCallAddressImmediate(); | 288 bool IsTailCallAddressImmediate(); |
286 int GetTempsCountForTailCallFromJSFunction(); | 289 int GetTempsCountForTailCallFromJSFunction(); |
287 | 290 |
288 FrameStateDescriptor* GetFrameStateDescriptor(Node* node); | 291 FrameStateDescriptor* GetFrameStateDescriptor(Node* node); |
| 292 size_t AddInputsToFrameStateDescriptor(FrameStateDescriptor* descriptor, |
| 293 Node* state, OperandGenerator* g, |
| 294 StateObjectDeduplicator* deduplicator, |
| 295 InstructionOperandVector* inputs, |
| 296 FrameStateInputKind kind, Zone* zone); |
| 297 size_t AddOperandToStateValueDescriptor(StateValueList* values, |
| 298 InstructionOperandVector* inputs, |
| 299 OperandGenerator* g, |
| 300 StateObjectDeduplicator* deduplicator, |
| 301 Node* input, MachineType type, |
| 302 FrameStateInputKind kind, Zone* zone); |
289 | 303 |
290 // =========================================================================== | 304 // =========================================================================== |
291 // ============= Architecture-specific graph covering methods. =============== | 305 // ============= Architecture-specific graph covering methods. =============== |
292 // =========================================================================== | 306 // =========================================================================== |
293 | 307 |
294 // Visit nodes in the given block and generate code. | 308 // Visit nodes in the given block and generate code. |
295 void VisitBlock(BasicBlock* block); | 309 void VisitBlock(BasicBlock* block); |
296 | 310 |
297 // Visit the node for the control flow at the end of the block, generating | 311 // Visit the node for the control flow at the end of the block, generating |
298 // code if necessary. | 312 // code if necessary. |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 EnableSerialization enable_serialization_; | 386 EnableSerialization enable_serialization_; |
373 Frame* frame_; | 387 Frame* frame_; |
374 bool instruction_selection_failed_; | 388 bool instruction_selection_failed_; |
375 }; | 389 }; |
376 | 390 |
377 } // namespace compiler | 391 } // namespace compiler |
378 } // namespace internal | 392 } // namespace internal |
379 } // namespace v8 | 393 } // namespace v8 |
380 | 394 |
381 #endif // V8_COMPILER_INSTRUCTION_SELECTOR_H_ | 395 #endif // V8_COMPILER_INSTRUCTION_SELECTOR_H_ |
OLD | NEW |