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