OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 int current_index_; | 83 int current_index_; |
84 uint32_t current_value_; | 84 uint32_t current_value_; |
85 int current_; | 85 int current_; |
86 | 86 |
87 friend class BitVector; | 87 friend class BitVector; |
88 }; | 88 }; |
89 | 89 |
90 explicit BitVector(int length) | 90 explicit BitVector(int length) |
91 : length_(length), | 91 : length_(length), |
92 data_length_(SizeFor(length)), | 92 data_length_(SizeFor(length)), |
93 data_(Zone::NewArray<uint32_t>(data_length_)) { | 93 data_(ZONE->NewArray<uint32_t>(data_length_)) { |
94 ASSERT(length > 0); | 94 ASSERT(length > 0); |
95 Clear(); | 95 Clear(); |
96 } | 96 } |
97 | 97 |
98 BitVector(const BitVector& other) | 98 BitVector(const BitVector& other) |
99 : length_(other.length()), | 99 : length_(other.length()), |
100 data_length_(SizeFor(length_)), | 100 data_length_(SizeFor(length_)), |
101 data_(Zone::NewArray<uint32_t>(data_length_)) { | 101 data_(ZONE->NewArray<uint32_t>(data_length_)) { |
102 CopyFrom(other); | 102 CopyFrom(other); |
103 } | 103 } |
104 | 104 |
105 static int SizeFor(int length) { | 105 static int SizeFor(int length) { |
106 return 1 + ((length - 1) / 32); | 106 return 1 + ((length - 1) / 32); |
107 } | 107 } |
108 | 108 |
109 BitVector& operator=(const BitVector& rhs) { | 109 BitVector& operator=(const BitVector& rhs) { |
110 if (this != &rhs) CopyFrom(rhs); | 110 if (this != &rhs) CopyFrom(rhs); |
111 return *this; | 111 return *this; |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 | 230 |
231 private: | 231 private: |
232 SparseSet* target_; | 232 SparseSet* target_; |
233 int current_; | 233 int current_; |
234 | 234 |
235 friend class SparseSet; | 235 friend class SparseSet; |
236 }; | 236 }; |
237 | 237 |
238 explicit SparseSet(int universe_size) | 238 explicit SparseSet(int universe_size) |
239 : dense_(4), | 239 : dense_(4), |
240 sparse_(Zone::NewArray<int>(universe_size)) { | 240 sparse_(ZONE->NewArray<int>(universe_size)) { |
241 #ifdef DEBUG | 241 #ifdef DEBUG |
242 size_ = universe_size; | 242 size_ = universe_size; |
243 iterator_count_ = 0; | 243 iterator_count_ = 0; |
244 #endif | 244 #endif |
245 } | 245 } |
246 | 246 |
247 bool Contains(int n) const { | 247 bool Contains(int n) const { |
248 ASSERT(0 <= n && n < size_); | 248 ASSERT(0 <= n && n < size_); |
249 int dense_index = sparse_[n]; | 249 int dense_index = sparse_[n]; |
250 return (0 <= dense_index) && | 250 return (0 <= dense_index) && |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 BitVector av_; | 370 BitVector av_; |
371 | 371 |
372 DISALLOW_COPY_AND_ASSIGN(AssignedVariablesAnalyzer); | 372 DISALLOW_COPY_AND_ASSIGN(AssignedVariablesAnalyzer); |
373 }; | 373 }; |
374 | 374 |
375 | 375 |
376 } } // namespace v8::internal | 376 } } // namespace v8::internal |
377 | 377 |
378 | 378 |
379 #endif // V8_DATAFLOW_H_ | 379 #endif // V8_DATAFLOW_H_ |
OLD | NEW |