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/v8.h" | 5 #include "src/v8.h" |
6 #include "test/cctest/cctest.h" | 6 #include "test/cctest/cctest.h" |
7 | 7 |
8 #include "src/compiler/common-operator.h" | 8 #include "src/compiler/common-operator.h" |
9 #include "src/compiler/graph-inl.h" | 9 #include "src/compiler/graph-inl.h" |
10 #include "src/compiler/phi-reducer.h" | 10 #include "src/compiler/phi-reducer.h" |
(...skipping 35 matching lines...) Loading... |
46 | 46 |
47 Node* Float64Constant(double val) { | 47 Node* Float64Constant(double val) { |
48 return graph.NewNode(common.Float64Constant(val)); | 48 return graph.NewNode(common.Float64Constant(val)); |
49 } | 49 } |
50 | 50 |
51 Node* Parameter(int32_t index = 0) { | 51 Node* Parameter(int32_t index = 0) { |
52 return graph.NewNode(common.Parameter(index), graph.start()); | 52 return graph.NewNode(common.Parameter(index), graph.start()); |
53 } | 53 } |
54 | 54 |
55 Node* Phi(Node* a) { | 55 Node* Phi(Node* a) { |
56 return SetSelfReferences(graph.NewNode(common.Phi(1), a)); | 56 return SetSelfReferences(graph.NewNode(common.Phi(kMachAnyTagged, 1), a)); |
57 } | 57 } |
58 | 58 |
59 Node* Phi(Node* a, Node* b) { | 59 Node* Phi(Node* a, Node* b) { |
60 return SetSelfReferences(graph.NewNode(common.Phi(2), a, b)); | 60 return SetSelfReferences( |
| 61 graph.NewNode(common.Phi(kMachAnyTagged, 2), a, b)); |
61 } | 62 } |
62 | 63 |
63 Node* Phi(Node* a, Node* b, Node* c) { | 64 Node* Phi(Node* a, Node* b, Node* c) { |
64 return SetSelfReferences(graph.NewNode(common.Phi(3), a, b, c)); | 65 return SetSelfReferences( |
| 66 graph.NewNode(common.Phi(kMachAnyTagged, 3), a, b, c)); |
65 } | 67 } |
66 | 68 |
67 Node* Phi(Node* a, Node* b, Node* c, Node* d) { | 69 Node* Phi(Node* a, Node* b, Node* c, Node* d) { |
68 return SetSelfReferences(graph.NewNode(common.Phi(4), a, b, c, d)); | 70 return SetSelfReferences( |
| 71 graph.NewNode(common.Phi(kMachAnyTagged, 4), a, b, c, d)); |
69 } | 72 } |
70 | 73 |
71 Node* PhiWithControl(Node* a, Node* control) { | 74 Node* PhiWithControl(Node* a, Node* control) { |
72 return SetSelfReferences(graph.NewNode(common.Phi(1), a, control)); | 75 return SetSelfReferences( |
| 76 graph.NewNode(common.Phi(kMachAnyTagged, 1), a, control)); |
73 } | 77 } |
74 | 78 |
75 Node* PhiWithControl(Node* a, Node* b, Node* control) { | 79 Node* PhiWithControl(Node* a, Node* b, Node* control) { |
76 return SetSelfReferences(graph.NewNode(common.Phi(2), a, b, control)); | 80 return SetSelfReferences( |
| 81 graph.NewNode(common.Phi(kMachAnyTagged, 2), a, b, control)); |
77 } | 82 } |
78 | 83 |
79 Node* SetSelfReferences(Node* node) { | 84 Node* SetSelfReferences(Node* node) { |
80 Node::Inputs inputs = node->inputs(); | 85 Node::Inputs inputs = node->inputs(); |
81 for (Node::Inputs::iterator iter(inputs.begin()); iter != inputs.end(); | 86 for (Node::Inputs::iterator iter(inputs.begin()); iter != inputs.end(); |
82 ++iter) { | 87 ++iter) { |
83 Node* input = *iter; | 88 Node* input = *iter; |
84 if (input == self) node->ReplaceInput(iter.index(), node); | 89 if (input == self) node->ReplaceInput(iter.index(), node); |
85 } | 90 } |
86 return node; | 91 return node; |
(...skipping 129 matching lines...) Loading... |
216 Node* oneish = R.Float64Constant(1.1); | 221 Node* oneish = R.Float64Constant(1.1); |
217 Node* param = R.Parameter(); | 222 Node* param = R.Parameter(); |
218 | 223 |
219 Node* singles[] = {zero, one, oneish, param}; | 224 Node* singles[] = {zero, one, oneish, param}; |
220 for (size_t i = 0; i < arraysize(singles); ++i) { | 225 for (size_t i = 0; i < arraysize(singles); ++i) { |
221 R.CheckReduce(singles[i], R.PhiWithControl(singles[i], R.dead)); | 226 R.CheckReduce(singles[i], R.PhiWithControl(singles[i], R.dead)); |
222 R.CheckReduce(singles[i], R.PhiWithControl(R.self, singles[i], R.dead)); | 227 R.CheckReduce(singles[i], R.PhiWithControl(R.self, singles[i], R.dead)); |
223 R.CheckReduce(singles[i], R.PhiWithControl(singles[i], R.self, R.dead)); | 228 R.CheckReduce(singles[i], R.PhiWithControl(singles[i], R.self, R.dead)); |
224 } | 229 } |
225 } | 230 } |
OLD | NEW |