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

Side by Side Diff: src/compiler/instruction-selector.cc

Issue 851263002: [turbofan] Initial attempt to cleanup Node and related classes. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 11 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 | « src/compiler/ia32/instruction-selector-ia32.cc ('k') | src/compiler/js-inlining.cc » ('j') | 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/instruction-selector.h" 5 #include "src/compiler/instruction-selector.h"
6 6
7 #include "src/compiler/instruction-selector-impl.h" 7 #include "src/compiler/instruction-selector-impl.h"
8 #include "src/compiler/node-matchers.h" 8 #include "src/compiler/node-matchers.h"
9 #include "src/compiler/node-properties-inl.h" 9 #include "src/compiler/node-properties-inl.h"
10 #include "src/compiler/pipeline.h" 10 #include "src/compiler/pipeline.h"
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 static_cast<int>(buffer->descriptor->ReturnCount())); 330 static_cast<int>(buffer->descriptor->ReturnCount()));
331 DCHECK_EQ( 331 DCHECK_EQ(
332 call->op()->ValueInputCount(), 332 call->op()->ValueInputCount(),
333 static_cast<int>(buffer->input_count() + buffer->frame_state_count())); 333 static_cast<int>(buffer->input_count() + buffer->frame_state_count()));
334 334
335 if (buffer->descriptor->ReturnCount() > 0) { 335 if (buffer->descriptor->ReturnCount() > 0) {
336 // Collect the projections that represent multiple outputs from this call. 336 // Collect the projections that represent multiple outputs from this call.
337 if (buffer->descriptor->ReturnCount() == 1) { 337 if (buffer->descriptor->ReturnCount() == 1) {
338 buffer->output_nodes.push_back(call); 338 buffer->output_nodes.push_back(call);
339 } else { 339 } else {
340 buffer->output_nodes.resize(buffer->descriptor->ReturnCount(), NULL); 340 buffer->output_nodes.resize(buffer->descriptor->ReturnCount(), nullptr);
341 call->CollectProjections(&buffer->output_nodes); 341 for (auto use : call->uses()) {
342 if (use->opcode() != IrOpcode::kProjection) continue;
343 size_t const index = ProjectionIndexOf(use->op());
344 DCHECK_LT(index, buffer->output_nodes.size());
345 DCHECK_EQ(nullptr, buffer->output_nodes[index]);
346 buffer->output_nodes[index] = use;
347 }
342 } 348 }
343 349
344 // Filter out the outputs that aren't live because no projection uses them. 350 // Filter out the outputs that aren't live because no projection uses them.
345 size_t outputs_needed_by_framestate = 351 size_t outputs_needed_by_framestate =
346 buffer->frame_state_descriptor == NULL 352 buffer->frame_state_descriptor == NULL
347 ? 0 353 ? 0
348 : buffer->frame_state_descriptor->state_combine() 354 : buffer->frame_state_descriptor->state_combine()
349 .ConsumedOutputCount(); 355 .ConsumedOutputCount();
350 for (size_t i = 0; i < buffer->output_nodes.size(); i++) { 356 for (size_t i = 0; i < buffer->output_nodes.size(); i++) {
351 bool output_is_live = 357 bool output_is_live =
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after
990 } 996 }
991 } 997 }
992 998
993 999
994 void InstructionSelector::VisitProjection(Node* node) { 1000 void InstructionSelector::VisitProjection(Node* node) {
995 OperandGenerator g(this); 1001 OperandGenerator g(this);
996 Node* value = node->InputAt(0); 1002 Node* value = node->InputAt(0);
997 switch (value->opcode()) { 1003 switch (value->opcode()) {
998 case IrOpcode::kInt32AddWithOverflow: 1004 case IrOpcode::kInt32AddWithOverflow:
999 case IrOpcode::kInt32SubWithOverflow: 1005 case IrOpcode::kInt32SubWithOverflow:
1000 if (OpParameter<size_t>(node) == 0) { 1006 if (ProjectionIndexOf(node->op()) == 0u) {
1001 Emit(kArchNop, g.DefineSameAsFirst(node), g.Use(value)); 1007 Emit(kArchNop, g.DefineSameAsFirst(node), g.Use(value));
1002 } else { 1008 } else {
1003 DCHECK(OpParameter<size_t>(node) == 1u); 1009 DCHECK(ProjectionIndexOf(node->op()) == 1u);
1004 MarkAsUsed(value); 1010 MarkAsUsed(value);
1005 } 1011 }
1006 break; 1012 break;
1007 default: 1013 default:
1008 break; 1014 break;
1009 } 1015 }
1010 } 1016 }
1011 1017
1012 1018
1013 void InstructionSelector::VisitConstant(Node* node) { 1019 void InstructionSelector::VisitConstant(Node* node) {
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
1161 MachineOperatorBuilder::Flags 1167 MachineOperatorBuilder::Flags
1162 InstructionSelector::SupportedMachineOperatorFlags() { 1168 InstructionSelector::SupportedMachineOperatorFlags() {
1163 return MachineOperatorBuilder::Flag::kNoFlags; 1169 return MachineOperatorBuilder::Flag::kNoFlags;
1164 } 1170 }
1165 1171
1166 #endif // !V8_TURBOFAN_BACKEND 1172 #endif // !V8_TURBOFAN_BACKEND
1167 1173
1168 } // namespace compiler 1174 } // namespace compiler
1169 } // namespace internal 1175 } // namespace internal
1170 } // namespace v8 1176 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/ia32/instruction-selector-ia32.cc ('k') | src/compiler/js-inlining.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698