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_(nullptr), |
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 Node* s = graph->NewNode(common_.Start(param_count)); | 28 // Add an extra input node for the JSFunction parameter to the start node. |
| 29 Node* s = graph->NewNode(common_.Start(param_count + 1)); |
29 graph->SetStart(s); | 30 graph->SetStart(s); |
30 if (parameter_count() == 0) return; | 31 if (parameter_count() == 0) return; |
31 parameters_ = zone()->NewArray<Node*>(param_count); | 32 parameters_ = zone()->NewArray<Node*>(param_count); |
32 for (size_t i = 0; i < parameter_count(); ++i) { | 33 for (size_t i = 0; i < parameter_count(); ++i) { |
33 parameters_[i] = | 34 parameters_[i] = |
34 NewNode(common()->Parameter(static_cast<int>(i)), graph->start()); | 35 NewNode(common()->Parameter(static_cast<int>(i)), graph->start()); |
35 } | 36 } |
36 } | 37 } |
37 | 38 |
38 | 39 |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 DCHECK_NOT_NULL(schedule_); | 292 DCHECK_NOT_NULL(schedule_); |
292 DCHECK(current_block_ != nullptr); | 293 DCHECK(current_block_ != nullptr); |
293 Node* node = graph()->NewNode(op, input_count, inputs); | 294 Node* node = graph()->NewNode(op, input_count, inputs); |
294 schedule()->AddNode(CurrentBlock(), node); | 295 schedule()->AddNode(CurrentBlock(), node); |
295 return node; | 296 return node; |
296 } | 297 } |
297 | 298 |
298 } // namespace compiler | 299 } // namespace compiler |
299 } // namespace internal | 300 } // namespace internal |
300 } // namespace v8 | 301 } // namespace v8 |
OLD | NEW |