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

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

Issue 1060373006: [turbofan] Get rid of SourcePositionInstruction. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 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/instruction.cc ('k') | src/compiler/jump-threading.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 <limits> 7 #include <limits>
8 8
9 #include "src/compiler/instruction-selector-impl.h" 9 #include "src/compiler/instruction-selector-impl.h"
10 #include "src/compiler/node-matchers.h" 10 #include "src/compiler/node-matchers.h"
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 for (BasicBlock::reverse_iterator i = block->rbegin(); i != block->rend(); 468 for (BasicBlock::reverse_iterator i = block->rbegin(); i != block->rend();
469 ++i) { 469 ++i) {
470 Node* node = *i; 470 Node* node = *i;
471 // Skip nodes that are unused or already defined. 471 // Skip nodes that are unused or already defined.
472 if (!IsUsed(node) || IsDefined(node)) continue; 472 if (!IsUsed(node) || IsDefined(node)) continue;
473 // Generate code for this node "top down", but schedule the code "bottom 473 // Generate code for this node "top down", but schedule the code "bottom
474 // up". 474 // up".
475 size_t current_node_end = instructions_.size(); 475 size_t current_node_end = instructions_.size();
476 VisitNode(node); 476 VisitNode(node);
477 std::reverse(instructions_.begin() + current_node_end, instructions_.end()); 477 std::reverse(instructions_.begin() + current_node_end, instructions_.end());
478 if (instructions_.size() == current_node_end) continue;
479 // Mark source position on first instruction emitted.
480 SourcePosition source_position = source_positions_->GetSourcePosition(node);
481 if (source_position.IsUnknown()) continue;
482 DCHECK(!source_position.IsInvalid());
483 if (FLAG_turbo_source_positions || node->opcode() == IrOpcode::kCall) {
484 sequence()->SetSourcePosition(instructions_[current_node_end],
485 source_position);
486 }
478 } 487 }
479 488
480 // We're done with the block. 489 // We're done with the block.
481 InstructionBlock* instruction_block = 490 InstructionBlock* instruction_block =
482 sequence()->InstructionBlockAt(RpoNumber::FromInt(block->rpo_number())); 491 sequence()->InstructionBlockAt(RpoNumber::FromInt(block->rpo_number()));
483 instruction_block->set_code_start(static_cast<int>(instructions_.size())); 492 instruction_block->set_code_start(static_cast<int>(instructions_.size()));
484 instruction_block->set_code_end(current_block_end); 493 instruction_block->set_code_end(current_block_end);
485 494
486 current_block_ = NULL; 495 current_block_ = NULL;
487 } 496 }
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 } 583 }
575 default: 584 default:
576 UNREACHABLE(); 585 UNREACHABLE();
577 break; 586 break;
578 } 587 }
579 } 588 }
580 589
581 590
582 void InstructionSelector::VisitNode(Node* node) { 591 void InstructionSelector::VisitNode(Node* node) {
583 DCHECK_NOT_NULL(schedule()->block(node)); // should only use scheduled nodes. 592 DCHECK_NOT_NULL(schedule()->block(node)); // should only use scheduled nodes.
584 SourcePosition source_position = source_positions_->GetSourcePosition(node);
585 if (!source_position.IsUnknown()) {
586 DCHECK(!source_position.IsInvalid());
587 if (FLAG_turbo_source_positions || node->opcode() == IrOpcode::kCall) {
588 Emit(SourcePositionInstruction::New(instruction_zone(), source_position));
589 }
590 }
591 switch (node->opcode()) { 593 switch (node->opcode()) {
592 case IrOpcode::kStart: 594 case IrOpcode::kStart:
593 case IrOpcode::kLoop: 595 case IrOpcode::kLoop:
594 case IrOpcode::kEnd: 596 case IrOpcode::kEnd:
595 case IrOpcode::kBranch: 597 case IrOpcode::kBranch:
596 case IrOpcode::kIfTrue: 598 case IrOpcode::kIfTrue:
597 case IrOpcode::kIfFalse: 599 case IrOpcode::kIfFalse:
598 case IrOpcode::kIfSuccess: 600 case IrOpcode::kIfSuccess:
599 case IrOpcode::kSwitch: 601 case IrOpcode::kSwitch:
600 case IrOpcode::kIfValue: 602 case IrOpcode::kIfValue:
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after
1198 MachineOperatorBuilder::Flags 1200 MachineOperatorBuilder::Flags
1199 InstructionSelector::SupportedMachineOperatorFlags() { 1201 InstructionSelector::SupportedMachineOperatorFlags() {
1200 return MachineOperatorBuilder::Flag::kNoFlags; 1202 return MachineOperatorBuilder::Flag::kNoFlags;
1201 } 1203 }
1202 1204
1203 #endif // !V8_TURBOFAN_BACKEND 1205 #endif // !V8_TURBOFAN_BACKEND
1204 1206
1205 } // namespace compiler 1207 } // namespace compiler
1206 } // namespace internal 1208 } // namespace internal
1207 } // namespace v8 1209 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/instruction.cc ('k') | src/compiler/jump-threading.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698