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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 for (int i = 0; i < param_count; i++) { | 240 for (int i = 0; i < param_count; i++) { |
241 buffer[index++] = args[i]; | 241 buffer[index++] = args[i]; |
242 } | 242 } |
243 Node* tail_call = MakeNode(common()->TailCall(desc), input_count, buffer); | 243 Node* tail_call = MakeNode(common()->TailCall(desc), input_count, buffer); |
244 NodeProperties::MergeControlToEnd(graph(), common(), tail_call); | 244 NodeProperties::MergeControlToEnd(graph(), common(), tail_call); |
245 schedule()->AddTailCall(CurrentBlock(), tail_call); | 245 schedule()->AddTailCall(CurrentBlock(), tail_call); |
246 current_block_ = nullptr; | 246 current_block_ = nullptr; |
247 return tail_call; | 247 return tail_call; |
248 } | 248 } |
249 | 249 |
| 250 Node* RawMachineAssembler::TailCallRuntime0(Runtime::FunctionId function, |
| 251 Node* context) { |
| 252 const int kArity = 0; |
| 253 CallDescriptor* desc = Linkage::GetRuntimeCallDescriptor( |
| 254 zone(), function, kArity, Operator::kNoProperties, |
| 255 CallDescriptor::kSupportsTailCalls); |
| 256 int return_count = static_cast<int>(desc->ReturnCount()); |
| 257 |
| 258 Node* centry = HeapConstant(CEntryStub(isolate(), return_count).GetCode()); |
| 259 Node* ref = AddNode( |
| 260 common()->ExternalConstant(ExternalReference(function, isolate()))); |
| 261 Node* arity = Int32Constant(kArity); |
| 262 |
| 263 Node* nodes[] = {centry, ref, arity, context}; |
| 264 Node* tail_call = MakeNode(common()->TailCall(desc), arraysize(nodes), nodes); |
| 265 |
| 266 NodeProperties::MergeControlToEnd(graph(), common(), tail_call); |
| 267 schedule()->AddTailCall(CurrentBlock(), tail_call); |
| 268 current_block_ = nullptr; |
| 269 return tail_call; |
| 270 } |
250 | 271 |
251 Node* RawMachineAssembler::TailCallRuntime1(Runtime::FunctionId function, | 272 Node* RawMachineAssembler::TailCallRuntime1(Runtime::FunctionId function, |
252 Node* arg1, Node* context) { | 273 Node* arg1, Node* context) { |
253 const int kArity = 1; | 274 const int kArity = 1; |
254 CallDescriptor* desc = Linkage::GetRuntimeCallDescriptor( | 275 CallDescriptor* desc = Linkage::GetRuntimeCallDescriptor( |
255 zone(), function, kArity, Operator::kNoProperties, | 276 zone(), function, kArity, Operator::kNoProperties, |
256 CallDescriptor::kSupportsTailCalls); | 277 CallDescriptor::kSupportsTailCalls); |
257 int return_count = static_cast<int>(desc->ReturnCount()); | 278 int return_count = static_cast<int>(desc->ReturnCount()); |
258 | 279 |
259 Node* centry = HeapConstant(CEntryStub(isolate(), return_count).GetCode()); | 280 Node* centry = HeapConstant(CEntryStub(isolate(), return_count).GetCode()); |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 | 483 |
463 RawMachineLabel::RawMachineLabel() | 484 RawMachineLabel::RawMachineLabel() |
464 : block_(nullptr), used_(false), bound_(false) {} | 485 : block_(nullptr), used_(false), bound_(false) {} |
465 | 486 |
466 | 487 |
467 RawMachineLabel::~RawMachineLabel() { DCHECK(bound_ || !used_); } | 488 RawMachineLabel::~RawMachineLabel() { DCHECK(bound_ || !used_); } |
468 | 489 |
469 } // namespace compiler | 490 } // namespace compiler |
470 } // namespace internal | 491 } // namespace internal |
471 } // namespace v8 | 492 } // namespace v8 |
OLD | NEW |