OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 22 matching lines...) Expand all Loading... |
33 #include "codegen.h" | 33 #include "codegen.h" |
34 #include "full-codegen.h" | 34 #include "full-codegen.h" |
35 #include "hashmap.h" | 35 #include "hashmap.h" |
36 #include "hydrogen-dce.h" | 36 #include "hydrogen-dce.h" |
37 #include "hydrogen-environment-liveness.h" | 37 #include "hydrogen-environment-liveness.h" |
38 #include "hydrogen-escape-analysis.h" | 38 #include "hydrogen-escape-analysis.h" |
39 #include "hydrogen-infer-representation.h" | 39 #include "hydrogen-infer-representation.h" |
40 #include "hydrogen-gvn.h" | 40 #include "hydrogen-gvn.h" |
41 #include "hydrogen-osr.h" | 41 #include "hydrogen-osr.h" |
42 #include "hydrogen-range-analysis.h" | 42 #include "hydrogen-range-analysis.h" |
| 43 #include "hydrogen-sce.h" |
43 #include "hydrogen-uint32-analysis.h" | 44 #include "hydrogen-uint32-analysis.h" |
44 #include "lithium-allocator.h" | 45 #include "lithium-allocator.h" |
45 #include "parser.h" | 46 #include "parser.h" |
46 #include "scopeinfo.h" | 47 #include "scopeinfo.h" |
47 #include "scopes.h" | 48 #include "scopes.h" |
48 #include "stub-cache.h" | 49 #include "stub-cache.h" |
49 #include "typing.h" | 50 #include "typing.h" |
50 | 51 |
51 #if V8_TARGET_ARCH_IA32 | 52 #if V8_TARGET_ARCH_IA32 |
52 #include "ia32/lithium-codegen-ia32.h" | 53 #include "ia32/lithium-codegen-ia32.h" |
(...skipping 2572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2625 if (!in_worklist.Contains(use->id())) { | 2626 if (!in_worklist.Contains(use->id())) { |
2626 in_worklist.Add(use->id()); | 2627 in_worklist.Add(use->id()); |
2627 worklist->Add(use, zone()); | 2628 worklist->Add(use, zone()); |
2628 } | 2629 } |
2629 } | 2630 } |
2630 } | 2631 } |
2631 } | 2632 } |
2632 } | 2633 } |
2633 | 2634 |
2634 | 2635 |
2635 class HStackCheckEliminator BASE_EMBEDDED { | |
2636 public: | |
2637 explicit HStackCheckEliminator(HGraph* graph) : graph_(graph) { } | |
2638 | |
2639 void Process(); | |
2640 | |
2641 private: | |
2642 HGraph* graph_; | |
2643 }; | |
2644 | |
2645 | |
2646 void HStackCheckEliminator::Process() { | |
2647 HPhase phase("H_Stack check elimination", graph_); | |
2648 // For each loop block walk the dominator tree from the backwards branch to | |
2649 // the loop header. If a call instruction is encountered the backwards branch | |
2650 // is dominated by a call and the stack check in the backwards branch can be | |
2651 // removed. | |
2652 for (int i = 0; i < graph_->blocks()->length(); i++) { | |
2653 HBasicBlock* block = graph_->blocks()->at(i); | |
2654 if (block->IsLoopHeader()) { | |
2655 HBasicBlock* back_edge = block->loop_information()->GetLastBackEdge(); | |
2656 HBasicBlock* dominator = back_edge; | |
2657 while (true) { | |
2658 for (HInstructionIterator it(dominator); !it.Done(); it.Advance()) { | |
2659 if (it.Current()->IsCall()) { | |
2660 block->loop_information()->stack_check()->Eliminate(); | |
2661 break; | |
2662 } | |
2663 } | |
2664 | |
2665 // Done when the loop header is processed. | |
2666 if (dominator == block) break; | |
2667 | |
2668 // Move up the dominator tree. | |
2669 dominator = dominator->dominator(); | |
2670 } | |
2671 } | |
2672 } | |
2673 } | |
2674 | |
2675 | |
2676 void HGraph::MergeRemovableSimulates() { | 2636 void HGraph::MergeRemovableSimulates() { |
2677 HPhase phase("H_Merge removable simulates", this); | 2637 HPhase phase("H_Merge removable simulates", this); |
2678 ZoneList<HSimulate*> mergelist(2, zone()); | 2638 ZoneList<HSimulate*> mergelist(2, zone()); |
2679 for (int i = 0; i < blocks()->length(); ++i) { | 2639 for (int i = 0; i < blocks()->length(); ++i) { |
2680 HBasicBlock* block = blocks()->at(i); | 2640 HBasicBlock* block = blocks()->at(i); |
2681 // Make sure the merge list is empty at the start of a block. | 2641 // Make sure the merge list is empty at the start of a block. |
2682 ASSERT(mergelist.is_empty()); | 2642 ASSERT(mergelist.is_empty()); |
2683 // Nasty heuristic: Never remove the first simulate in a block. This | 2643 // Nasty heuristic: Never remove the first simulate in a block. This |
2684 // just so happens to have a beneficial effect on register allocation. | 2644 // just so happens to have a beneficial effect on register allocation. |
2685 bool first = true; | 2645 bool first = true; |
(...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3491 | 3451 |
3492 if (FLAG_use_escape_analysis) Run<HEscapeAnalysisPhase>(); | 3452 if (FLAG_use_escape_analysis) Run<HEscapeAnalysisPhase>(); |
3493 | 3453 |
3494 if (FLAG_use_gvn) Run<HGlobalValueNumberingPhase>(); | 3454 if (FLAG_use_gvn) Run<HGlobalValueNumberingPhase>(); |
3495 | 3455 |
3496 if (FLAG_use_range) Run<HRangeAnalysisPhase>(); | 3456 if (FLAG_use_range) Run<HRangeAnalysisPhase>(); |
3497 | 3457 |
3498 ComputeMinusZeroChecks(); | 3458 ComputeMinusZeroChecks(); |
3499 | 3459 |
3500 // Eliminate redundant stack checks on backwards branches. | 3460 // Eliminate redundant stack checks on backwards branches. |
3501 HStackCheckEliminator sce(this); | 3461 Run<HStackCheckEliminationPhase>(); |
3502 sce.Process(); | |
3503 | 3462 |
3504 if (FLAG_idefs) SetupInformativeDefinitions(); | 3463 if (FLAG_idefs) SetupInformativeDefinitions(); |
3505 if (FLAG_array_bounds_checks_elimination && !FLAG_idefs) { | 3464 if (FLAG_array_bounds_checks_elimination && !FLAG_idefs) { |
3506 EliminateRedundantBoundsChecks(); | 3465 EliminateRedundantBoundsChecks(); |
3507 } | 3466 } |
3508 if (FLAG_array_index_dehoisting) DehoistSimpleArrayIndexComputations(); | 3467 if (FLAG_array_index_dehoisting) DehoistSimpleArrayIndexComputations(); |
3509 if (FLAG_dead_code_elimination) Run<HDeadCodeEliminationPhase>(); | 3468 if (FLAG_dead_code_elimination) Run<HDeadCodeEliminationPhase>(); |
3510 | 3469 |
3511 RestoreActualValues(); | 3470 RestoreActualValues(); |
3512 | 3471 |
(...skipping 7228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10741 if (ShouldProduceTraceOutput()) { | 10700 if (ShouldProduceTraceOutput()) { |
10742 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 10701 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
10743 } | 10702 } |
10744 | 10703 |
10745 #ifdef DEBUG | 10704 #ifdef DEBUG |
10746 graph_->Verify(false); // No full verify. | 10705 graph_->Verify(false); // No full verify. |
10747 #endif | 10706 #endif |
10748 } | 10707 } |
10749 | 10708 |
10750 } } // namespace v8::internal | 10709 } } // namespace v8::internal |
OLD | NEW |