Changeset 124404 in webkit for trunk/Source/JavaScriptCore/dfg/DFGVariableAccessData.h
- Timestamp:
- Aug 1, 2012, 9:32:30 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/dfg/DFGVariableAccessData.h
r121798 r124404 38 38 namespace JSC { namespace DFG { 39 39 40 enum DoubleBallot { VoteValue, VoteDouble }; 41 40 42 class VariableAccessData : public UnionFind<VariableAccessData> { 41 43 public: 42 enum Ballot { VoteValue, VoteDouble };43 44 44 VariableAccessData() 45 45 : m_local(static_cast<VirtualRegister>(std::numeric_limits<int>::min())) … … 50 50 , m_isCaptured(false) 51 51 , m_isArgumentsAlias(false) 52 , m_structureCheckHoistingFailed(false) 52 53 { 53 54 clearVotes(); … … 62 63 , m_isCaptured(isCaptured) 63 64 , m_isArgumentsAlias(false) 65 , m_structureCheckHoistingFailed(false) 64 66 { 65 67 clearVotes(); … … 89 91 { 90 92 return m_isCaptured; 93 } 94 95 bool mergeStructureCheckHoistingFailed(bool failed) 96 { 97 bool newFailed = m_structureCheckHoistingFailed | failed; 98 if (newFailed == m_structureCheckHoistingFailed) 99 return false; 100 m_structureCheckHoistingFailed = newFailed; 101 return true; 102 } 103 104 bool structureCheckHoistingFailed() 105 { 106 return m_structureCheckHoistingFailed; 91 107 } 92 108 … … 137 153 { 138 154 ASSERT(find() == this); 139 m_votes[ VoteValue] = 0;140 m_votes[ VoteDouble] = 0;141 } 142 143 void vote( Ballotballot)144 { 145 ASSERT( static_cast<unsigned>(ballot)< 2);155 m_votes[0] = 0; 156 m_votes[1] = 0; 157 } 158 159 void vote(unsigned ballot) 160 { 161 ASSERT(ballot < 2); 146 162 m_votes[ballot]++; 147 163 } 148 164 149 double doubleVoteRatio()165 double voteRatio() 150 166 { 151 167 ASSERT(find() == this); 152 return static_cast<double>(m_votes[ VoteDouble]) / m_votes[VoteValue];168 return static_cast<double>(m_votes[1]) / m_votes[0]; 153 169 } 154 170 … … 177 193 // If the variable has been voted to become a double, then make it a 178 194 // double. 179 if ( doubleVoteRatio() >= Options::doubleVoteRatioForDoubleFormat())195 if (voteRatio() >= Options::doubleVoteRatioForDoubleFormat()) 180 196 return true; 181 197 … … 251 267 NodeFlags m_flags; 252 268 253 float m_votes[2]; 269 float m_votes[2]; // Used primarily for double voting but may be reused for other purposes. 254 270 DoubleFormatState m_doubleFormatState; 255 271 256 272 bool m_isCaptured; 257 273 bool m_isArgumentsAlias; 274 bool m_structureCheckHoistingFailed; 258 275 }; 259 276
Note:
See TracChangeset
for help on using the changeset viewer.