Chromium Code Reviews| Index: src/hydrogen-load-elimination.cc |
| diff --git a/src/hydrogen-load-elimination.cc b/src/hydrogen-load-elimination.cc |
| index 5f69625bb9990bb9bd7762b0c1615e414924dc6e..4c2f298ad5955a337eb0dd8b91b94cc90e329843 100644 |
| --- a/src/hydrogen-load-elimination.cc |
| +++ b/src/hydrogen-load-elimination.cc |
| @@ -430,11 +430,7 @@ class HLoadEliminationTable : public ZoneObject { |
| class HLoadEliminationEffects : public ZoneObject { |
| public: |
| explicit HLoadEliminationEffects(Zone* zone) |
| - : zone_(zone), |
| - maps_stored_(false), |
| - fields_stored_(false), |
| - elements_stored_(false), |
| - stores_(5, zone) { } |
| + : zone_(zone), stores_(5, zone) { } |
| inline bool Disabled() { |
| return false; // Effects are _not_ disabled. |
| @@ -442,37 +438,23 @@ class HLoadEliminationEffects : public ZoneObject { |
| // Process a possibly side-effecting instruction. |
| void Process(HInstruction* instr, Zone* zone) { |
| - switch (instr->opcode()) { |
| - case HValue::kStoreNamedField: { |
| - stores_.Add(HStoreNamedField::cast(instr), zone_); |
| - break; |
| - } |
| - case HValue::kOsrEntry: { |
| - // Kill everything. Loads must not be hoisted past the OSR entry. |
| - maps_stored_ = true; |
| - fields_stored_ = true; |
| - elements_stored_ = true; |
| - } |
| - default: { |
| - fields_stored_ |= instr->CheckChangesFlag(kInobjectFields); |
| - maps_stored_ |= instr->CheckChangesFlag(kMaps); |
| - maps_stored_ |= instr->CheckChangesFlag(kElementsKind); |
| - elements_stored_ |= instr->CheckChangesFlag(kElementsKind); |
| - elements_stored_ |= instr->CheckChangesFlag(kElementsPointer); |
| - } |
| + if (instr->IsStoreNamedField()) { |
| + stores_.Add(HStoreNamedField::cast(instr), zone_); |
| + } else { |
| + flags_.Add(instr->ChangesFlags()); |
| } |
| } |
| // Apply these effects to the given load elimination table. |
| void Apply(HLoadEliminationTable* table) { |
| - if (fields_stored_) { |
| + if (flags_.Contains(kInobjectFields) || flags_.Contains(kOsrEntries)) { |
| table->Kill(); |
| return; |
| } |
| - if (maps_stored_) { |
| + if (flags_.Contains(kElementsKind) || flags_.Contains(kMaps)) { |
| table->KillOffset(JSObject::kMapOffset); |
| } |
| - if (elements_stored_) { |
| + if (flags_.Contains(kElementsKind) || flags_.Contains(kElementsPointer)) { |
| table->KillOffset(JSObject::kElementsOffset); |
| } |
| @@ -484,9 +466,7 @@ class HLoadEliminationEffects : public ZoneObject { |
| // Union these effects with the other effects. |
| void Union(HLoadEliminationEffects* that, Zone* zone) { |
| - maps_stored_ |= that->maps_stored_; |
| - fields_stored_ |= that->fields_stored_; |
| - elements_stored_ |= that->elements_stored_; |
| + flags_ = that->flags_; |
|
Igor Sheludko
2014/02/11 13:01:57
Probably you want to union GVN flags here instead
Benedikt Meurer
2014/02/12 06:22:43
Indeed, thanks for spotting.
|
| for (int i = 0; i < that->stores_.length(); i++) { |
| stores_.Add(that->stores_[i], zone); |
| } |
| @@ -494,9 +474,7 @@ class HLoadEliminationEffects : public ZoneObject { |
| private: |
| Zone* zone_; |
| - bool maps_stored_ : 1; |
| - bool fields_stored_ : 1; |
| - bool elements_stored_ : 1; |
| + GVNFlagSet flags_; |
| ZoneList<HStoreNamedField*> stores_; |
| }; |