OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_DATAFLOW_H_ | 5 #ifndef V8_DATAFLOW_H_ |
6 #define V8_DATAFLOW_H_ | 6 #define V8_DATAFLOW_H_ |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 return true; | 157 return true; |
158 } | 158 } |
159 | 159 |
160 bool Equals(const BitVector& other) { | 160 bool Equals(const BitVector& other) { |
161 for (int i = 0; i < data_length_; i++) { | 161 for (int i = 0; i < data_length_; i++) { |
162 if (data_[i] != other.data_[i]) return false; | 162 if (data_[i] != other.data_[i]) return false; |
163 } | 163 } |
164 return true; | 164 return true; |
165 } | 165 } |
166 | 166 |
| 167 int Count() const { |
| 168 int count = 0; |
| 169 for (int i = 0; i < data_length_; i++) { |
| 170 int data = data_[i]; |
| 171 if (data != 0) count += CompilerIntrinsics::CountSetBits(data); |
| 172 } |
| 173 return count; |
| 174 } |
| 175 |
167 int length() const { return length_; } | 176 int length() const { return length_; } |
168 | 177 |
169 #ifdef DEBUG | 178 #ifdef DEBUG |
170 void Print(); | 179 void Print(); |
171 #endif | 180 #endif |
172 | 181 |
173 private: | 182 private: |
174 int length_; | 183 int length_; |
175 int data_length_; | 184 int data_length_; |
176 uint32_t* data_; | 185 uint32_t* data_; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 } | 239 } |
231 | 240 |
232 BitVector* bits_; | 241 BitVector* bits_; |
233 }; | 242 }; |
234 | 243 |
235 | 244 |
236 } } // namespace v8::internal | 245 } } // namespace v8::internal |
237 | 246 |
238 | 247 |
239 #endif // V8_DATAFLOW_H_ | 248 #endif // V8_DATAFLOW_H_ |
OLD | NEW |