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/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/compiler/common-operator.h" | 10 #include "src/compiler/common-operator.h" |
(...skipping 27 matching lines...) Expand all Loading... | |
38 explicit Label(BasicBlock* block) | 38 explicit Label(BasicBlock* block) |
39 : block_(block), used_(false), bound_(false) {} | 39 : block_(block), used_(false), bound_(false) {} |
40 | 40 |
41 BasicBlock* block_; | 41 BasicBlock* block_; |
42 bool used_; | 42 bool used_; |
43 bool bound_; | 43 bool bound_; |
44 friend class RawMachineAssembler; | 44 friend class RawMachineAssembler; |
45 DISALLOW_COPY_AND_ASSIGN(Label); | 45 DISALLOW_COPY_AND_ASSIGN(Label); |
46 }; | 46 }; |
47 | 47 |
48 RawMachineAssembler(Graph* graph, | 48 RawMachineAssembler(Graph* graph, MachineSignature* machine_sig, |
49 MachineCallDescriptorBuilder* call_descriptor_builder, | |
50 MachineType word = kMachPtr); | 49 MachineType word = kMachPtr); |
51 virtual ~RawMachineAssembler() {} | 50 virtual ~RawMachineAssembler() {} |
52 | 51 |
53 Isolate* isolate() const { return zone()->isolate(); } | 52 Isolate* isolate() const { return zone()->isolate(); } |
54 Zone* zone() const { return graph()->zone(); } | 53 Zone* zone() const { return graph()->zone(); } |
55 MachineOperatorBuilder* machine() { return &machine_; } | 54 MachineOperatorBuilder* machine() { return &machine_; } |
56 CommonOperatorBuilder* common() { return &common_; } | 55 CommonOperatorBuilder* common() { return &common_; } |
57 CallDescriptor* call_descriptor() const { | 56 CallDescriptor* call_descriptor() const { return call_descriptor_; } |
58 return call_descriptor_builder_->BuildCallDescriptor(zone()); | 57 int parameter_count() { return machine_sig_->ParamCount(); } |
Benedikt Meurer
2014/09/02 08:37:42
Nit: size_t + const
titzer
2014/09/02 12:13:53
Done.
| |
59 } | 58 MachineSignature* machine_sig() const { return machine_sig_; } |
60 int parameter_count() const { | |
61 return call_descriptor_builder_->parameter_count(); | |
62 } | |
63 const MachineType* parameter_types() const { | |
64 return call_descriptor_builder_->parameter_types(); | |
65 } | |
66 | 59 |
67 // Parameters. | 60 // Parameters. |
68 Node* Parameter(int index); | 61 Node* Parameter(int index); |
69 | 62 |
70 // Control flow. | 63 // Control flow. |
71 Label* Exit(); | 64 Label* Exit(); |
72 void Goto(Label* label); | 65 void Goto(Label* label); |
73 void Branch(Node* condition, Label* true_val, Label* false_val); | 66 void Branch(Node* condition, Label* true_val, Label* false_val); |
74 // Call through CallFunctionStub with lazy deopt and frame-state. | 67 // Call through CallFunctionStub with lazy deopt and frame-state. |
75 Node* CallFunctionStub0(Node* function, Node* receiver, Node* context, | 68 Node* CallFunctionStub0(Node* function, Node* receiver, Node* context, |
76 Node* frame_state, CallFunctionFlags flags); | 69 Node* frame_state, CallFunctionFlags flags); |
77 // Call to a JS function with zero parameters. | 70 // Call to a JS function with zero parameters. |
78 Node* CallJS0(Node* function, Node* receiver, Node* frame_state); | 71 Node* CallJS0(Node* function, Node* receiver, Node* context, |
72 Node* frame_state); | |
79 // Call to a runtime function with zero parameters. | 73 // Call to a runtime function with zero parameters. |
80 Node* CallRuntime1(Runtime::FunctionId function, Node* arg0, | 74 Node* CallRuntime1(Runtime::FunctionId function, Node* arg0, Node* context, |
81 Node* frame_state); | 75 Node* frame_state); |
82 void Return(Node* value); | 76 void Return(Node* value); |
83 void Bind(Label* label); | 77 void Bind(Label* label); |
84 void Deoptimize(Node* state); | 78 void Deoptimize(Node* state); |
85 | 79 |
86 // Variables. | 80 // Variables. |
87 Node* Phi(Node* n1, Node* n2) { return NewNode(common()->Phi(2), n1, n2); } | 81 Node* Phi(Node* n1, Node* n2) { return NewNode(common()->Phi(2), n1, n2); } |
88 Node* Phi(Node* n1, Node* n2, Node* n3) { | 82 Node* Phi(Node* n1, Node* n2, Node* n3) { |
89 return NewNode(common()->Phi(3), n1, n2, n3); | 83 return NewNode(common()->Phi(3), n1, n2, n3); |
90 } | 84 } |
(...skipping 15 matching lines...) Expand all Loading... | |
106 private: | 100 private: |
107 bool ScheduleValid() { return schedule_ != NULL; } | 101 bool ScheduleValid() { return schedule_ != NULL; } |
108 | 102 |
109 BasicBlock* Use(Label* label); | 103 BasicBlock* Use(Label* label); |
110 BasicBlock* EnsureBlock(Label* label); | 104 BasicBlock* EnsureBlock(Label* label); |
111 BasicBlock* CurrentBlock(); | 105 BasicBlock* CurrentBlock(); |
112 | 106 |
113 Schedule* schedule_; | 107 Schedule* schedule_; |
114 MachineOperatorBuilder machine_; | 108 MachineOperatorBuilder machine_; |
115 CommonOperatorBuilder common_; | 109 CommonOperatorBuilder common_; |
116 MachineCallDescriptorBuilder* call_descriptor_builder_; | 110 MachineSignature* machine_sig_; |
111 CallDescriptor* call_descriptor_; | |
117 Node** parameters_; | 112 Node** parameters_; |
118 Label exit_label_; | 113 Label exit_label_; |
119 BasicBlock* current_block_; | 114 BasicBlock* current_block_; |
120 | 115 |
121 DISALLOW_COPY_AND_ASSIGN(RawMachineAssembler); | 116 DISALLOW_COPY_AND_ASSIGN(RawMachineAssembler); |
122 }; | 117 }; |
123 | 118 |
124 } // namespace compiler | 119 } // namespace compiler |
125 } // namespace internal | 120 } // namespace internal |
126 } // namespace v8 | 121 } // namespace v8 |
127 | 122 |
128 #endif // V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_ | 123 #endif // V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_ |
OLD | NEW |