Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(273)

Side by Side Diff: src/hydrogen-load-elimination.cc

Issue 143413019: Load elimination fix with a test case. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review notes applied Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/hydrogen-instructions.cc ('k') | test/mjsunit/compiler/load-elimination.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 } else { 169 } else {
170 fields_[i] = approx->next_; 170 fields_[i] = approx->next_;
171 } 171 }
172 approx = approx->next_; 172 approx = approx->next_;
173 continue; 173 continue;
174 } 174 }
175 prev = approx; 175 prev = approx;
176 approx = approx->next_; 176 approx = approx->next_;
177 } 177 }
178 } 178 }
179 if (FLAG_trace_load_elimination) {
180 TRACE((" merge-to B%d\n", succ->block_id()));
181 Print();
182 }
179 return this; 183 return this;
180 } 184 }
181 185
182 friend class HLoadEliminationEffects; // Calls Kill() and others. 186 friend class HLoadEliminationEffects; // Calls Kill() and others.
183 friend class HLoadEliminationPhase; 187 friend class HLoadEliminationPhase;
184 188
185 private: 189 private:
186 // Process a load instruction, updating internal table state. If a previous 190 // Process a load instruction, updating internal table state. If a previous
187 // load or store for this object and field exists, return the new value with 191 // load or store for this object and field exists, return the new value with
188 // which the load should be replaced. Otherwise, return {instr}. 192 // which the load should be replaced. Otherwise, return {instr}.
(...skipping 12 matching lines...) Expand all
201 // Eliminate the load. Reuse previously stored value or load instruction. 205 // Eliminate the load. Reuse previously stored value or load instruction.
202 return approx->last_value_; 206 return approx->last_value_;
203 } 207 }
204 } 208 }
205 209
206 // Process a store instruction, updating internal table state. If a previous 210 // Process a store instruction, updating internal table state. If a previous
207 // store to the same object and field makes this store redundant (e.g. because 211 // store to the same object and field makes this store redundant (e.g. because
208 // the stored values are the same), return NULL indicating that this store 212 // the stored values are the same), return NULL indicating that this store
209 // instruction is redundant. Otherwise, return {instr}. 213 // instruction is redundant. Otherwise, return {instr}.
210 HValue* store(HStoreNamedField* instr) { 214 HValue* store(HStoreNamedField* instr) {
215 if (instr->store_mode() == PREINITIALIZING_STORE) {
216 TRACE((" skipping preinitializing store\n"));
217 return instr;
218 }
219
211 int field = FieldOf(instr->access()); 220 int field = FieldOf(instr->access());
212 if (field < 0) return KillIfMisaligned(instr); 221 if (field < 0) return KillIfMisaligned(instr);
213 222
214 HValue* object = instr->object()->ActualValue(); 223 HValue* object = instr->object()->ActualValue();
215 HValue* value = instr->value(); 224 HValue* value = instr->value();
216 225
217 if (instr->has_transition()) { 226 if (instr->has_transition()) {
218 // A transition introduces a new field and alters the map of the object. 227 // A transition introduces a new field and alters the map of the object.
219 // Since the field in the object is new, it cannot alias existing entries. 228 // Since the field in the object is new, it cannot alias existing entries.
220 // TODO(titzer): introduce a constant for the new map and remember it. 229 // TODO(titzer): introduce a constant for the new map and remember it.
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 } else { 506 } else {
498 // Perform only local analysis. 507 // Perform only local analysis.
499 for (int i = 0; i < graph()->blocks()->length(); i++) { 508 for (int i = 0; i < graph()->blocks()->length(); i++) {
500 table->Kill(); 509 table->Kill();
501 engine.AnalyzeOneBlock(graph()->blocks()->at(i), table); 510 engine.AnalyzeOneBlock(graph()->blocks()->at(i), table);
502 } 511 }
503 } 512 }
504 } 513 }
505 514
506 } } // namespace v8::internal 515 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen-instructions.cc ('k') | test/mjsunit/compiler/load-elimination.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698