Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(179)

Side by Side Diff: src/compiler/verifier.cc

Issue 1782863002: [turbofan] Change the way nodes with multiple outputs are verified. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/verifier.h" 5 #include "src/compiler/verifier.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <deque> 8 #include <deque>
9 #include <queue> 9 #include <queue>
10 #include <sstream> 10 #include <sstream>
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 CHECK(IsDefUseChainLinkPresent(frame_state, node)); 128 CHECK(IsDefUseChainLinkPresent(frame_state, node));
129 CHECK(IsUseDefChainLinkPresent(frame_state, node)); 129 CHECK(IsUseDefChainLinkPresent(frame_state, node));
130 } 130 }
131 131
132 // Verify all value inputs actually produce a value. 132 // Verify all value inputs actually produce a value.
133 for (int i = 0; i < value_count; ++i) { 133 for (int i = 0; i < value_count; ++i) {
134 Node* value = NodeProperties::GetValueInput(node, i); 134 Node* value = NodeProperties::GetValueInput(node, i);
135 CheckOutput(value, node, value->op()->ValueOutputCount(), "value"); 135 CheckOutput(value, node, value->op()->ValueOutputCount(), "value");
136 CHECK(IsDefUseChainLinkPresent(value, node)); 136 CHECK(IsDefUseChainLinkPresent(value, node));
137 CHECK(IsUseDefChainLinkPresent(value, node)); 137 CHECK(IsUseDefChainLinkPresent(value, node));
138 // Verify that only parameters and projections can have input nodes with
139 // multiple outputs.
140 CHECK(node->opcode() == IrOpcode::kParameter ||
141 node->opcode() == IrOpcode::kProjection ||
142 value->op()->ValueOutputCount() <= 1);
138 } 143 }
139 144
140 // Verify all context inputs are value nodes. 145 // Verify all context inputs are value nodes.
141 for (int i = 0; i < context_count; ++i) { 146 for (int i = 0; i < context_count; ++i) {
142 Node* context = NodeProperties::GetContextInput(node); 147 Node* context = NodeProperties::GetContextInput(node);
143 CheckOutput(context, node, context->op()->ValueOutputCount(), "context"); 148 CheckOutput(context, node, context->op()->ValueOutputCount(), "context");
144 CHECK(IsDefUseChainLinkPresent(context, node)); 149 CHECK(IsDefUseChainLinkPresent(context, node));
145 CHECK(IsUseDefChainLinkPresent(context, node)); 150 CHECK(IsUseDefChainLinkPresent(context, node));
146 } 151 }
147 152
148 // Verify all effect inputs actually have an effect. 153 // Verify all effect inputs actually have an effect.
149 for (int i = 0; i < effect_count; ++i) { 154 for (int i = 0; i < effect_count; ++i) {
150 Node* effect = NodeProperties::GetEffectInput(node); 155 Node* effect = NodeProperties::GetEffectInput(node);
151 CheckOutput(effect, node, effect->op()->EffectOutputCount(), "effect"); 156 CheckOutput(effect, node, effect->op()->EffectOutputCount(), "effect");
152 CHECK(IsDefUseChainLinkPresent(effect, node)); 157 CHECK(IsDefUseChainLinkPresent(effect, node));
153 CHECK(IsUseDefChainLinkPresent(effect, node)); 158 CHECK(IsUseDefChainLinkPresent(effect, node));
154 } 159 }
155 160
156 // Verify all control inputs are control nodes. 161 // Verify all control inputs are control nodes.
157 for (int i = 0; i < control_count; ++i) { 162 for (int i = 0; i < control_count; ++i) {
158 Node* control = NodeProperties::GetControlInput(node, i); 163 Node* control = NodeProperties::GetControlInput(node, i);
159 CheckOutput(control, node, control->op()->ControlOutputCount(), "control"); 164 CheckOutput(control, node, control->op()->ControlOutputCount(), "control");
160 CHECK(IsDefUseChainLinkPresent(control, node)); 165 CHECK(IsDefUseChainLinkPresent(control, node));
161 CHECK(IsUseDefChainLinkPresent(control, node)); 166 CHECK(IsUseDefChainLinkPresent(control, node));
162 } 167 }
163 168
164 // Verify all successors are projections if multiple value outputs exist.
165 if (node->op()->ValueOutputCount() > 1) {
166 for (Edge edge : node->use_edges()) {
167 Node* use = edge.from();
168 CHECK(!NodeProperties::IsValueEdge(edge) ||
169 use->opcode() == IrOpcode::kProjection ||
170 use->opcode() == IrOpcode::kParameter);
171 }
172 }
173
174 switch (node->opcode()) { 169 switch (node->opcode()) {
175 case IrOpcode::kStart: 170 case IrOpcode::kStart:
176 // Start has no inputs. 171 // Start has no inputs.
177 CHECK_EQ(0, input_count); 172 CHECK_EQ(0, input_count);
178 // Type is a tuple. 173 // Type is a tuple.
179 // TODO(rossberg): Multiple outputs are currently typed as Internal. 174 // TODO(rossberg): Multiple outputs are currently typed as Internal.
180 CheckUpperIs(node, Type::Internal()); 175 CheckUpperIs(node, Type::Internal());
181 break; 176 break;
182 case IrOpcode::kEnd: 177 case IrOpcode::kEnd:
183 // End has no outputs. 178 // End has no outputs.
(...skipping 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after
1282 replacement->op()->EffectOutputCount() > 0); 1277 replacement->op()->EffectOutputCount() > 0);
1283 DCHECK(!NodeProperties::IsFrameStateEdge(edge) || 1278 DCHECK(!NodeProperties::IsFrameStateEdge(edge) ||
1284 replacement->opcode() == IrOpcode::kFrameState); 1279 replacement->opcode() == IrOpcode::kFrameState);
1285 } 1280 }
1286 1281
1287 #endif // DEBUG 1282 #endif // DEBUG
1288 1283
1289 } // namespace compiler 1284 } // namespace compiler
1290 } // namespace internal 1285 } // namespace internal
1291 } // namespace v8 1286 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698