| OLD | NEW |
| 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/base/adapters.h" |
| 9 #include "src/compiler/instruction-selector-impl.h" | 10 #include "src/compiler/instruction-selector-impl.h" |
| 10 #include "src/compiler/node-matchers.h" | 11 #include "src/compiler/node-matchers.h" |
| 11 #include "src/compiler/node-properties.h" | 12 #include "src/compiler/node-properties.h" |
| 12 #include "src/compiler/pipeline.h" | 13 #include "src/compiler/pipeline.h" |
| 13 #include "src/compiler/schedule.h" | 14 #include "src/compiler/schedule.h" |
| 14 #include "src/compiler/state-values-utils.h" | 15 #include "src/compiler/state-values-utils.h" |
| 15 | 16 |
| 16 namespace v8 { | 17 namespace v8 { |
| 17 namespace internal { | 18 namespace internal { |
| 18 namespace compiler { | 19 namespace compiler { |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 current_block_ = block; | 459 current_block_ = block; |
| 459 int current_block_end = static_cast<int>(instructions_.size()); | 460 int current_block_end = static_cast<int>(instructions_.size()); |
| 460 | 461 |
| 461 // Generate code for the block control "top down", but schedule the code | 462 // Generate code for the block control "top down", but schedule the code |
| 462 // "bottom up". | 463 // "bottom up". |
| 463 VisitControl(block); | 464 VisitControl(block); |
| 464 std::reverse(instructions_.begin() + current_block_end, instructions_.end()); | 465 std::reverse(instructions_.begin() + current_block_end, instructions_.end()); |
| 465 | 466 |
| 466 // Visit code in reverse control flow order, because architecture-specific | 467 // Visit code in reverse control flow order, because architecture-specific |
| 467 // matching may cover more than one node at a time. | 468 // matching may cover more than one node at a time. |
| 468 for (BasicBlock::reverse_iterator i = block->rbegin(); i != block->rend(); | 469 for (auto node : base::Reversed(*block)) { |
| 469 ++i) { | |
| 470 Node* node = *i; | |
| 471 // Skip nodes that are unused or already defined. | 470 // Skip nodes that are unused or already defined. |
| 472 if (!IsUsed(node) || IsDefined(node)) continue; | 471 if (!IsUsed(node) || IsDefined(node)) continue; |
| 473 // Generate code for this node "top down", but schedule the code "bottom | 472 // Generate code for this node "top down", but schedule the code "bottom |
| 474 // up". | 473 // up". |
| 475 size_t current_node_end = instructions_.size(); | 474 size_t current_node_end = instructions_.size(); |
| 476 VisitNode(node); | 475 VisitNode(node); |
| 477 std::reverse(instructions_.begin() + current_node_end, instructions_.end()); | 476 std::reverse(instructions_.begin() + current_node_end, instructions_.end()); |
| 478 if (instructions_.size() == current_node_end) continue; | 477 if (instructions_.size() == current_node_end) continue; |
| 479 // Mark source position on first instruction emitted. | 478 // Mark source position on first instruction emitted. |
| 480 SourcePosition source_position = source_positions_->GetSourcePosition(node); | 479 SourcePosition source_position = source_positions_->GetSourcePosition(node); |
| (...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1200 MachineOperatorBuilder::Flags | 1199 MachineOperatorBuilder::Flags |
| 1201 InstructionSelector::SupportedMachineOperatorFlags() { | 1200 InstructionSelector::SupportedMachineOperatorFlags() { |
| 1202 return MachineOperatorBuilder::Flag::kNoFlags; | 1201 return MachineOperatorBuilder::Flag::kNoFlags; |
| 1203 } | 1202 } |
| 1204 | 1203 |
| 1205 #endif // !V8_TURBOFAN_BACKEND | 1204 #endif // !V8_TURBOFAN_BACKEND |
| 1206 | 1205 |
| 1207 } // namespace compiler | 1206 } // namespace compiler |
| 1208 } // namespace internal | 1207 } // namespace internal |
| 1209 } // namespace v8 | 1208 } // namespace v8 |
| OLD | NEW |