| 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 // Improvements possible: | 125 // Improvements possible: |
| 126 // - learn from HCheckMaps for field 0 | 126 // - learn from HCheckMaps for field 0 |
| 127 // - remove unobservable stores (write-after-write) | 127 // - remove unobservable stores (write-after-write) |
| 128 // - track cells | 128 // - track cells |
| 129 // - track globals | 129 // - track globals |
| 130 // - track roots | 130 // - track roots |
| 131 } | 131 } |
| 132 return this; | 132 return this; |
| 133 } | 133 } |
| 134 | 134 |
| 135 // Support for global analysis with HFlowEngine: Copy state to sucessor block. | 135 // Support for global analysis with HFlowEngine: Copy state to successor |
| 136 HLoadEliminationTable* Copy(HBasicBlock* succ, Zone* zone) { | 136 // block. |
| 137 HLoadEliminationTable* Copy(HBasicBlock* succ, HBasicBlock* from_block, |
| 138 Zone* zone) { |
| 137 HLoadEliminationTable* copy = | 139 HLoadEliminationTable* copy = |
| 138 new(zone) HLoadEliminationTable(zone, aliasing_); | 140 new(zone) HLoadEliminationTable(zone, aliasing_); |
| 139 copy->EnsureFields(fields_.length()); | 141 copy->EnsureFields(fields_.length()); |
| 140 for (int i = 0; i < fields_.length(); i++) { | 142 for (int i = 0; i < fields_.length(); i++) { |
| 141 copy->fields_[i] = fields_[i]->Copy(zone); | 143 copy->fields_[i] = fields_[i]->Copy(zone); |
| 142 } | 144 } |
| 143 if (FLAG_trace_load_elimination) { | 145 if (FLAG_trace_load_elimination) { |
| 144 TRACE((" copy-to B%d\n", succ->block_id())); | 146 TRACE((" copy-to B%d\n", succ->block_id())); |
| 145 copy->Print(); | 147 copy->Print(); |
| 146 } | 148 } |
| 147 return copy; | 149 return copy; |
| 148 } | 150 } |
| 149 | 151 |
| 150 // Support for global analysis with HFlowEngine: Merge this state with | 152 // Support for global analysis with HFlowEngine: Merge this state with |
| 151 // the other incoming state. | 153 // the other incoming state. |
| 152 HLoadEliminationTable* Merge(HBasicBlock* succ, | 154 HLoadEliminationTable* Merge(HBasicBlock* succ, HLoadEliminationTable* that, |
| 153 HLoadEliminationTable* that, Zone* zone) { | 155 HBasicBlock* that_block, Zone* zone) { |
| 154 if (that->fields_.length() < fields_.length()) { | 156 if (that->fields_.length() < fields_.length()) { |
| 155 // Drop fields not in the other table. | 157 // Drop fields not in the other table. |
| 156 fields_.Rewind(that->fields_.length()); | 158 fields_.Rewind(that->fields_.length()); |
| 157 } | 159 } |
| 158 for (int i = 0; i < fields_.length(); i++) { | 160 for (int i = 0; i < fields_.length(); i++) { |
| 159 // Merge the field approximations for like fields. | 161 // Merge the field approximations for like fields. |
| 160 HFieldApproximation* approx = fields_[i]; | 162 HFieldApproximation* approx = fields_[i]; |
| 161 HFieldApproximation* prev = NULL; | 163 HFieldApproximation* prev = NULL; |
| 162 while (approx != NULL) { | 164 while (approx != NULL) { |
| 163 // TODO(titzer): Merging is O(N * M); sort? | 165 // TODO(titzer): Merging is O(N * M); sort? |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 } else { | 499 } else { |
| 498 // Perform only local analysis. | 500 // Perform only local analysis. |
| 499 for (int i = 0; i < graph()->blocks()->length(); i++) { | 501 for (int i = 0; i < graph()->blocks()->length(); i++) { |
| 500 table->Kill(); | 502 table->Kill(); |
| 501 engine.AnalyzeOneBlock(graph()->blocks()->at(i), table); | 503 engine.AnalyzeOneBlock(graph()->blocks()->at(i), table); |
| 502 } | 504 } |
| 503 } | 505 } |
| 504 } | 506 } |
| 505 | 507 |
| 506 } } // namespace v8::internal | 508 } } // namespace v8::internal |
| OLD | NEW |