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/pipeline.h" | 8 #include "src/compiler/pipeline.h" |
9 #include "src/compiler/scheduler.h" | 9 #include "src/compiler/scheduler.h" |
10 | 10 |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 } | 155 } |
156 buffer[index++] = graph()->start(); | 156 buffer[index++] = graph()->start(); |
157 buffer[index++] = graph()->start(); | 157 buffer[index++] = graph()->start(); |
158 Node* tail_call = | 158 Node* tail_call = |
159 graph()->NewNode(common()->TailCall(desc), input_count, buffer); | 159 graph()->NewNode(common()->TailCall(desc), input_count, buffer); |
160 schedule()->AddTailCall(CurrentBlock(), tail_call); | 160 schedule()->AddTailCall(CurrentBlock(), tail_call); |
161 return tail_call; | 161 return tail_call; |
162 } | 162 } |
163 | 163 |
164 | 164 |
| 165 Node* RawMachineAssembler::CallVarArgs(CallDescriptor* desc, Node* function, |
| 166 Node** fixed_args, Node* first_var_arg, |
| 167 Node* last_var_arg) { |
| 168 DCHECK(desc->HasVarArgs()); |
| 169 int fixed_param_count = |
| 170 static_cast<int>(desc->GetMachineSignature()->parameter_count()); |
| 171 int input_count = fixed_param_count + 5; |
| 172 Node** buffer = zone()->NewArray<Node*>(input_count); |
| 173 int index = 0; |
| 174 buffer[index++] = function; |
| 175 for (int i = 0; i < fixed_param_count; i++) { |
| 176 buffer[index++] = fixed_args[i]; |
| 177 } |
| 178 buffer[index++] = first_var_arg; |
| 179 buffer[index++] = last_var_arg; |
| 180 buffer[index++] = graph()->start(); |
| 181 buffer[index++] = graph()->start(); |
| 182 Node* call = |
| 183 graph()->NewNode(common()->CallVarArgs(desc), input_count, buffer); |
| 184 schedule()->AddNode(CurrentBlock(), call); |
| 185 return call; |
| 186 } |
| 187 |
| 188 |
165 Node* RawMachineAssembler::CallFunctionStub0(Node* function, Node* receiver, | 189 Node* RawMachineAssembler::CallFunctionStub0(Node* function, Node* receiver, |
166 Node* context, Node* frame_state, | 190 Node* context, Node* frame_state, |
167 CallFunctionFlags flags) { | 191 CallFunctionFlags flags) { |
168 Callable callable = CodeFactory::CallFunction(isolate(), 0, flags); | 192 Callable callable = CodeFactory::CallFunction(isolate(), 0, flags); |
169 CallDescriptor* desc = Linkage::GetStubCallDescriptor( | 193 CallDescriptor* desc = Linkage::GetStubCallDescriptor( |
170 isolate(), zone(), callable.descriptor(), 1, | 194 isolate(), zone(), callable.descriptor(), 1, |
171 CallDescriptor::kNeedsFrameState, Operator::kNoProperties); | 195 CallDescriptor::kNeedsFrameState, Operator::kNoProperties); |
172 Node* stub_code = HeapConstant(callable.code()); | 196 Node* stub_code = HeapConstant(callable.code()); |
173 Node* call = graph()->NewNode(common()->Call(desc), stub_code, function, | 197 Node* call = graph()->NewNode(common()->Call(desc), stub_code, function, |
174 receiver, context, frame_state, | 198 receiver, context, frame_state, |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 DCHECK_NOT_NULL(schedule_); | 336 DCHECK_NOT_NULL(schedule_); |
313 DCHECK(current_block_ != nullptr); | 337 DCHECK(current_block_ != nullptr); |
314 Node* node = graph()->NewNode(op, input_count, inputs); | 338 Node* node = graph()->NewNode(op, input_count, inputs); |
315 schedule()->AddNode(CurrentBlock(), node); | 339 schedule()->AddNode(CurrentBlock(), node); |
316 return node; | 340 return node; |
317 } | 341 } |
318 | 342 |
319 } // namespace compiler | 343 } // namespace compiler |
320 } // namespace internal | 344 } // namespace internal |
321 } // namespace v8 | 345 } // namespace v8 |
OLD | NEW |