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/compiler-source-position-table.h" |
10 #include "src/compiler/js-graph.h" | 10 #include "src/compiler/js-graph.h" |
11 #include "src/compiler/linkage.h" | 11 #include "src/compiler/linkage.h" |
12 #include "src/compiler/node-matchers.h" | 12 #include "src/compiler/node-matchers.h" |
13 #include "src/compiler/node-properties.h" | 13 #include "src/compiler/node-properties.h" |
14 #include "src/compiler/node.h" | 14 #include "src/compiler/node.h" |
15 #include "src/compiler/schedule.h" | 15 #include "src/compiler/schedule.h" |
16 #include "src/objects-inl.h" | 16 #include "src/objects-inl.h" |
17 | 17 |
18 namespace v8 { | 18 namespace v8 { |
19 namespace internal { | 19 namespace internal { |
20 namespace compiler { | 20 namespace compiler { |
21 | 21 |
22 EffectControlLinearizer::EffectControlLinearizer( | 22 EffectControlLinearizer::EffectControlLinearizer( |
23 JSGraph* js_graph, Schedule* schedule, Zone* temp_zone, | 23 JSGraph* js_graph, Schedule* schedule, Zone* temp_zone, |
24 SourcePositionTable* source_positions) | 24 SourcePositionTable* source_positions) |
25 : js_graph_(js_graph), | 25 : js_graph_(js_graph), |
26 schedule_(schedule), | 26 schedule_(schedule), |
27 temp_zone_(temp_zone), | 27 temp_zone_(temp_zone), |
28 source_positions_(source_positions), | 28 source_positions_(source_positions), |
29 graph_assembler_(js_graph, nullptr, nullptr, temp_zone) {} | 29 graph_assembler_(js_graph, nullptr, nullptr, temp_zone), |
| 30 frame_state_zapper_(nullptr) {} |
30 | 31 |
31 Graph* EffectControlLinearizer::graph() const { return js_graph_->graph(); } | 32 Graph* EffectControlLinearizer::graph() const { return js_graph_->graph(); } |
32 CommonOperatorBuilder* EffectControlLinearizer::common() const { | 33 CommonOperatorBuilder* EffectControlLinearizer::common() const { |
33 return js_graph_->common(); | 34 return js_graph_->common(); |
34 } | 35 } |
35 SimplifiedOperatorBuilder* EffectControlLinearizer::simplified() const { | 36 SimplifiedOperatorBuilder* EffectControlLinearizer::simplified() const { |
36 return js_graph_->simplified(); | 37 return js_graph_->simplified(); |
37 } | 38 } |
38 MachineOperatorBuilder* EffectControlLinearizer::machine() const { | 39 MachineOperatorBuilder* EffectControlLinearizer::machine() const { |
39 return js_graph_->machine(); | 40 return js_graph_->machine(); |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 Node* frame_state = nullptr; | 423 Node* frame_state = nullptr; |
423 if (block != schedule()->start()) { | 424 if (block != schedule()->start()) { |
424 // If all the predecessors have the same effect, we can use it | 425 // If all the predecessors have the same effect, we can use it |
425 // as our current effect. | 426 // as our current effect. |
426 frame_state = | 427 frame_state = |
427 block_effects.For(block->PredecessorAt(0), block).current_frame_state; | 428 block_effects.For(block->PredecessorAt(0), block).current_frame_state; |
428 for (size_t i = 1; i < block->PredecessorCount(); i++) { | 429 for (size_t i = 1; i < block->PredecessorCount(); i++) { |
429 if (block_effects.For(block->PredecessorAt(i), block) | 430 if (block_effects.For(block->PredecessorAt(i), block) |
430 .current_frame_state != frame_state) { | 431 .current_frame_state != frame_state) { |
431 frame_state = nullptr; | 432 frame_state = nullptr; |
| 433 frame_state_zapper_ = graph()->end(); |
432 break; | 434 break; |
433 } | 435 } |
434 } | 436 } |
435 } | 437 } |
436 | 438 |
437 // Process the ordinary instructions. | 439 // Process the ordinary instructions. |
438 for (; instr < block->NodeCount(); instr++) { | 440 for (; instr < block->NodeCount(); instr++) { |
439 Node* node = block->NodeAt(instr); | 441 Node* node = block->NodeAt(instr); |
440 ProcessNode(node, &frame_state, &effect, &control); | 442 ProcessNode(node, &frame_state, &effect, &control); |
441 } | 443 } |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 if (TryWireInStateEffect(node, *frame_state, effect, control)) { | 497 if (TryWireInStateEffect(node, *frame_state, effect, control)) { |
496 return; | 498 return; |
497 } | 499 } |
498 | 500 |
499 // If the node has a visible effect, then there must be a checkpoint in the | 501 // If the node has a visible effect, then there must be a checkpoint in the |
500 // effect chain before we are allowed to place another eager deoptimization | 502 // effect chain before we are allowed to place another eager deoptimization |
501 // point. We zap the frame state to ensure this invariant is maintained. | 503 // point. We zap the frame state to ensure this invariant is maintained. |
502 if (region_observability_ == RegionObservability::kObservable && | 504 if (region_observability_ == RegionObservability::kObservable && |
503 !node->op()->HasProperty(Operator::kNoWrite)) { | 505 !node->op()->HasProperty(Operator::kNoWrite)) { |
504 *frame_state = nullptr; | 506 *frame_state = nullptr; |
| 507 frame_state_zapper_ = node; |
505 } | 508 } |
506 | 509 |
507 // Remove the end markers of 'atomic' allocation region because the | 510 // Remove the end markers of 'atomic' allocation region because the |
508 // region should be wired-in now. | 511 // region should be wired-in now. |
509 if (node->opcode() == IrOpcode::kFinishRegion) { | 512 if (node->opcode() == IrOpcode::kFinishRegion) { |
510 // Reset the current region observability. | 513 // Reset the current region observability. |
511 region_observability_ = RegionObservability::kObservable; | 514 region_observability_ = RegionObservability::kObservable; |
512 // Update the value uses to the value input of the finish node and | 515 // Update the value uses to the value input of the finish node and |
513 // the effect uses to the effect input. | 516 // the effect uses to the effect input. |
514 return RemoveRegionNode(node); | 517 return RemoveRegionNode(node); |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 case IrOpcode::kCheckedUint32ToInt32: | 677 case IrOpcode::kCheckedUint32ToInt32: |
675 result = LowerCheckedUint32ToInt32(node, frame_state); | 678 result = LowerCheckedUint32ToInt32(node, frame_state); |
676 break; | 679 break; |
677 case IrOpcode::kCheckedUint32ToTaggedSigned: | 680 case IrOpcode::kCheckedUint32ToTaggedSigned: |
678 result = LowerCheckedUint32ToTaggedSigned(node, frame_state); | 681 result = LowerCheckedUint32ToTaggedSigned(node, frame_state); |
679 break; | 682 break; |
680 case IrOpcode::kCheckedFloat64ToInt32: | 683 case IrOpcode::kCheckedFloat64ToInt32: |
681 result = LowerCheckedFloat64ToInt32(node, frame_state); | 684 result = LowerCheckedFloat64ToInt32(node, frame_state); |
682 break; | 685 break; |
683 case IrOpcode::kCheckedTaggedSignedToInt32: | 686 case IrOpcode::kCheckedTaggedSignedToInt32: |
| 687 if (frame_state == nullptr) { |
| 688 V8_Fatal(__FILE__, __LINE__, "No frame state (zapped by #%d: %s)", |
| 689 frame_state_zapper_->id(), |
| 690 frame_state_zapper_->op()->mnemonic()); |
| 691 } |
684 result = LowerCheckedTaggedSignedToInt32(node, frame_state); | 692 result = LowerCheckedTaggedSignedToInt32(node, frame_state); |
685 break; | 693 break; |
686 case IrOpcode::kCheckedTaggedToInt32: | 694 case IrOpcode::kCheckedTaggedToInt32: |
687 result = LowerCheckedTaggedToInt32(node, frame_state); | 695 result = LowerCheckedTaggedToInt32(node, frame_state); |
688 break; | 696 break; |
689 case IrOpcode::kCheckedTaggedToFloat64: | 697 case IrOpcode::kCheckedTaggedToFloat64: |
690 result = LowerCheckedTaggedToFloat64(node, frame_state); | 698 result = LowerCheckedTaggedToFloat64(node, frame_state); |
691 break; | 699 break; |
692 case IrOpcode::kCheckedTaggedToTaggedSigned: | 700 case IrOpcode::kCheckedTaggedToTaggedSigned: |
693 result = LowerCheckedTaggedToTaggedSigned(node, frame_state); | 701 result = LowerCheckedTaggedToTaggedSigned(node, frame_state); |
(...skipping 2291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2985 return isolate()->factory(); | 2993 return isolate()->factory(); |
2986 } | 2994 } |
2987 | 2995 |
2988 Isolate* EffectControlLinearizer::isolate() const { | 2996 Isolate* EffectControlLinearizer::isolate() const { |
2989 return jsgraph()->isolate(); | 2997 return jsgraph()->isolate(); |
2990 } | 2998 } |
2991 | 2999 |
2992 } // namespace compiler | 3000 } // namespace compiler |
2993 } // namespace internal | 3001 } // namespace internal |
2994 } // namespace v8 | 3002 } // namespace v8 |
OLD | NEW |