| 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/code-factory.h" | 5 #include "src/code-factory.h" |
| 6 #include "src/compiler/pipeline.h" | 6 #include "src/compiler/pipeline.h" |
| 7 #include "src/compiler/raw-machine-assembler.h" | 7 #include "src/compiler/raw-machine-assembler.h" |
| 8 #include "src/compiler/scheduler.h" | 8 #include "src/compiler/scheduler.h" |
| 9 | 9 |
| 10 namespace v8 { | 10 namespace v8 { |
| 11 namespace internal { | 11 namespace internal { |
| 12 namespace compiler { | 12 namespace compiler { |
| 13 | 13 |
| 14 RawMachineAssembler::RawMachineAssembler(Isolate* isolate, Graph* graph, | 14 RawMachineAssembler::RawMachineAssembler(Isolate* isolate, Graph* graph, |
| 15 const MachineSignature* machine_sig, | 15 const MachineSignature* machine_sig, |
| 16 MachineType word, | 16 MachineType word, |
| 17 MachineOperatorBuilder::Flags flags) | 17 MachineOperatorBuilder::Flags flags) |
| 18 : GraphBuilder(isolate, graph), | 18 : GraphBuilder(isolate, graph), |
| 19 schedule_(new (zone()) Schedule(zone())), | 19 schedule_(new (zone()) Schedule(zone())), |
| 20 machine_(zone(), word, flags), | 20 machine_(zone(), word, flags), |
| 21 common_(zone()), | 21 common_(zone()), |
| 22 machine_sig_(machine_sig), | 22 machine_sig_(machine_sig), |
| 23 call_descriptor_( | 23 call_descriptor_( |
| 24 Linkage::GetSimplifiedCDescriptor(graph->zone(), machine_sig)), | 24 Linkage::GetSimplifiedCDescriptor(graph->zone(), machine_sig)), |
| 25 parameters_(NULL), | 25 parameters_(NULL), |
| 26 exit_label_(schedule()->end()), | |
| 27 current_block_(schedule()->start()) { | 26 current_block_(schedule()->start()) { |
| 28 int param_count = static_cast<int>(parameter_count()); | 27 int param_count = static_cast<int>(parameter_count()); |
| 29 Node* s = graph->NewNode(common_.Start(param_count)); | 28 Node* s = graph->NewNode(common_.Start(param_count)); |
| 30 graph->SetStart(s); | 29 graph->SetStart(s); |
| 31 if (parameter_count() == 0) return; | 30 if (parameter_count() == 0) return; |
| 32 parameters_ = zone()->NewArray<Node*>(param_count); | 31 parameters_ = zone()->NewArray<Node*>(param_count); |
| 33 for (size_t i = 0; i < parameter_count(); ++i) { | 32 for (size_t i = 0; i < parameter_count(); ++i) { |
| 34 parameters_[i] = | 33 parameters_[i] = |
| 35 NewNode(common()->Parameter(static_cast<int>(i)), graph->start()); | 34 NewNode(common()->Parameter(static_cast<int>(i)), graph->start()); |
| 36 } | 35 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 47 return schedule; | 46 return schedule; |
| 48 } | 47 } |
| 49 | 48 |
| 50 | 49 |
| 51 Node* RawMachineAssembler::Parameter(size_t index) { | 50 Node* RawMachineAssembler::Parameter(size_t index) { |
| 52 DCHECK(index < parameter_count()); | 51 DCHECK(index < parameter_count()); |
| 53 return parameters_[index]; | 52 return parameters_[index]; |
| 54 } | 53 } |
| 55 | 54 |
| 56 | 55 |
| 57 RawMachineAssembler::Label* RawMachineAssembler::Exit() { | |
| 58 exit_label_.used_ = true; | |
| 59 return &exit_label_; | |
| 60 } | |
| 61 | |
| 62 | |
| 63 void RawMachineAssembler::Goto(Label* label) { | 56 void RawMachineAssembler::Goto(Label* label) { |
| 64 DCHECK(current_block_ != schedule()->end()); | 57 DCHECK(current_block_ != schedule()->end()); |
| 65 schedule()->AddGoto(CurrentBlock(), Use(label)); | 58 schedule()->AddGoto(CurrentBlock(), Use(label)); |
| 66 current_block_ = NULL; | 59 current_block_ = NULL; |
| 67 } | 60 } |
| 68 | 61 |
| 69 | 62 |
| 70 void RawMachineAssembler::Branch(Node* condition, Label* true_val, | 63 void RawMachineAssembler::Branch(Node* condition, Label* true_val, |
| 71 Label* false_val) { | 64 Label* false_val) { |
| 72 DCHECK(current_block_ != schedule()->end()); | 65 DCHECK(current_block_ != schedule()->end()); |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 : CurrentBlock(); | 179 : CurrentBlock(); |
| 187 if (op->opcode() != IrOpcode::kReturn) { | 180 if (op->opcode() != IrOpcode::kReturn) { |
| 188 schedule()->AddNode(block, node); | 181 schedule()->AddNode(block, node); |
| 189 } | 182 } |
| 190 return node; | 183 return node; |
| 191 } | 184 } |
| 192 | 185 |
| 193 } // namespace compiler | 186 } // namespace compiler |
| 194 } // namespace internal | 187 } // namespace internal |
| 195 } // namespace v8 | 188 } // namespace v8 |
| OLD | NEW |