| 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/compiler/node-properties.h" | 7 #include "src/compiler/node-properties.h" |
| 8 #include "src/compiler/pipeline.h" | 8 #include "src/compiler/pipeline.h" |
| 9 #include "src/compiler/scheduler.h" | 9 #include "src/compiler/scheduler.h" |
| 10 #include "src/objects-inl.h" | 10 #include "src/objects-inl.h" |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 schedule()->AddReturn(CurrentBlock(), ret); | 163 schedule()->AddReturn(CurrentBlock(), ret); |
| 164 current_block_ = nullptr; | 164 current_block_ = nullptr; |
| 165 } | 165 } |
| 166 | 166 |
| 167 void RawMachineAssembler::DebugBreak() { AddNode(machine()->DebugBreak()); } | 167 void RawMachineAssembler::DebugBreak() { AddNode(machine()->DebugBreak()); } |
| 168 | 168 |
| 169 void RawMachineAssembler::Comment(const char* msg) { | 169 void RawMachineAssembler::Comment(const char* msg) { |
| 170 AddNode(machine()->Comment(msg)); | 170 AddNode(machine()->Comment(msg)); |
| 171 } | 171 } |
| 172 | 172 |
| 173 Node* RawMachineAssembler::CallN(CallDescriptor* desc, Node* function, | |
| 174 Node** args) { | |
| 175 int param_count = static_cast<int>(desc->ParameterCount()); | |
| 176 int input_count = param_count + 1; | |
| 177 Node** buffer = zone()->NewArray<Node*>(input_count); | |
| 178 int index = 0; | |
| 179 buffer[index++] = function; | |
| 180 for (int i = 0; i < param_count; i++) { | |
| 181 buffer[index++] = args[i]; | |
| 182 } | |
| 183 return AddNode(common()->Call(desc), input_count, buffer); | |
| 184 } | |
| 185 | |
| 186 Node* RawMachineAssembler::CallN(CallDescriptor* desc, int input_count, | 173 Node* RawMachineAssembler::CallN(CallDescriptor* desc, int input_count, |
| 187 Node* const* nodes) { | 174 Node* const* inputs) { |
| 175 DCHECK(!desc->NeedsFrameState()); |
| 188 // +1 is for target. | 176 // +1 is for target. |
| 189 DCHECK_EQ(input_count, desc->ParameterCount() + 1); | 177 DCHECK_EQ(input_count, desc->ParameterCount() + 1); |
| 190 return AddNode(common()->Call(desc), input_count, nodes); | 178 return AddNode(common()->Call(desc), input_count, inputs); |
| 191 } | 179 } |
| 192 | 180 |
| 193 Node* RawMachineAssembler::CallNWithFrameState(CallDescriptor* desc, | 181 Node* RawMachineAssembler::CallNWithFrameState(CallDescriptor* desc, |
| 194 Node* function, Node** args, | 182 int input_count, |
| 195 Node* frame_state) { | 183 Node* const* inputs) { |
| 196 DCHECK(desc->NeedsFrameState()); | 184 DCHECK(desc->NeedsFrameState()); |
| 197 int param_count = static_cast<int>(desc->ParameterCount()); | 185 // +2 is for target and frame state. |
| 198 int input_count = param_count + 2; | 186 DCHECK_EQ(input_count, desc->ParameterCount() + 2); |
| 199 Node** buffer = zone()->NewArray<Node*>(input_count); | 187 return AddNode(common()->Call(desc), input_count, inputs); |
| 200 int index = 0; | |
| 201 buffer[index++] = function; | |
| 202 for (int i = 0; i < param_count; i++) { | |
| 203 buffer[index++] = args[i]; | |
| 204 } | |
| 205 buffer[index++] = frame_state; | |
| 206 return AddNode(common()->Call(desc), input_count, buffer); | |
| 207 } | 188 } |
| 208 | 189 |
| 209 Node* RawMachineAssembler::TailCallN(CallDescriptor* desc, int input_count, | 190 Node* RawMachineAssembler::TailCallN(CallDescriptor* desc, int input_count, |
| 210 Node* const* inputs) { | 191 Node* const* inputs) { |
| 211 // +1 is for target. | 192 // +1 is for target. |
| 212 DCHECK_EQ(input_count, desc->ParameterCount() + 1); | 193 DCHECK_EQ(input_count, desc->ParameterCount() + 1); |
| 213 Node* tail_call = MakeNode(common()->TailCall(desc), input_count, inputs); | 194 Node* tail_call = MakeNode(common()->TailCall(desc), input_count, inputs); |
| 214 schedule()->AddTailCall(CurrentBlock(), tail_call); | 195 schedule()->AddTailCall(CurrentBlock(), tail_call); |
| 215 current_block_ = nullptr; | 196 current_block_ = nullptr; |
| 216 return tail_call; | 197 return tail_call; |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 // The raw machine assembler nodes do not have effect and control inputs, | 330 // The raw machine assembler nodes do not have effect and control inputs, |
| 350 // so we disable checking input counts here. | 331 // so we disable checking input counts here. |
| 351 return graph()->NewNodeUnchecked(op, input_count, inputs); | 332 return graph()->NewNodeUnchecked(op, input_count, inputs); |
| 352 } | 333 } |
| 353 | 334 |
| 354 RawMachineLabel::~RawMachineLabel() { DCHECK(bound_ || !used_); } | 335 RawMachineLabel::~RawMachineLabel() { DCHECK(bound_ || !used_); } |
| 355 | 336 |
| 356 } // namespace compiler | 337 } // namespace compiler |
| 357 } // namespace internal | 338 } // namespace internal |
| 358 } // namespace v8 | 339 } // namespace v8 |
| OLD | NEW |