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/base/adapters.h" |
10 #include "src/compiler/instruction-selector-impl.h" | 10 #include "src/compiler/instruction-selector-impl.h" |
11 #include "src/compiler/node-matchers.h" | 11 #include "src/compiler/node-matchers.h" |
12 #include "src/compiler/node-properties.h" | 12 #include "src/compiler/node-properties.h" |
13 #include "src/compiler/pipeline.h" | 13 #include "src/compiler/pipeline.h" |
14 #include "src/compiler/schedule.h" | 14 #include "src/compiler/schedule.h" |
15 #include "src/compiler/state-values-utils.h" | 15 #include "src/compiler/state-values-utils.h" |
16 | 16 |
17 namespace v8 { | 17 namespace v8 { |
18 namespace internal { | 18 namespace internal { |
19 namespace compiler { | 19 namespace compiler { |
20 | 20 |
21 InstructionSelector::InstructionSelector(Zone* zone, size_t node_count, | 21 InstructionSelector::InstructionSelector( |
22 Linkage* linkage, | 22 Zone* zone, size_t node_count, Linkage* linkage, |
23 InstructionSequence* sequence, | 23 InstructionSequence* sequence, Schedule* schedule, |
24 Schedule* schedule, | 24 SourcePositionTable* source_positions, |
25 SourcePositionTable* source_positions, | 25 SourcePositionMode source_position_mode, Features features) |
26 Features features) | |
27 : zone_(zone), | 26 : zone_(zone), |
28 linkage_(linkage), | 27 linkage_(linkage), |
29 sequence_(sequence), | 28 sequence_(sequence), |
30 source_positions_(source_positions), | 29 source_positions_(source_positions), |
| 30 source_position_mode_(source_position_mode), |
31 features_(features), | 31 features_(features), |
32 schedule_(schedule), | 32 schedule_(schedule), |
33 current_block_(NULL), | 33 current_block_(NULL), |
34 instructions_(zone), | 34 instructions_(zone), |
35 defined_(node_count, false, zone), | 35 defined_(node_count, false, zone), |
36 used_(node_count, false, zone), | 36 used_(node_count, false, zone), |
37 virtual_registers_(node_count, | 37 virtual_registers_(node_count, |
38 InstructionOperand::kInvalidVirtualRegister, zone) { | 38 InstructionOperand::kInvalidVirtualRegister, zone) { |
39 instructions_.reserve(node_count); | 39 instructions_.reserve(node_count); |
40 } | 40 } |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 // Generate code for this node "top down", but schedule the code "bottom | 419 // Generate code for this node "top down", but schedule the code "bottom |
420 // up". | 420 // up". |
421 size_t current_node_end = instructions_.size(); | 421 size_t current_node_end = instructions_.size(); |
422 VisitNode(node); | 422 VisitNode(node); |
423 std::reverse(instructions_.begin() + current_node_end, instructions_.end()); | 423 std::reverse(instructions_.begin() + current_node_end, instructions_.end()); |
424 if (instructions_.size() == current_node_end) continue; | 424 if (instructions_.size() == current_node_end) continue; |
425 // Mark source position on first instruction emitted. | 425 // Mark source position on first instruction emitted. |
426 SourcePosition source_position = source_positions_->GetSourcePosition(node); | 426 SourcePosition source_position = source_positions_->GetSourcePosition(node); |
427 if (source_position.IsUnknown()) continue; | 427 if (source_position.IsUnknown()) continue; |
428 DCHECK(!source_position.IsInvalid()); | 428 DCHECK(!source_position.IsInvalid()); |
429 if (FLAG_turbo_source_positions || node->opcode() == IrOpcode::kCall) { | 429 if (source_position_mode_ == kAllSourcePositions || |
| 430 node->opcode() == IrOpcode::kCall) { |
430 sequence()->SetSourcePosition(instructions_[current_node_end], | 431 sequence()->SetSourcePosition(instructions_[current_node_end], |
431 source_position); | 432 source_position); |
432 } | 433 } |
433 } | 434 } |
434 | 435 |
435 // We're done with the block. | 436 // We're done with the block. |
436 InstructionBlock* instruction_block = | 437 InstructionBlock* instruction_block = |
437 sequence()->InstructionBlockAt(RpoNumber::FromInt(block->rpo_number())); | 438 sequence()->InstructionBlockAt(RpoNumber::FromInt(block->rpo_number())); |
438 instruction_block->set_code_start(static_cast<int>(instructions_.size())); | 439 instruction_block->set_code_start(static_cast<int>(instructions_.size())); |
439 instruction_block->set_code_end(current_block_end); | 440 instruction_block->set_code_end(current_block_end); |
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1179 MachineOperatorBuilder::Flags | 1180 MachineOperatorBuilder::Flags |
1180 InstructionSelector::SupportedMachineOperatorFlags() { | 1181 InstructionSelector::SupportedMachineOperatorFlags() { |
1181 return MachineOperatorBuilder::Flag::kNoFlags; | 1182 return MachineOperatorBuilder::Flag::kNoFlags; |
1182 } | 1183 } |
1183 | 1184 |
1184 #endif // !V8_TURBOFAN_BACKEND | 1185 #endif // !V8_TURBOFAN_BACKEND |
1185 | 1186 |
1186 } // namespace compiler | 1187 } // namespace compiler |
1187 } // namespace internal | 1188 } // namespace internal |
1188 } // namespace v8 | 1189 } // namespace v8 |
OLD | NEW |