Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/effect-control-linearizer.h" | 5 #include "src/compiler/effect-control-linearizer.h" |
| 6 | 6 |
| 7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
| 8 #include "src/compiler/access-builder.h" | 8 #include "src/compiler/access-builder.h" |
| 9 #include "src/compiler/compiler-source-position-table.h" | |
| 9 #include "src/compiler/js-graph.h" | 10 #include "src/compiler/js-graph.h" |
| 10 #include "src/compiler/linkage.h" | 11 #include "src/compiler/linkage.h" |
| 11 #include "src/compiler/node-matchers.h" | 12 #include "src/compiler/node-matchers.h" |
| 12 #include "src/compiler/node-properties.h" | 13 #include "src/compiler/node-properties.h" |
| 13 #include "src/compiler/node.h" | 14 #include "src/compiler/node.h" |
| 14 #include "src/compiler/schedule.h" | 15 #include "src/compiler/schedule.h" |
| 15 | 16 |
| 16 namespace v8 { | 17 namespace v8 { |
| 17 namespace internal { | 18 namespace internal { |
| 18 namespace compiler { | 19 namespace compiler { |
| 19 | 20 |
| 20 EffectControlLinearizer::EffectControlLinearizer(JSGraph* js_graph, | 21 EffectControlLinearizer::EffectControlLinearizer( |
| 21 Schedule* schedule, | 22 JSGraph* js_graph, Schedule* schedule, Zone* temp_zone, |
| 22 Zone* temp_zone) | 23 SourcePositionTable* source_positions) |
| 23 : js_graph_(js_graph), schedule_(schedule), temp_zone_(temp_zone) {} | 24 : js_graph_(js_graph), |
| 25 schedule_(schedule), | |
| 26 temp_zone_(temp_zone), | |
| 27 source_positions_(source_positions) {} | |
| 24 | 28 |
| 25 Graph* EffectControlLinearizer::graph() const { return js_graph_->graph(); } | 29 Graph* EffectControlLinearizer::graph() const { return js_graph_->graph(); } |
| 26 CommonOperatorBuilder* EffectControlLinearizer::common() const { | 30 CommonOperatorBuilder* EffectControlLinearizer::common() const { |
| 27 return js_graph_->common(); | 31 return js_graph_->common(); |
| 28 } | 32 } |
| 29 SimplifiedOperatorBuilder* EffectControlLinearizer::simplified() const { | 33 SimplifiedOperatorBuilder* EffectControlLinearizer::simplified() const { |
| 30 return js_graph_->simplified(); | 34 return js_graph_->simplified(); |
| 31 } | 35 } |
| 32 MachineOperatorBuilder* EffectControlLinearizer::machine() const { | 36 MachineOperatorBuilder* EffectControlLinearizer::machine() const { |
| 33 return js_graph_->machine(); | 37 return js_graph_->machine(); |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 421 .current_frame_state != frame_state) { | 425 .current_frame_state != frame_state) { |
| 422 frame_state = nullptr; | 426 frame_state = nullptr; |
| 423 break; | 427 break; |
| 424 } | 428 } |
| 425 } | 429 } |
| 426 } | 430 } |
| 427 | 431 |
| 428 // Process the ordinary instructions. | 432 // Process the ordinary instructions. |
| 429 for (; instr < block->NodeCount(); instr++) { | 433 for (; instr < block->NodeCount(); instr++) { |
| 430 Node* node = block->NodeAt(instr); | 434 Node* node = block->NodeAt(instr); |
| 431 ProcessNode(node, &frame_state, &effect, &control); | 435 if (source_positions_) { |
| 436 SourcePositionTable::Scope scope( | |
| 437 source_positions_, source_positions_->GetSourcePosition(node)); | |
| 438 ProcessNode(node, &frame_state, &effect, &control); | |
| 439 } else { | |
| 440 ProcessNode(node, &frame_state, &effect, &control); | |
| 441 } | |
| 432 } | 442 } |
| 433 | 443 |
| 434 switch (block->control()) { | 444 switch (block->control()) { |
| 435 case BasicBlock::kGoto: | 445 case BasicBlock::kGoto: |
| 436 case BasicBlock::kNone: | 446 case BasicBlock::kNone: |
| 437 break; | 447 break; |
| 438 | 448 |
| 439 case BasicBlock::kCall: | 449 case BasicBlock::kCall: |
| 440 case BasicBlock::kTailCall: | 450 case BasicBlock::kTailCall: |
| 441 case BasicBlock::kSwitch: | 451 case BasicBlock::kSwitch: |
| 442 case BasicBlock::kReturn: | 452 case BasicBlock::kReturn: |
| 443 case BasicBlock::kDeoptimize: | 453 case BasicBlock::kDeoptimize: |
| 444 case BasicBlock::kThrow: | 454 case BasicBlock::kThrow: |
| 445 ProcessNode(block->control_input(), &frame_state, &effect, &control); | 455 ProcessNode(block->control_input(), &frame_state, &effect, &control); |
| 446 break; | 456 break; |
| 447 | 457 |
| 448 case BasicBlock::kBranch: | 458 case BasicBlock::kBranch: |
| 449 ProcessNode(block->control_input(), &frame_state, &effect, &control); | 459 ProcessNode(block->control_input(), &frame_state, &effect, &control); |
| 450 TryCloneBranch(block->control_input(), block, graph(), common(), | 460 TryCloneBranch(block->control_input(), block, graph(), common(), |
| 451 &block_effects); | 461 &block_effects); |
|
Jarin
2016/11/16 13:32:52
Does not this only need the source position scope?
| |
| 452 break; | 462 break; |
| 453 } | 463 } |
| 454 | 464 |
| 455 // Store the effect, control and frame state for later use. | 465 // Store the effect, control and frame state for later use. |
| 456 for (BasicBlock* successor : block->successors()) { | 466 for (BasicBlock* successor : block->successors()) { |
| 457 BlockEffectControlData* data = &block_effects.For(block, successor); | 467 BlockEffectControlData* data = &block_effects.For(block, successor); |
| 458 if (data->current_effect == nullptr) { | 468 if (data->current_effect == nullptr) { |
| 459 data->current_effect = effect; | 469 data->current_effect = effect; |
| 460 } | 470 } |
| 461 if (data->current_control == nullptr) { | 471 if (data->current_control == nullptr) { |
| (...skipping 3292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3754 isolate(), graph()->zone(), callable.descriptor(), 0, flags, | 3764 isolate(), graph()->zone(), callable.descriptor(), 0, flags, |
| 3755 Operator::kEliminatable); | 3765 Operator::kEliminatable); |
| 3756 to_number_operator_.set(common()->Call(desc)); | 3766 to_number_operator_.set(common()->Call(desc)); |
| 3757 } | 3767 } |
| 3758 return to_number_operator_.get(); | 3768 return to_number_operator_.get(); |
| 3759 } | 3769 } |
| 3760 | 3770 |
| 3761 } // namespace compiler | 3771 } // namespace compiler |
| 3762 } // namespace internal | 3772 } // namespace internal |
| 3763 } // namespace v8 | 3773 } // namespace v8 |
| OLD | NEW |