Index: src/hydrogen-gvn.cc |
diff --git a/src/hydrogen-gvn.cc b/src/hydrogen-gvn.cc |
index da986e34cb8f4e57d03ce5e630637e401bc431ed..2ada8976ef18f8de33cbfbcf3bd456fa0dbae078 100644 |
--- a/src/hydrogen-gvn.cc |
+++ b/src/hydrogen-gvn.cc |
@@ -346,17 +346,20 @@ SideEffects SideEffectsTracker::ComputeChanges(HInstruction* instr) { |
int index; |
SideEffects result(instr->ChangesFlags()); |
if (result.ContainsFlag(kGlobalVars)) { |
- if (instr->IsStoreGlobalCell() && |
- ComputeGlobalVar(HStoreGlobalCell::cast(instr)->cell(), &index)) { |
- result.RemoveFlag(kGlobalVars); |
- result.AddSpecial(GlobalVar(index)); |
- } else { |
- for (index = 0; index < kNumberOfGlobalVars; ++index) { |
+ if (instr->IsStoreNamedField()) { |
+ HStoreNamedField* store = HStoreNamedField::cast(instr); |
+ HConstant* target = HConstant::cast(store->object()); |
+ if (ComputeGlobalVar(Unique<PropertyCell>::cast(target->GetUnique()), |
+ &index)) { |
+ result.RemoveFlag(kGlobalVars); |
result.AddSpecial(GlobalVar(index)); |
+ return result; |
} |
} |
- } |
- if (result.ContainsFlag(kInobjectFields)) { |
+ for (index = 0; index < kNumberOfGlobalVars; ++index) { |
+ result.AddSpecial(GlobalVar(index)); |
+ } |
+ } else if (result.ContainsFlag(kInobjectFields)) { |
if (instr->IsStoreNamedField() && |
ComputeInobjectField(HStoreNamedField::cast(instr)->access(), &index)) { |
result.RemoveFlag(kInobjectFields); |
@@ -375,17 +378,20 @@ SideEffects SideEffectsTracker::ComputeDependsOn(HInstruction* instr) { |
int index; |
SideEffects result(instr->DependsOnFlags()); |
if (result.ContainsFlag(kGlobalVars)) { |
- if (instr->IsLoadGlobalCell() && |
- ComputeGlobalVar(HLoadGlobalCell::cast(instr)->cell(), &index)) { |
- result.RemoveFlag(kGlobalVars); |
- result.AddSpecial(GlobalVar(index)); |
- } else { |
- for (index = 0; index < kNumberOfGlobalVars; ++index) { |
+ if (instr->IsLoadNamedField()) { |
+ HLoadNamedField* load = HLoadNamedField::cast(instr); |
+ HConstant* target = HConstant::cast(load->object()); |
+ if (ComputeGlobalVar(Unique<PropertyCell>::cast(target->GetUnique()), |
+ &index)) { |
+ result.RemoveFlag(kGlobalVars); |
result.AddSpecial(GlobalVar(index)); |
+ return result; |
} |
} |
- } |
- if (result.ContainsFlag(kInobjectFields)) { |
+ for (index = 0; index < kNumberOfGlobalVars; ++index) { |
+ result.AddSpecial(GlobalVar(index)); |
+ } |
+ } else if (result.ContainsFlag(kInobjectFields)) { |
if (instr->IsLoadNamedField() && |
ComputeInobjectField(HLoadNamedField::cast(instr)->access(), &index)) { |
result.RemoveFlag(kInobjectFields); |
@@ -439,7 +445,8 @@ GVN_UNTRACKED_FLAG_LIST(DECLARE_FLAG) |
} |
-bool SideEffectsTracker::ComputeGlobalVar(Unique<Cell> cell, int* index) { |
+bool SideEffectsTracker::ComputeGlobalVar(Unique<PropertyCell> cell, |
+ int* index) { |
for (int i = 0; i < num_global_vars_; ++i) { |
if (cell == global_vars_[i]) { |
*index = i; |