| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_HYDROGEN_GVN_H_ | 5 #ifndef V8_HYDROGEN_GVN_H_ |
| 6 #define V8_HYDROGEN_GVN_H_ | 6 #define V8_HYDROGEN_GVN_H_ |
| 7 | 7 |
| 8 #include <iosfwd> | 8 #include <iosfwd> |
| 9 | 9 |
| 10 #include "src/hydrogen.h" | 10 #include "src/hydrogen.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 // field stores don't prevent hoisting and merging of global variable/inobject | 63 // field stores don't prevent hoisting and merging of global variable/inobject |
| 64 // field loads. | 64 // field loads. |
| 65 class SideEffectsTracker FINAL BASE_EMBEDDED { | 65 class SideEffectsTracker FINAL BASE_EMBEDDED { |
| 66 public: | 66 public: |
| 67 SideEffectsTracker() : num_global_vars_(0), num_inobject_fields_(0) {} | 67 SideEffectsTracker() : num_global_vars_(0), num_inobject_fields_(0) {} |
| 68 SideEffects ComputeChanges(HInstruction* instr); | 68 SideEffects ComputeChanges(HInstruction* instr); |
| 69 SideEffects ComputeDependsOn(HInstruction* instr); | 69 SideEffects ComputeDependsOn(HInstruction* instr); |
| 70 | 70 |
| 71 private: | 71 private: |
| 72 friend std::ostream& operator<<(std::ostream& os, const TrackedEffects& f); | 72 friend std::ostream& operator<<(std::ostream& os, const TrackedEffects& f); |
| 73 bool ComputeGlobalVar(Unique<Cell> cell, int* index); | 73 bool ComputeGlobalVar(Unique<PropertyCell> cell, int* index); |
| 74 bool ComputeInobjectField(HObjectAccess access, int* index); | 74 bool ComputeInobjectField(HObjectAccess access, int* index); |
| 75 | 75 |
| 76 static int GlobalVar(int index) { | 76 static int GlobalVar(int index) { |
| 77 DCHECK(index >= 0); | 77 DCHECK(index >= 0); |
| 78 DCHECK(index < kNumberOfGlobalVars); | 78 DCHECK(index < kNumberOfGlobalVars); |
| 79 return index; | 79 return index; |
| 80 } | 80 } |
| 81 static int InobjectField(int index) { | 81 static int InobjectField(int index) { |
| 82 DCHECK(index >= 0); | 82 DCHECK(index >= 0); |
| 83 DCHECK(index < kNumberOfInobjectFields); | 83 DCHECK(index < kNumberOfInobjectFields); |
| 84 return index + kNumberOfGlobalVars; | 84 return index + kNumberOfGlobalVars; |
| 85 } | 85 } |
| 86 | 86 |
| 87 // Track up to four global vars. | 87 // Track up to four global vars. |
| 88 static const int kNumberOfGlobalVars = 4; | 88 static const int kNumberOfGlobalVars = 4; |
| 89 Unique<Cell> global_vars_[kNumberOfGlobalVars]; | 89 Unique<PropertyCell> global_vars_[kNumberOfGlobalVars]; |
| 90 int num_global_vars_; | 90 int num_global_vars_; |
| 91 | 91 |
| 92 // Track up to n inobject fields. | 92 // Track up to n inobject fields. |
| 93 static const int kNumberOfInobjectFields = | 93 static const int kNumberOfInobjectFields = |
| 94 SideEffects::kNumberOfSpecials - kNumberOfGlobalVars; | 94 SideEffects::kNumberOfSpecials - kNumberOfGlobalVars; |
| 95 HObjectAccess inobject_fields_[kNumberOfInobjectFields]; | 95 HObjectAccess inobject_fields_[kNumberOfInobjectFields]; |
| 96 int num_inobject_fields_; | 96 int num_inobject_fields_; |
| 97 }; | 97 }; |
| 98 | 98 |
| 99 | 99 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 // Used when collecting side effects on paths from dominator to | 144 // Used when collecting side effects on paths from dominator to |
| 145 // dominated. | 145 // dominated. |
| 146 BitVector visited_on_paths_; | 146 BitVector visited_on_paths_; |
| 147 | 147 |
| 148 DISALLOW_COPY_AND_ASSIGN(HGlobalValueNumberingPhase); | 148 DISALLOW_COPY_AND_ASSIGN(HGlobalValueNumberingPhase); |
| 149 }; | 149 }; |
| 150 | 150 |
| 151 } } // namespace v8::internal | 151 } } // namespace v8::internal |
| 152 | 152 |
| 153 #endif // V8_HYDROGEN_GVN_H_ | 153 #endif // V8_HYDROGEN_GVN_H_ |
| OLD | NEW |