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 "test/cctest/compiler/graph-builder-tester.h" | 5 #include "test/cctest/compiler/graph-builder-tester.h" |
6 #include "src/compiler/pipeline.h" | 6 #include "src/compiler/pipeline.h" |
7 | 7 |
8 namespace v8 { | 8 namespace v8 { |
9 namespace internal { | 9 namespace internal { |
10 namespace compiler { | 10 namespace compiler { |
11 | 11 |
12 MachineCallHelper::MachineCallHelper(Zone* zone, | 12 MachineCallHelper::MachineCallHelper(Zone* zone, |
13 MachineCallDescriptorBuilder* builder) | 13 MachineCallDescriptorBuilder* builder) |
14 : CallHelper(zone->isolate()), | 14 : CallHelper(zone->isolate()), |
15 call_descriptor_builder_(builder), | 15 call_descriptor_builder_(builder), |
16 parameters_(NULL), | 16 parameters_(NULL), |
17 graph_(NULL) {} | 17 graph_(NULL) {} |
18 | 18 |
19 | 19 |
20 void MachineCallHelper::InitParameters(GraphBuilder* builder, | 20 void MachineCallHelper::InitParameters(GraphBuilder* builder, |
21 CommonOperatorBuilder* common) { | 21 CommonOperatorBuilder* common) { |
22 DCHECK_EQ(NULL, parameters_); | 22 DCHECK_EQ(NULL, parameters_); |
23 graph_ = builder->graph(); | 23 graph_ = builder->graph(); |
24 if (parameter_count() == 0) return; | 24 if (parameter_count() == 0) return; |
25 parameters_ = builder->graph()->zone()->NewArray<Node*>(parameter_count()); | 25 parameters_ = graph_->zone()->NewArray<Node*>(parameter_count()); |
26 for (int i = 0; i < parameter_count(); ++i) { | 26 for (int i = 0; i < parameter_count(); ++i) { |
27 parameters_[i] = builder->NewNode(common->Parameter(i)); | 27 parameters_[i] = builder->NewNode(common->Parameter(i), graph_->start()); |
28 } | 28 } |
29 } | 29 } |
30 | 30 |
31 | 31 |
32 byte* MachineCallHelper::Generate() { | 32 byte* MachineCallHelper::Generate() { |
33 DCHECK(parameter_count() == 0 || parameters_ != NULL); | 33 DCHECK(parameter_count() == 0 || parameters_ != NULL); |
34 if (code_.is_null()) { | 34 if (code_.is_null()) { |
35 Zone* zone = graph_->zone(); | 35 Zone* zone = graph_->zone(); |
36 CompilationInfo info(zone->isolate(), zone); | 36 CompilationInfo info(zone->isolate(), zone); |
37 Linkage linkage(&info, call_descriptor_builder_->BuildCallDescriptor(zone)); | 37 Linkage linkage(&info, call_descriptor_builder_->BuildCallDescriptor(zone)); |
(...skipping 17 matching lines...) Expand all Loading... |
55 | 55 |
56 Node* MachineCallHelper::Parameter(int offset) { | 56 Node* MachineCallHelper::Parameter(int offset) { |
57 DCHECK_NE(NULL, parameters_); | 57 DCHECK_NE(NULL, parameters_); |
58 DCHECK(0 <= offset && offset < parameter_count()); | 58 DCHECK(0 <= offset && offset < parameter_count()); |
59 return parameters_[offset]; | 59 return parameters_[offset]; |
60 } | 60 } |
61 | 61 |
62 } // namespace compiler | 62 } // namespace compiler |
63 } // namespace internal | 63 } // namespace internal |
64 } // namespace v8 | 64 } // namespace v8 |
OLD | NEW |