Home | History | Annotate | Download | only in compiler

Lines Matching refs:node

24 Reduction EscapeAnalysisReducer::Reduce(Node* node) {
25 switch (node->opcode()) {
28 return ReduceLoad(node);
31 return ReduceStore(node);
33 return ReduceAllocate(node);
35 return ReduceFinishRegion(node);
37 return ReduceReferenceEqual(node);
39 return ReduceObjectIsSmi(node);
43 // whether a node might have a frame state input.
44 if (node->op()->EffectInputCount() > 0) {
45 return ReduceFrameStateUses(node);
53 Reduction EscapeAnalysisReducer::ReduceLoad(Node* node) {
54 DCHECK(node->opcode() == IrOpcode::kLoadField ||
55 node->opcode() == IrOpcode::kLoadElement);
56 if (visited_.Contains(node->id())) return NoChange();
57 visited_.Add(node->id());
58 if (Node* rep = escape_analysis()->GetReplacement(node)) {
59 visited_.Add(node->id());
62 PrintF("Replaced #%d (%s) with #%d (%s)\n", node->id(),
63 node->op()->mnemonic(), rep->id(), rep->op()->mnemonic());
65 ReplaceWithValue(node, rep);
72 Reduction EscapeAnalysisReducer::ReduceStore(Node* node) {
73 DCHECK(node->opcode() == IrOpcode::kStoreField ||
74 node->opcode() == IrOpcode::kStoreElement);
75 if (visited_.Contains(node->id())) return NoChange();
76 visited_.Add(node->id());
77 if (escape_analysis()->IsVirtual(NodeProperties::GetValueInput(node, 0))) {
79 PrintF("Removed #%d (%s) from effect chain\n", node->id(),
80 node->op()->mnemonic());
82 RelaxEffectsAndControls(node);
83 return Changed(node);
89 Reduction EscapeAnalysisReducer::ReduceAllocate(Node* node) {
90 DCHECK_EQ(node->opcode(), IrOpcode::kAllocate);
91 if (visited_.Contains(node->id())) return NoChange();
92 visited_.Add(node->id());
93 if (escape_analysis()->IsVirtual(node)) {
94 RelaxEffectsAndControls(node);
97 PrintF("Removed allocate #%d from effect chain\n", node->id());
99 return Changed(node);
105 Reduction EscapeAnalysisReducer::ReduceFinishRegion(Node* node) {
106 DCHECK_EQ(node->opcode(), IrOpcode::kFinishRegion);
107 Node* effect = NodeProperties::GetEffectInput(node, 0);
110 RelaxEffectsAndControls(node);
113 node->id());
114 PrintF(" %d user(s) of #%d remain(s):", node->UseCount(), node->id());
115 for (Edge edge : node->use_edges()) {
120 return Changed(node);
126 Reduction EscapeAnalysisReducer::ReduceReferenceEqual(Node* node) {
127 DCHECK_EQ(node->opcode(), IrOpcode::kReferenceEqual);
128 Node* left = NodeProperties::GetValueInput(node, 0);
129 Node* right = NodeProperties::GetValueInput(node, 1);
133 ReplaceWithValue(node, jsgraph()->TrueConstant());
135 PrintF("Replaced ref eq #%d with true\n", node->id());
139 ReplaceWithValue(node, jsgraph()->FalseConstant());
141 PrintF("Replaced ref eq #%d with false\n", node->id());
143 return Replace(node);
146 ReplaceWithValue(node, jsgraph()->FalseConstant());
148 PrintF("Replaced ref eq #%d with false\n", node->id());
155 Reduction EscapeAnalysisReducer::ReduceObjectIsSmi(Node* node) {
156 DCHECK_EQ(node->opcode(), IrOpcode::kObjectIsSmi);
157 Node* input = NodeProperties::GetValueInput(node, 0);
159 ReplaceWithValue(node, jsgraph()->FalseConstant());
161 PrintF("Replaced ObjectIsSmi #%d with false\n", node->id());
163 return Replace(node);
169 Reduction EscapeAnalysisReducer::ReduceFrameStateUses(Node* node) {
170 if (visited_.Contains(node->id())) return NoChange();
171 visited_.Add(node->id());
172 DCHECK_GE(node->op()->EffectInputCount(), 1);
174 for (int i = 0; i < node->InputCount(); ++i) {
175 Node* input = node->InputAt(i);
177 if (Node* ret = ReduceFrameState(input, node, false)) {
178 node->ReplaceInput(i, ret);
184 return Changed(node);
190 // Returns the clone if it duplicated the node, and null otherwise.
191 Node* EscapeAnalysisReducer::ReduceFrameState(Node* node, Node* effect,
193 DCHECK(node->opcode() == IrOpcode::kFrameState);
195 PrintF("Reducing FrameState %d\n", node->id());
197 Node* clone = nullptr;
198 for (int i = 0; i < node->op()->ValueInputCount(); ++i) {
199 Node* input = NodeProperties::GetValueInput(node, i);
200 Node* ret =
202 ? ReduceStateValueInputs(input, effect, node->UseCount() > 1)
203 : ReduceStateValueInput(node, i, effect, node->UseCount() > 1);
205 if (node->UseCount() > 1 || multiple_users) {
207 PrintF(" Cloning #%d", node->id());
209 node = clone = jsgraph()->graph()->CloneNode(node);
211 PrintF(" to #%d\n", node->id());
215 NodeProperties::ReplaceValueInput(node, ret, i);
218 Node* outer_frame_state = NodeProperties::GetFrameStateInput(node, 0);
220 if (Node* ret =
221 ReduceFrameState(outer_frame_state, effect, node->UseCount() > 1)) {
222 if (node->UseCount() > 1 || multiple_users) {
224 PrintF(" Cloning #%d", node->id());
226 node = clone = jsgraph()->graph()->CloneNode(node);
228 PrintF(" to #%d\n", node->id());
232 NodeProperties::ReplaceFrameStateInput(node, 0, ret);
239 // Returns the clone if it duplicated the node, and null otherwise.
240 Node* EscapeAnalysisReducer::ReduceStateValueInputs(Node* node, Node* effect,
243 PrintF("Reducing StateValue #%d\n", node->id());
245 DCHECK(node->opcode() == IrOpcode::kStateValues);
247 Node* clone = nullptr;
248 for (int i = 0; i < node->op()->ValueInputCount(); ++i) {
249 Node* input = NodeProperties::GetValueInput(node, i);
250 Node* ret = nullptr;
254 ret = ReduceStateValueInput(node, i, effect, multiple_users);
257 node = ret;
267 // Returns the clone if it duplicated the node, and null otherwise.
268 Node* EscapeAnalysisReducer::ReduceStateValueInput(Node* node, int node_index,
269 Node* effect,
271 Node* input = NodeProperties::GetValueInput(node, node_index);
276 Node* clone = nullptr;
280 if (Node* object_state =
282 if (node->UseCount() > 1 || multiple_users) {
284 PrintF("Cloning #%d", node->id());
286 node = clone = jsgraph()->graph()->CloneNode(node);
288 PrintF(" to #%d\n", node->id());
291 NodeProperties::ReplaceValueInput(node, object_state, node_index);
294 node->id(), input->id(), object_state->id());