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_RAW_MACHINE_ASSEMBLER_H_ | 5 #ifndef V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_ |
6 #define V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_ | 6 #define V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_ |
7 | 7 |
8 #include "src/assembler.h" | 8 #include "src/assembler.h" |
9 #include "src/compiler/common-operator.h" | 9 #include "src/compiler/common-operator.h" |
10 #include "src/compiler/graph.h" | 10 #include "src/compiler/graph.h" |
11 #include "src/compiler/linkage.h" | 11 #include "src/compiler/linkage.h" |
12 #include "src/compiler/machine-operator.h" | 12 #include "src/compiler/machine-operator.h" |
13 #include "src/compiler/node.h" | 13 #include "src/compiler/node.h" |
14 #include "src/compiler/operator.h" | 14 #include "src/compiler/operator.h" |
15 #include "src/factory.h" | 15 #include "src/factory.h" |
| 16 #include "src/globals.h" |
16 | 17 |
17 namespace v8 { | 18 namespace v8 { |
18 namespace internal { | 19 namespace internal { |
19 namespace compiler { | 20 namespace compiler { |
20 | 21 |
21 class BasicBlock; | 22 class BasicBlock; |
22 class RawMachineLabel; | 23 class RawMachineLabel; |
23 class Schedule; | 24 class Schedule; |
24 | 25 |
25 | 26 |
26 // The RawMachineAssembler produces a low-level IR graph. All nodes are wired | 27 // The RawMachineAssembler produces a low-level IR graph. All nodes are wired |
27 // into a graph and also placed into a schedule immediately, hence subsequent | 28 // into a graph and also placed into a schedule immediately, hence subsequent |
28 // code generation can happen without the need for scheduling. | 29 // code generation can happen without the need for scheduling. |
29 // | 30 // |
30 // In order to create a schedule on-the-fly, the assembler keeps track of basic | 31 // In order to create a schedule on-the-fly, the assembler keeps track of basic |
31 // blocks by having one current basic block being populated and by referencing | 32 // blocks by having one current basic block being populated and by referencing |
32 // other basic blocks through the use of labels. | 33 // other basic blocks through the use of labels. |
33 // | 34 // |
34 // Also note that the generated graph is only valid together with the generated | 35 // Also note that the generated graph is only valid together with the generated |
35 // schedule, using one without the other is invalid as the graph is inherently | 36 // schedule, using one without the other is invalid as the graph is inherently |
36 // non-schedulable due to missing control and effect dependencies. | 37 // non-schedulable due to missing control and effect dependencies. |
37 class RawMachineAssembler { | 38 class V8_EXPORT_PRIVATE RawMachineAssembler { |
38 public: | 39 public: |
39 RawMachineAssembler( | 40 RawMachineAssembler( |
40 Isolate* isolate, Graph* graph, CallDescriptor* call_descriptor, | 41 Isolate* isolate, Graph* graph, CallDescriptor* call_descriptor, |
41 MachineRepresentation word = MachineType::PointerRepresentation(), | 42 MachineRepresentation word = MachineType::PointerRepresentation(), |
42 MachineOperatorBuilder::Flags flags = | 43 MachineOperatorBuilder::Flags flags = |
43 MachineOperatorBuilder::Flag::kNoFlags, | 44 MachineOperatorBuilder::Flag::kNoFlags, |
44 MachineOperatorBuilder::AlignmentRequirements alignment_requirements = | 45 MachineOperatorBuilder::AlignmentRequirements alignment_requirements = |
45 MachineOperatorBuilder::AlignmentRequirements:: | 46 MachineOperatorBuilder::AlignmentRequirements:: |
46 FullUnalignedAccessSupport()); | 47 FullUnalignedAccessSupport()); |
47 ~RawMachineAssembler() {} | 48 ~RawMachineAssembler() {} |
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
827 Schedule* schedule_; | 828 Schedule* schedule_; |
828 MachineOperatorBuilder machine_; | 829 MachineOperatorBuilder machine_; |
829 CommonOperatorBuilder common_; | 830 CommonOperatorBuilder common_; |
830 CallDescriptor* call_descriptor_; | 831 CallDescriptor* call_descriptor_; |
831 NodeVector parameters_; | 832 NodeVector parameters_; |
832 BasicBlock* current_block_; | 833 BasicBlock* current_block_; |
833 | 834 |
834 DISALLOW_COPY_AND_ASSIGN(RawMachineAssembler); | 835 DISALLOW_COPY_AND_ASSIGN(RawMachineAssembler); |
835 }; | 836 }; |
836 | 837 |
837 | 838 class V8_EXPORT_PRIVATE RawMachineLabel final { |
838 class RawMachineLabel final { | |
839 public: | 839 public: |
840 enum Type { kDeferred, kNonDeferred }; | 840 enum Type { kDeferred, kNonDeferred }; |
841 | 841 |
842 explicit RawMachineLabel(Type type = kNonDeferred) | 842 explicit RawMachineLabel(Type type = kNonDeferred) |
843 : deferred_(type == kDeferred) {} | 843 : deferred_(type == kDeferred) {} |
844 ~RawMachineLabel(); | 844 ~RawMachineLabel(); |
845 | 845 |
846 private: | 846 private: |
847 BasicBlock* block_ = nullptr; | 847 BasicBlock* block_ = nullptr; |
848 bool used_ = false; | 848 bool used_ = false; |
849 bool bound_ = false; | 849 bool bound_ = false; |
850 bool deferred_; | 850 bool deferred_; |
851 friend class RawMachineAssembler; | 851 friend class RawMachineAssembler; |
852 DISALLOW_COPY_AND_ASSIGN(RawMachineLabel); | 852 DISALLOW_COPY_AND_ASSIGN(RawMachineLabel); |
853 }; | 853 }; |
854 | 854 |
855 } // namespace compiler | 855 } // namespace compiler |
856 } // namespace internal | 856 } // namespace internal |
857 } // namespace v8 | 857 } // namespace v8 |
858 | 858 |
859 #endif // V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_ | 859 #endif // V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_ |
OLD | NEW |