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 #include "src/compiler/raw-machine-assembler.h" | 5 #include "src/compiler/raw-machine-assembler.h" |
6 | 6 |
7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/compiler/node-properties.h" | 8 #include "src/compiler/node-properties.h" |
9 #include "src/compiler/pipeline.h" | 9 #include "src/compiler/pipeline.h" |
10 #include "src/compiler/scheduler.h" | 10 #include "src/compiler/scheduler.h" |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 BasicBlock* default_block = schedule()->NewBasicBlock(); | 113 BasicBlock* default_block = schedule()->NewBasicBlock(); |
114 Node* default_node = graph()->NewNode(common()->IfDefault(), switch_node); | 114 Node* default_node = graph()->NewNode(common()->IfDefault(), switch_node); |
115 schedule()->AddNode(default_block, default_node); | 115 schedule()->AddNode(default_block, default_node); |
116 schedule()->AddGoto(default_block, Use(default_label)); | 116 schedule()->AddGoto(default_block, Use(default_label)); |
117 succ_blocks[case_count] = default_block; | 117 succ_blocks[case_count] = default_block; |
118 schedule()->AddSwitch(CurrentBlock(), switch_node, succ_blocks, succ_count); | 118 schedule()->AddSwitch(CurrentBlock(), switch_node, succ_blocks, succ_count); |
119 current_block_ = nullptr; | 119 current_block_ = nullptr; |
120 } | 120 } |
121 | 121 |
122 void RawMachineAssembler::Return(Node* value) { | 122 void RawMachineAssembler::Return(Node* value) { |
123 Node* values[] = {Int32Constant(0), value}; | 123 Node* ret = MakeNode(common()->Return(), 1, &value); |
124 Node* ret = MakeNode(common()->Return(1), 2, values); | |
125 schedule()->AddReturn(CurrentBlock(), ret); | 124 schedule()->AddReturn(CurrentBlock(), ret); |
126 current_block_ = nullptr; | 125 current_block_ = nullptr; |
127 } | 126 } |
128 | 127 |
129 | 128 |
130 void RawMachineAssembler::Return(Node* v1, Node* v2) { | 129 void RawMachineAssembler::Return(Node* v1, Node* v2) { |
131 Node* values[] = {Int32Constant(0), v1, v2}; | 130 Node* values[] = {v1, v2}; |
132 Node* ret = MakeNode(common()->Return(2), 3, values); | 131 Node* ret = MakeNode(common()->Return(2), 2, values); |
133 schedule()->AddReturn(CurrentBlock(), ret); | 132 schedule()->AddReturn(CurrentBlock(), ret); |
134 current_block_ = nullptr; | 133 current_block_ = nullptr; |
135 } | 134 } |
136 | 135 |
137 | 136 |
138 void RawMachineAssembler::Return(Node* v1, Node* v2, Node* v3) { | 137 void RawMachineAssembler::Return(Node* v1, Node* v2, Node* v3) { |
139 Node* values[] = {Int32Constant(0), v1, v2, v3}; | 138 Node* values[] = {v1, v2, v3}; |
140 Node* ret = MakeNode(common()->Return(3), 4, values); | 139 Node* ret = MakeNode(common()->Return(3), 3, values); |
141 schedule()->AddReturn(CurrentBlock(), ret); | 140 schedule()->AddReturn(CurrentBlock(), ret); |
142 current_block_ = nullptr; | 141 current_block_ = nullptr; |
143 } | 142 } |
144 | |
145 void RawMachineAssembler::PopAndReturn(Node* pop, Node* value) { | |
146 Node* values[] = {pop, value}; | |
147 Node* ret = MakeNode(common()->Return(1), 2, values); | |
148 schedule()->AddReturn(CurrentBlock(), ret); | |
149 current_block_ = nullptr; | |
150 } | |
151 | |
152 void RawMachineAssembler::PopAndReturn(Node* pop, Node* v1, Node* v2) { | |
153 Node* values[] = {pop, v1, v2}; | |
154 Node* ret = MakeNode(common()->Return(2), 3, values); | |
155 schedule()->AddReturn(CurrentBlock(), ret); | |
156 current_block_ = nullptr; | |
157 } | |
158 | |
159 void RawMachineAssembler::PopAndReturn(Node* pop, Node* v1, Node* v2, | |
160 Node* v3) { | |
161 Node* values[] = {pop, v1, v2, v3}; | |
162 Node* ret = MakeNode(common()->Return(3), 4, values); | |
163 schedule()->AddReturn(CurrentBlock(), ret); | |
164 current_block_ = nullptr; | |
165 } | |
166 | 143 |
167 void RawMachineAssembler::DebugBreak() { AddNode(machine()->DebugBreak()); } | 144 void RawMachineAssembler::DebugBreak() { AddNode(machine()->DebugBreak()); } |
168 | 145 |
169 void RawMachineAssembler::Comment(const char* msg) { | 146 void RawMachineAssembler::Comment(const char* msg) { |
170 AddNode(machine()->Comment(msg)); | 147 AddNode(machine()->Comment(msg)); |
171 } | 148 } |
172 | 149 |
173 Node* RawMachineAssembler::CallN(CallDescriptor* desc, Node* function, | 150 Node* RawMachineAssembler::CallN(CallDescriptor* desc, Node* function, |
174 Node** args) { | 151 Node** args) { |
175 int param_count = static_cast<int>(desc->ParameterCount()); | 152 int param_count = static_cast<int>(desc->ParameterCount()); |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
567 // The raw machine assembler nodes do not have effect and control inputs, | 544 // The raw machine assembler nodes do not have effect and control inputs, |
568 // so we disable checking input counts here. | 545 // so we disable checking input counts here. |
569 return graph()->NewNodeUnchecked(op, input_count, inputs); | 546 return graph()->NewNodeUnchecked(op, input_count, inputs); |
570 } | 547 } |
571 | 548 |
572 RawMachineLabel::~RawMachineLabel() { DCHECK(bound_ || !used_); } | 549 RawMachineLabel::~RawMachineLabel() { DCHECK(bound_ || !used_); } |
573 | 550 |
574 } // namespace compiler | 551 } // namespace compiler |
575 } // namespace internal | 552 } // namespace internal |
576 } // namespace v8 | 553 } // namespace v8 |
OLD | NEW |