| 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/pipeline.h" | 5 #include "src/compiler/pipeline.h" |
| 6 #include "src/compiler/raw-machine-assembler.h" | 6 #include "src/compiler/raw-machine-assembler.h" |
| 7 #include "src/compiler/scheduler.h" | 7 #include "src/compiler/scheduler.h" |
| 8 | 8 |
| 9 namespace v8 { | 9 namespace v8 { |
| 10 namespace internal { | 10 namespace internal { |
| 11 namespace compiler { | 11 namespace compiler { |
| 12 | 12 |
| 13 RawMachineAssembler::RawMachineAssembler( | 13 RawMachineAssembler::RawMachineAssembler( |
| 14 Graph* graph, MachineCallDescriptorBuilder* call_descriptor_builder, | 14 Graph* graph, MachineCallDescriptorBuilder* call_descriptor_builder, |
| 15 MachineRepresentation word) | 15 MachineRepresentation word) |
| 16 : GraphBuilder(graph), | 16 : GraphBuilder(graph), |
| 17 schedule_(new (zone()) Schedule(zone())), | 17 schedule_(new (zone()) Schedule(zone())), |
| 18 machine_(zone(), word), | 18 machine_(zone(), word), |
| 19 common_(zone()), | 19 common_(zone()), |
| 20 call_descriptor_builder_(call_descriptor_builder), | 20 call_descriptor_builder_(call_descriptor_builder), |
| 21 parameters_(NULL), | 21 parameters_(NULL), |
| 22 exit_label_(schedule()->exit()), | 22 exit_label_(schedule()->exit()), |
| 23 current_block_(schedule()->entry()) { | 23 current_block_(schedule()->entry()) { |
| 24 Node* s = graph->NewNode(common_.Start(parameter_count())); |
| 25 graph->SetStart(s); |
| 24 if (parameter_count() == 0) return; | 26 if (parameter_count() == 0) return; |
| 25 parameters_ = zone()->NewArray<Node*>(parameter_count()); | 27 parameters_ = zone()->NewArray<Node*>(parameter_count()); |
| 26 for (int i = 0; i < parameter_count(); ++i) { | 28 for (int i = 0; i < parameter_count(); ++i) { |
| 27 parameters_[i] = NewNode(common()->Parameter(i)); | 29 parameters_[i] = NewNode(common()->Parameter(i), graph->start()); |
| 28 } | 30 } |
| 29 } | 31 } |
| 30 | 32 |
| 31 | 33 |
| 32 Schedule* RawMachineAssembler::Export() { | 34 Schedule* RawMachineAssembler::Export() { |
| 33 // Compute the correct codegen order. | 35 // Compute the correct codegen order. |
| 34 DCHECK(schedule_->rpo_order()->empty()); | 36 DCHECK(schedule_->rpo_order()->empty()); |
| 35 Scheduler scheduler(zone(), graph(), schedule_); | 37 Scheduler scheduler(zone(), graph(), schedule_); |
| 36 scheduler.ComputeSpecialRPO(); | 38 scheduler.ComputeSpecialRPO(); |
| 37 // Invalidate MachineAssembler. | 39 // Invalidate MachineAssembler. |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 Node* node = graph()->NewNode(op, input_count, inputs); | 150 Node* node = graph()->NewNode(op, input_count, inputs); |
| 149 BasicBlock* block = op->opcode() == IrOpcode::kParameter ? schedule()->start() | 151 BasicBlock* block = op->opcode() == IrOpcode::kParameter ? schedule()->start() |
| 150 : CurrentBlock(); | 152 : CurrentBlock(); |
| 151 schedule()->AddNode(block, node); | 153 schedule()->AddNode(block, node); |
| 152 return node; | 154 return node; |
| 153 } | 155 } |
| 154 | 156 |
| 155 } // namespace compiler | 157 } // namespace compiler |
| 156 } // namespace internal | 158 } // namespace internal |
| 157 } // namespace v8 | 159 } // namespace v8 |
| OLD | NEW |