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

Side by Side Diff: src/compiler/simplified-lowering.cc

Issue 1029843002: [turbofan] Address minor TODOs in simplified lowering. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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/simplified-lowering.h" 5 #include "src/compiler/simplified-lowering.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/code-factory.h" 10 #include "src/code-factory.h"
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 i < NodeProperties::PastEffectIndex(node); ++i) { 243 i < NodeProperties::PastEffectIndex(node); ++i) {
244 Enqueue(node->InputAt(i)); // Effect inputs: just visit 244 Enqueue(node->InputAt(i)); // Effect inputs: just visit
245 } 245 }
246 for (int i = std::max(index, NodeProperties::FirstControlIndex(node)); 246 for (int i = std::max(index, NodeProperties::FirstControlIndex(node));
247 i < NodeProperties::PastControlIndex(node); ++i) { 247 i < NodeProperties::PastControlIndex(node); ++i) {
248 Enqueue(node->InputAt(i)); // Control inputs: just visit 248 Enqueue(node->InputAt(i)); // Control inputs: just visit
249 } 249 }
250 } 250 }
251 251
252 // The default, most general visitation case. For {node}, process all value, 252 // The default, most general visitation case. For {node}, process all value,
253 // context, effect, and control inputs, assuming that value inputs should have 253 // context, frame state, effect, and control inputs, assuming that value
254 // {kRepTagged} representation and can observe all output values {kTypeAny}. 254 // inputs should have {kRepTagged} representation and can observe all output
255 // values {kTypeAny}.
255 void VisitInputs(Node* node) { 256 void VisitInputs(Node* node) {
256 auto i = node->input_edges().begin(); 257 int tagged_count = node->op()->ValueInputCount() +
257 for (int j = node->op()->ValueInputCount(); j > 0; ++i, j--) { 258 OperatorProperties::GetContextInputCount(node->op());
258 ProcessInput(node, (*i).index(), kMachAnyTagged); // Value inputs 259 // Visit value and context inputs as tagged.
260 for (int i = 0; i < tagged_count; i++) {
261 ProcessInput(node, i, kMachAnyTagged);
259 } 262 }
260 for (int j = OperatorProperties::GetContextInputCount(node->op()); j > 0; 263 // Only enqueue other inputs (framestates, effects, control).
261 ++i, j--) { 264 for (int i = tagged_count; i < node->InputCount(); i++) {
262 ProcessInput(node, (*i).index(), kMachAnyTagged); // Context inputs 265 Enqueue(node->InputAt(i));
263 } 266 }
264 for (int j = OperatorProperties::GetFrameStateInputCount(node->op()); j > 0; 267 // Assume the output is tagged.
265 ++i, j--) {
266 Enqueue((*i).to()); // FrameState inputs: just visit
267 }
268 for (int j = node->op()->EffectInputCount(); j > 0; ++i, j--) {
269 Enqueue((*i).to()); // Effect inputs: just visit
270 }
271 for (int j = node->op()->ControlInputCount(); j > 0; ++i, j--) {
272 Enqueue((*i).to()); // Control inputs: just visit
273 }
274 DCHECK(i == node->input_edges().end());
275 SetOutput(node, kMachAnyTagged); 268 SetOutput(node, kMachAnyTagged);
276 } 269 }
277 270
278 // Helper for binops of the R x L -> O variety. 271 // Helper for binops of the R x L -> O variety.
279 void VisitBinop(Node* node, MachineTypeUnion left_use, 272 void VisitBinop(Node* node, MachineTypeUnion left_use,
280 MachineTypeUnion right_use, MachineTypeUnion output) { 273 MachineTypeUnion right_use, MachineTypeUnion output) {
281 DCHECK_EQ(2, node->InputCount()); 274 DCHECK_EQ(2, node->InputCount());
282 ProcessInput(node, 0, left_use); 275 ProcessInput(node, 0, left_use);
283 ProcessInput(node, 1, right_use); 276 ProcessInput(node, 1, right_use);
284 SetOutput(node, output); 277 SetOutput(node, output);
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 int values = node->op()->ValueInputCount(); 393 int values = node->op()->ValueInputCount();
401 394
402 if (lower()) { 395 if (lower()) {
403 // Update the phi operator. 396 // Update the phi operator.
404 MachineType type = static_cast<MachineType>(output_type); 397 MachineType type = static_cast<MachineType>(output_type);
405 if (type != OpParameter<MachineType>(node)) { 398 if (type != OpParameter<MachineType>(node)) {
406 node->set_op(lowering->common()->Phi(type, values)); 399 node->set_op(lowering->common()->Phi(type, values));
407 } 400 }
408 401
409 // Convert inputs to the output representation of this phi. 402 // Convert inputs to the output representation of this phi.
410 for (Edge const edge : node->input_edges()) { 403 for (int i = 0; i < node->InputCount(); i++) {
411 // TODO(titzer): it'd be nice to have distinguished edge kinds here. 404 ProcessInput(node, i, i < values ? output_type : 0);
412 ProcessInput(node, edge.index(), values > 0 ? output_type : 0);
413 values--;
414 } 405 }
415 } else { 406 } else {
416 // Propagate {use} of the phi to value inputs, and 0 to control. 407 // Propagate {use} of the phi to value inputs, and 0 to control.
417 MachineType use_type = 408 MachineType use_type =
418 static_cast<MachineType>((use & kTypeMask) | output); 409 static_cast<MachineType>((use & kTypeMask) | output);
419 for (Edge const edge : node->input_edges()) { 410 for (int i = 0; i < node->InputCount(); i++) {
420 // TODO(titzer): it'd be nice to have distinguished edge kinds here. 411 ProcessInput(node, i, i < values ? use_type : 0);
421 ProcessInput(node, edge.index(), values > 0 ? use_type : 0);
422 values--;
423 } 412 }
424 } 413 }
425 } 414 }
426 415
427 void VisitStateValues(Node* node) { 416 void VisitStateValues(Node* node) {
428 if (phase_ == PROPAGATE) { 417 if (phase_ == PROPAGATE) {
429 for (int i = 0; i < node->InputCount(); i++) { 418 for (int i = 0; i < node->InputCount(); i++) {
430 Enqueue(node->InputAt(i), kTypeAny); 419 Enqueue(node->InputAt(i), kTypeAny);
431 } 420 }
432 } else { 421 } else {
(...skipping 1162 matching lines...) Expand 10 before | Expand all | Expand 10 after
1595 1584
1596 void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) { 1585 void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) {
1597 node->set_op(machine()->IntLessThanOrEqual()); 1586 node->set_op(machine()->IntLessThanOrEqual());
1598 node->ReplaceInput(0, StringComparison(node, true)); 1587 node->ReplaceInput(0, StringComparison(node, true));
1599 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); 1588 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL));
1600 } 1589 }
1601 1590
1602 } // namespace compiler 1591 } // namespace compiler
1603 } // namespace internal 1592 } // namespace internal
1604 } // namespace v8 1593 } // 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