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 2055 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2945 global->Lookup(*var->name(), lookup); | 2943 global->Lookup(*var->name(), lookup); |
2946 if (!lookup->IsProperty()) { | 2944 if (!lookup->IsProperty()) { |
2947 BAILOUT("global variable cell not yet introduced"); | 2945 BAILOUT("global variable cell not yet introduced"); |
2948 } | 2946 } |
2949 if (lookup->type() != NORMAL) { | 2947 if (lookup->type() != NORMAL) { |
2950 BAILOUT("global variable has accessors"); | 2948 BAILOUT("global variable has accessors"); |
2951 } | 2949 } |
2952 if (is_store && lookup->IsReadOnly()) { | 2950 if (is_store && lookup->IsReadOnly()) { |
2953 BAILOUT("read-only global variable"); | 2951 BAILOUT("read-only global variable"); |
2954 } | 2952 } |
| 2953 if (lookup->holder() != *global) { |
| 2954 BAILOUT("global property on prototype of global object"); |
| 2955 } |
2955 } | 2956 } |
2956 | 2957 |
2957 | 2958 |
2958 void HGraphBuilder::VisitVariableProxy(VariableProxy* expr) { | 2959 void HGraphBuilder::VisitVariableProxy(VariableProxy* expr) { |
2959 Variable* variable = expr->AsVariable(); | 2960 Variable* variable = expr->AsVariable(); |
2960 if (variable == NULL) { | 2961 if (variable == NULL) { |
2961 BAILOUT("reference to rewritten variable"); | 2962 BAILOUT("reference to rewritten variable"); |
2962 } else if (variable->IsStackAllocated()) { | 2963 } else if (variable->IsStackAllocated()) { |
2963 if (environment()->Lookup(variable)->CheckFlag(HValue::kIsArguments)) { | 2964 if (environment()->Lookup(variable)->CheckFlag(HValue::kIsArguments)) { |
2964 BAILOUT("unsupported context for arguments object"); | 2965 BAILOUT("unsupported context for arguments object"); |
(...skipping 2931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5896 } | 5897 } |
5897 } | 5898 } |
5898 | 5899 |
5899 #ifdef DEBUG | 5900 #ifdef DEBUG |
5900 if (graph_ != NULL) graph_->Verify(); | 5901 if (graph_ != NULL) graph_->Verify(); |
5901 if (allocator_ != NULL) allocator_->Verify(); | 5902 if (allocator_ != NULL) allocator_->Verify(); |
5902 #endif | 5903 #endif |
5903 } | 5904 } |
5904 | 5905 |
5905 } } // namespace v8::internal | 5906 } } // namespace v8::internal |
OLD | NEW |