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

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

Issue 149063010: Remake of the load elimination fix made earlier (r18884). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebasing on r19056. 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') | src/objects.h » ('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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 } 186 }
187 187
188 friend class HLoadEliminationEffects; // Calls Kill() and others. 188 friend class HLoadEliminationEffects; // Calls Kill() and others.
189 friend class HLoadEliminationPhase; 189 friend class HLoadEliminationPhase;
190 190
191 private: 191 private:
192 // Process a load instruction, updating internal table state. If a previous 192 // Process a load instruction, updating internal table state. If a previous
193 // load or store for this object and field exists, return the new value with 193 // load or store for this object and field exists, return the new value with
194 // which the load should be replaced. Otherwise, return {instr}. 194 // which the load should be replaced. Otherwise, return {instr}.
195 HValue* load(HLoadNamedField* instr) { 195 HValue* load(HLoadNamedField* instr) {
196 // There must be no loads from non observable in-object properties.
197 ASSERT(!instr->access().IsInobject() ||
198 instr->access().existing_inobject_property());
199
196 int field = FieldOf(instr->access()); 200 int field = FieldOf(instr->access());
197 if (field < 0) return instr; 201 if (field < 0) return instr;
198 202
199 HValue* object = instr->object()->ActualValue(); 203 HValue* object = instr->object()->ActualValue();
200 HFieldApproximation* approx = FindOrCreate(object, field); 204 HFieldApproximation* approx = FindOrCreate(object, field);
201 205
202 if (approx->last_value_ == NULL) { 206 if (approx->last_value_ == NULL) {
203 // Load is not redundant. Fill out a new entry. 207 // Load is not redundant. Fill out a new entry.
204 approx->last_value_ = instr; 208 approx->last_value_ = instr;
205 return instr; 209 return instr;
206 } else if (approx->last_value_->block()->EqualToOrDominates( 210 } else if (approx->last_value_->block()->EqualToOrDominates(
207 instr->block())) { 211 instr->block())) {
208 // Eliminate the load. Reuse previously stored value or load instruction. 212 // Eliminate the load. Reuse previously stored value or load instruction.
209 return approx->last_value_; 213 return approx->last_value_;
210 } else { 214 } else {
211 return instr; 215 return instr;
212 } 216 }
213 } 217 }
214 218
215 // Process a store instruction, updating internal table state. If a previous 219 // Process a store instruction, updating internal table state. If a previous
216 // store to the same object and field makes this store redundant (e.g. because 220 // store to the same object and field makes this store redundant (e.g. because
217 // the stored values are the same), return NULL indicating that this store 221 // the stored values are the same), return NULL indicating that this store
218 // instruction is redundant. Otherwise, return {instr}. 222 // instruction is redundant. Otherwise, return {instr}.
219 HValue* store(HStoreNamedField* instr) { 223 HValue* store(HStoreNamedField* instr) {
220 if (instr->store_mode() == PREINITIALIZING_STORE) { 224 if (instr->access().IsInobject() &&
221 TRACE((" skipping preinitializing store\n")); 225 !instr->access().existing_inobject_property()) {
226 TRACE((" skipping non existing property initialization store\n"));
222 return instr; 227 return instr;
223 } 228 }
224 229
225 int field = FieldOf(instr->access()); 230 int field = FieldOf(instr->access());
226 if (field < 0) return KillIfMisaligned(instr); 231 if (field < 0) return KillIfMisaligned(instr);
227 232
228 HValue* object = instr->object()->ActualValue(); 233 HValue* object = instr->object()->ActualValue();
229 HValue* value = instr->value(); 234 HValue* value = instr->value();
230 235
231 if (instr->has_transition()) { 236 if (instr->has_transition()) {
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 } else { 516 } else {
512 // Perform only local analysis. 517 // Perform only local analysis.
513 for (int i = 0; i < graph()->blocks()->length(); i++) { 518 for (int i = 0; i < graph()->blocks()->length(); i++) {
514 table->Kill(); 519 table->Kill();
515 engine.AnalyzeOneBlock(graph()->blocks()->at(i), table); 520 engine.AnalyzeOneBlock(graph()->blocks()->at(i), table);
516 } 521 }
517 } 522 }
518 } 523 }
519 524
520 } } // namespace v8::internal 525 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen-instructions.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698