OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
863 } | 863 } |
864 } | 864 } |
865 // Replace the uses and add phis modified to the work list. | 865 // Replace the uses and add phis modified to the work list. |
866 for (int i = 0; i < uses_to_replace.length(); ++i) { | 866 for (int i = 0; i < uses_to_replace.length(); ++i) { |
867 HValue* use = uses_to_replace[i]; | 867 HValue* use = uses_to_replace[i]; |
868 phi->ReplaceAtUse(use, value); | 868 phi->ReplaceAtUse(use, value); |
869 if (use->IsPhi()) worklist.Add(HPhi::cast(use)); | 869 if (use->IsPhi()) worklist.Add(HPhi::cast(use)); |
870 } | 870 } |
871 uses_to_replace.Rewind(0); | 871 uses_to_replace.Rewind(0); |
872 block->RemovePhi(phi); | 872 block->RemovePhi(phi); |
873 } else if (phi->HasNoUses() && | 873 } else if (FLAG_eliminate_dead_phis && phi->HasNoUses() && |
874 !phi->HasReceiverOperand() && | 874 !phi->IsReceiver()) { |
875 FLAG_eliminate_dead_phis) { | 875 // We can't eliminate phis in the receiver position in the environment |
876 // We can't eliminate phis that have the receiver as an operand | 876 // because in case of throwing an error we need this value to |
877 // because in case of throwing an error we need the correct | 877 // construct a stack trace. |
878 // receiver value in the environment to construct a corrent | |
879 // stack trace. | |
880 block->RemovePhi(phi); | 878 block->RemovePhi(phi); |
881 block->RecordDeletedPhi(phi->merged_index()); | 879 block->RecordDeletedPhi(phi->merged_index()); |
882 } | 880 } |
883 } | 881 } |
884 } | 882 } |
885 | 883 |
886 | 884 |
887 bool HGraph::CollectPhis() { | 885 bool HGraph::CollectPhis() { |
888 const ZoneList<HBasicBlock*>* blocks = graph_->blocks(); | 886 const ZoneList<HBasicBlock*>* blocks = graph_->blocks(); |
889 phi_list_ = new ZoneList<HPhi*>(blocks->length()); | 887 phi_list_ = new ZoneList<HPhi*>(blocks->length()); |
(...skipping 5038 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5928 } | 5926 } |
5929 } | 5927 } |
5930 | 5928 |
5931 #ifdef DEBUG | 5929 #ifdef DEBUG |
5932 if (graph_ != NULL) graph_->Verify(); | 5930 if (graph_ != NULL) graph_->Verify(); |
5933 if (allocator_ != NULL) allocator_->Verify(); | 5931 if (allocator_ != NULL) allocator_->Verify(); |
5934 #endif | 5932 #endif |
5935 } | 5933 } |
5936 | 5934 |
5937 } } // namespace v8::internal | 5935 } } // namespace v8::internal |
OLD | NEW |