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 |
11 namespace v8 { | 11 namespace v8 { |
12 namespace internal { | 12 namespace internal { |
13 namespace compiler { | 13 namespace compiler { |
14 | 14 |
15 RawMachineAssembler::RawMachineAssembler(Isolate* isolate, Graph* graph, | 15 RawMachineAssembler::RawMachineAssembler(Isolate* isolate, Graph* graph, |
16 CallDescriptor* call_descriptor, | 16 CallDescriptor* call_descriptor, |
17 MachineType word, | 17 MachineType word, |
18 MachineOperatorBuilder::Flags flags) | 18 MachineOperatorBuilder::Flags flags) |
19 : isolate_(isolate), | 19 : isolate_(isolate), |
20 graph_(graph), | 20 graph_(graph), |
21 schedule_(new (zone()) Schedule(zone())), | 21 schedule_(new (zone()) Schedule(zone())), |
22 machine_(zone(), word, flags), | 22 machine_(zone(), word, flags), |
23 common_(zone()), | 23 common_(zone()), |
24 call_descriptor_(call_descriptor), | 24 call_descriptor_(call_descriptor), |
25 parameters_(nullptr), | 25 parameters_(parameter_count(), zone()), |
26 current_block_(schedule()->start()) { | 26 current_block_(schedule()->start()) { |
27 int param_count = static_cast<int>(parameter_count()); | 27 int param_count = static_cast<int>(parameter_count()); |
28 // Add an extra input node for the JSFunction parameter to the start node. | 28 // Add an extra input for the JSFunction parameter to the start node. |
29 Node* s = graph->NewNode(common_.Start(param_count + 1)); | 29 graph->SetStart(graph->NewNode(common_.Start(param_count + 1))); |
30 graph->SetStart(s); | |
31 if (parameter_count() == 0) return; | |
32 parameters_ = zone()->NewArray<Node*>(param_count); | |
33 for (size_t i = 0; i < parameter_count(); ++i) { | 30 for (size_t i = 0; i < parameter_count(); ++i) { |
34 parameters_[i] = | 31 parameters_[i] = |
35 AddNode(common()->Parameter(static_cast<int>(i)), graph->start()); | 32 AddNode(common()->Parameter(static_cast<int>(i)), graph->start()); |
36 } | 33 } |
37 } | 34 } |
38 | 35 |
39 | 36 |
40 Schedule* RawMachineAssembler::Export() { | 37 Schedule* RawMachineAssembler::Export() { |
41 // Compute the correct codegen order. | 38 // Compute the correct codegen order. |
42 DCHECK(schedule_->rpo_order()->empty()); | 39 DCHECK(schedule_->rpo_order()->empty()); |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 Node* RawMachineAssembler::MakeNode(const Operator* op, int input_count, | 331 Node* RawMachineAssembler::MakeNode(const Operator* op, int input_count, |
335 Node** inputs) { | 332 Node** inputs) { |
336 // The raw machine assembler nodes do not have effect and control inputs, | 333 // The raw machine assembler nodes do not have effect and control inputs, |
337 // so we disable checking input counts here. | 334 // so we disable checking input counts here. |
338 return graph()->NewNodeUnchecked(op, input_count, inputs); | 335 return graph()->NewNodeUnchecked(op, input_count, inputs); |
339 } | 336 } |
340 | 337 |
341 } // namespace compiler | 338 } // namespace compiler |
342 } // namespace internal | 339 } // namespace internal |
343 } // namespace v8 | 340 } // namespace v8 |
OLD | NEW |